Software interface control multiplexing method and device
By creating unique controls for each set of data to be displayed in the software interface and binding them, obtaining the control address and calling the display interface on the current page, the problems of low control reuse efficiency and large system overhead in the existing technology are solved, and the control is realized Efficient reuse and data consistency on different pages.
Patent Information
- Application Number
- CN202310609700.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-26
- Publication Date
- 2024-12-03
AI Technical Summary
The existing software interface control reuse method is inefficient in development and error-prone when reusing in the same project. Creating control instances directly on different pages increases system overhead and requires rebinding the functional interface to each control instance.
By creating a unique control for each set of data to be displayed, binding the control with the data to be displayed, and obtaining the address of the control, calling the display interface on the current page to display the control, realizing the reuse of the control on different pages, avoiding dynamic Use of libraries and creation of additional control instances.
The reuse of controls on different pages is realized, and the data consistency and functional consistency of controls displayed on different pages is maintained, reducing the complexity and system overhead of reuse.
Smart Images

Figure CN119065666A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of software development, and in particular to a method and device for reusing software interface controls. Background Art
[0002] In the existing software interface development, in order to meet the special needs of interface controls, controls with the same display function can be abstracted into custom control classes. When in use, the custom control class can be encapsulated as a dynamic library for reuse in different projects, or instances of the custom control class can be created in different pages for reuse.
[0003] In the process of implementing the embodiments of the present invention, the inventors found that there are at least the following problems in the above related technologies: if the dynamic library form is used for reuse, it is necessary to provide additional call interfaces for the controls and reference header files and library files, which leads to low development efficiency and error-proneness when reused in the same project. If control instances are directly created on different pages for reuse, it is necessary to apply to the system for storage space resources of multiple control instances, which increases system overhead. At the same time, it is necessary to rebind the functional interface to each control instance. Summary of the invention
[0004] The embodiment of the present invention provides a software interface control reuse method and device, which can realize control reuse without using a dynamic library and direct reuse.
[0005] The purpose of the embodiment of the present invention is achieved through the following technical solutions:
[0006] To solve the above technical problems, in the first aspect, a method for reusing software interface controls is provided in an embodiment of the present invention, comprising: creating a unique control for each group of data to be displayed, binding the control to the data to be displayed, and the control is used to display the bound data to be displayed; obtaining the address of the control, and using the address of the control to call a display interface on the current page to display the control; wherein, when controls are laid out on different pages using the same control address, the display content of the data to be displayed bound to the control is consistent at runtime.
[0007] In some embodiments, the binding of the control to the data to be displayed specifically includes: obtaining an event that causes a change in the data to be displayed according to business logic, and binding the event to the control corresponding to the data to be displayed, so as to change the content displayed by the control driven by the event.
[0008] In some embodiments, obtaining the address of the control specifically includes: obtaining a pointer generated when the control creates a unique instance, and using the pointer of the unique instance as the address of the control.
[0009] In some embodiments, the obtaining of the unique instance of the control further includes: using an interface manager to uniformly manage the unique instances of all controls, obtaining the unique instance of the control through the interface manager, and obtaining a pointer to the instance through the obtained unique instance.
[0010] In some embodiments, the use of the address of the control to display the control on the current page specifically includes: on the current page, on the current page, binding the address of the control to the control generated in the visual editor to set the display position and size of the control; and / or, on the current page, calling the display interface using the address of the control, setting the display position and size of the control through the parameters of the display interface; and, calling the state setting interface using the address of the control, setting the display state of the control through the state setting interface.
[0011] In some embodiments, using the address of the control to display the control on the current page also includes: when switching pages, using the address of the control to set the display state of the control on the previous page to hidden, and setting the display state of the control on the current page to displayed.
[0012] In some embodiments, displaying the control on the current page using the address of the control further includes: when the control has multiple display forms, setting the required display form on the current page using the address of the control.
[0013] In some embodiments, the use of the control address to display the control on the current page also includes: when the control contains multiple sub-controls, using the control address to obtain the address of each sub-control that needs to be displayed, and using the sub-control address to set the display position and display status of the sub-control.
[0014] In some embodiments, the use of the control address to display the control on the current page also includes: when the page is switched, recording the content of the last data to be displayed on the previous page displayed by the control, and when switching back from the current page to the previous page, restoring the content of the last data to be displayed on the previous page and / or recording the historical data displayed by the control on each page, and when necessary, displaying all historical data in the control; and / or, recording the historical data corresponding to the preset feature, and when necessary, displaying the historical data corresponding to the preset feature in the control.
[0015] To solve the above technical problems, in the second aspect, an embodiment of the present invention provides a software interface control multiplexing device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the first aspect above.
[0016] To solve the above technical problems, in the third aspect, an embodiment of the present invention provides a non-volatile computer-readable storage medium, including: the computer-readable storage medium stores computer-executable instructions, which are executed by one or more processors to facilitate the execution of the software interface control reuse method described in the first aspect.
[0017] To solve the above technical problems, in the fourth aspect, an embodiment of the present invention provides a computer program product: comprising a computer program stored on a non-volatile computer-readable storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by a computer, the computer executes the software interface control reuse method described in the first aspect.
[0018] Compared with the prior art, the beneficial effects of the present invention are as follows: Different from the prior art, the embodiment of the present invention provides a software interface control reuse method, which creates a unique control for each group of data to be displayed, binds the control to the data to be displayed, and the control is used to display the bound data to be displayed, and then obtains the address of the control, and uses the address of the control to display the control on the current page, so that the data to be displayed bound to the control is consistent on different pages. The software interface control reuse method provided by the embodiment of the present invention can realize the reuse of controls on different pages without using dynamic libraries or creating additional control instances, and keeps the data displayed by the controls on different pages consistent and the functions consistent during reuse. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements / modules and steps with the same reference numerals in the drawings are represented as similar elements / modules and steps. Unless otherwise specified, the figures in the drawings do not constitute proportional limitations.
[0020] Figure 1 It is a flowchart of a software interface control reuse method provided in the first embodiment of the present invention;
[0021] Figure 2 It is a schematic diagram of the code architecture of pages, controls and data binding in the prior art;
[0022] Figure 3 yes Figure 1 A schematic diagram of the code architecture of pages, controls and data binding in the software interface control reuse method shown;
[0023] Figure 4 It is a flowchart of a software interface control reuse method provided in Embodiment 2 of the present invention;
[0024] Figure 5It is a schematic diagram of the implementation effect of a software interface control reuse method provided in the second embodiment of the present invention;
[0025] Figure 6 It is a flowchart of a software interface control reuse method provided in Embodiment 3 of the present invention;
[0026] Figure 7 It is a schematic diagram of the implementation effect of a software interface control reuse method provided in the third embodiment of the present invention;
[0027] Figure 8 It is a flowchart of a software interface control reuse method provided by Embodiment 4 of the present invention;
[0028] Fig. 9 It is a schematic diagram of the implementation effect of a software interface control multiplexing method provided by the fourth embodiment of the present invention;
[0029] Fig.10 It is a flowchart of another software interface control reuse method provided by Embodiment 4 of the present invention;
[0030] Fig.11 Schematic diagram of the implementation effect of another software interface control reuse method provided by the fourth embodiment of the present invention;
[0031] Fig.12 It is a flowchart of another software interface control reuse method provided by the fourth embodiment of the present invention;
[0032] Fig.13 This is a schematic diagram of the implementation effect of another software interface control reuse method provided by the fourth embodiment of the present invention;
[0033] Fig.14 It is a hardware structure diagram of a software interface control multiplexing device provided in Embodiment 5 of the present invention. DETAILED DESCRIPTION
[0034] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several variations and improvements may be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.
[0035] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0036] It should be noted that, if there is no conflict, the various features in the embodiments of the present invention can be combined with each other, and all are within the scope of protection of this application. In addition, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order than the module division in the device or the order in the flow chart.
[0037] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in this specification and in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. In addition, the technical features involved in each embodiment of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0038] In order to solve the problem of synchronous display of the same data to be displayed in different pages, an embodiment of the present invention provides a software interface control reuse method and a software interface control reuse device, the method creates a unique control for each group of data to be displayed, binds the control to the data to be displayed, and the control is used to display the bound data to be displayed; obtains the address of the control, and uses the address of the control to call a display interface on the current page to display the control; wherein, when controls are laid out on different pages using the same control address, the display content of the data to be displayed bound to the control is consistent at runtime, and the method can realize the reuse of controls on different pages without using a dynamic library or creating additional control instances, and keep the data displayed by the controls on different pages consistent and the functions consistent during reuse.
[0039] Specifically, the embodiments of the present invention are further described below in conjunction with the accompanying drawings.
[0040] Embodiment 1
[0041] In the rapid development of software interfaces, in order to facilitate the reuse of controls with specific functions, they are usually encapsulated in the form of dynamic libraries. However, when encapsulating controls as dynamic libraries, it is necessary to compile the control class additionally and introduce the corresponding dynamic library files, which makes the project files bulky and difficult to manage. On the other hand, in order to implement the call of the dynamic library, it is also necessary to add its call interface, and add the corresponding header files and reference statements, which is more complicated to use and prone to errors.
[0042] Furthermore, in some scenarios, controls of the same display type may have different functional dependencies due to business needs. For example, for a type of text box control with a custom display form, control 1 of this type needs to display voltage data on different pages, and control 2 of this type needs to display current data on different pages. In this scenario, even if the same display type of control reuse is achieved using a dynamic library, control 1 must be bound to the voltage data, and control 2 must be bound to the current data. At the same time, the use of dynamic libraries cannot achieve the reuse of the same data display function on different pages. For example, in order to display voltage data on different pages, an instance of control 1 (object, abbreviated as OBJ) must be created on each page, and the relevant data must be re-bound to each instance of control 1 or the dependency interface must be re-bound to build the relevant functional dependency, which is cumbersome to use.
[0043] In order to solve the above problems, the embodiment of the present invention provides a method for reusing software interface controls. Figure 1 , which shows the process of a software interface control reuse method provided by an embodiment of the present invention, which can be applied in the field of software development. The software interface control reuse method includes but is not limited to the following steps:
[0044] Step 101: creating a unique control for each group of data to be displayed, binding the control to the data to be displayed, and the control is used to display the bound data to be displayed.
[0045] During the software development process, the data displayed in the controls on the front end of the software needs to be obtained by the back end. In order to facilitate the use of data by the controls, the controls of the interface layer need to bind the data of the interface layer with the data of the function layer through the data interface provided by the back end. For example, in the equipment debugging software, each debugging page needs to view the online status of the hardware in real time, and the data of the hardware online status needs to be obtained by the back-end program communicating with the hardware, and then obtained by the online status display control through the data interface. According to the method of the prior art, it is necessary to create an instance of the online status display control on each page, and call the data interface for the instance on each page to obtain the current real-time online status. The process is cumbersome and prone to errors.
[0046] In the method provided in this embodiment, each group of data to be displayed uses only a unique control instance. For example, for the online status data to be displayed, only a unique online status display control is used in the entire project. The online status display control is bound to the online status data. All pages that need to display the online status data use this unique online status display control for display, and each page does not need to associate the control and data separately. In actual implementation, each group of data to be displayed may contain only one or more data. For example, for the online status data display control, when only a single device is allowed to be online, the corresponding data to be displayed is the online or offline status of this device; when multiple devices are allowed to be online at the same time, the corresponding data to be displayed is the device identification or device serial number of all current online devices. Further, the data to be displayed can be not only raw data, but also processed data. For example, the voltage display control can display the raw data of the voltage data in text form, or display the processed voltage data in the form of a line chart, or use the average value of the voltage data at multiple times.
[0047] In the same project, only one control is used for each data to be displayed, and the control is bound to the corresponding data to be displayed. This allows the control to display data and operation logic in a unified manner when switching between multiple pages.
[0048] Step 102: Get the address of the control, and use the address of the control to call the display interface on the current page to display the control, wherein when controls are laid out on different pages using the same control address, the display content of the data to be displayed bound to the control is consistent at runtime.
[0049] In order to use the unique control created in step 101 on different pages, the method provided in this embodiment is called by the address of the control. In specific implementation, the pointer of the instance, reference or other data forms supported by the language characteristics can be used as the address as needed. In this embodiment and other embodiments, for the sake of simplicity of description, the use of a pointer is used as an example for explanation. Specifically, the pointer generated by the control in step 101 when creating a unique instance is obtained, and the pointer of the unique instance is used as the address of the control, that is, (* the instance name of the unique control) is used as the address of the control. In each page, a separate control is not created, but the address of each control on this page is directly obtained through the instance of each page, and the call of each functional interface of the control is performed through the address of the control. Using this method, the control can be reused on different pages when only one control instance is created, without the need to obtain the data to be displayed for the control again on each page, and the combination of different data to be displayed can be completed on different pages simply and quickly.
[0050] For example, in a certain project, a voltage viewing page and a current viewing page of a certain hardware device are included. The voltage viewing page needs to use a voltage display control, and the current viewing page needs to use a current display control. Both pages need to use an online status display control. According to the prior art, it is necessary to create an instance of the online status display control and an instance of the voltage display control in the voltage viewing page, and to create an instance of the online status display control and an instance of the current display control in the current viewing page, and bind the corresponding data to be displayed to each control instance. When the page is switched, the instance of the online status display control on each page needs to obtain the online status data separately. This method repeatedly creates an instance of the online status display control and repeatedly binds the control and data, which is cumbersome and error-prone, and cannot be reused on other pages. Using the method of this embodiment, it is only necessary to create and bind a unique online status display control for the online status data, create and bind a unique voltage display control for the voltage data, and create and bind a unique current display control for the current data. On the voltage viewing page, the control function interface is called through the address of the online status display control and the address of the voltage display control. On the current viewing page, the control function interface is called through the address of the online status display control and the address of the current display control. In this way, it is only necessary to create an instance for each control, and each page only needs to call it through the address of the control. There is no need to repeatedly create controls or repeatedly bind data, which facilitates calling controls with the same function on different pages.
[0051] After step 101 and step 102 provided in this embodiment, the reuse of the control on different pages can be achieved through the address of the control, thereby reducing the complexity of reuse and system overhead.
[0052] In actual implementation, various methods can be used to bind controls to data to be displayed, such as binding directly through control properties, binding the data to be displayed as member variables of the control's corresponding class, and binding through event drivers related to the data to be displayed.
[0053] In order to improve the flexibility of binding and reduce the coupling degree between the interface layer and the back end, it is preferred to use an event-driven binding method. Specifically: according to the business logic, an event that causes the data to be displayed to change is obtained, and the event is bound to the control corresponding to the data to be displayed, so as to change the content displayed by the control through the event drive. When the software is running, according to the business logic, a variety of events that can cause the data to be displayed to change will be generated, such as: timed acquisition of back-end data events, timed data summary events, user input events, user selection events, etc., all of which may cause changes in the data to be displayed. According to the prior art, each control instance is bound to the data to be displayed, and it is necessary to re-acquire the data each time the data to be displayed changes. If a dynamic library call is used or different control instances are created in different pages, then each control used in the project needs to be event-driven binding once, which will increase the synchronization time, and may also cause the control display content and the back-end data to be displayed to be out of sync, and there will be problems such as untimely refresh of the display data or wrong interface data obtained by the back end. In the method provided in this embodiment, the control and the function time are bound through events. When each event is triggered, the data to be displayed will change, and the content of the data to be displayed displayed in the corresponding control will also change accordingly. Therefore, only one event-driven binding is required when the only control is initialized, and the synchronous display of the data to be displayed in different pages can be achieved, which reduces the uncertainty caused by rebinding events and reduces the time for development and testing. In specific implementation, the binding method of controls and events can be selected according to the actual needs of the business and the project architecture, such as rewriting the response function of the event or using a callback function.
[0054] In a certain actual implementation scenario, the project includes page A and page B, and each page needs to use a voltage display control. Figure 2 In the code architecture shown, each page contains an instance of a voltage display control, and event-driven binding is performed on each voltage display control instance. Using the method provided in this embodiment, Figure 3 The code architecture shown creates a unique voltage display control only for voltage data, and binds the voltage data and the voltage display control through the driver of the voltage data acquisition event. When using it, you only need to call various functional interfaces through the address of the unique voltage display control in page A and page B respectively to complete the display and other functions of the voltage display control. At the same time, because the control has been bound to the voltage data, when the voltage data acquisition event is triggered, the control display content will change synchronously with the data to be displayed.
[0055] Furthermore, in another actual implementation scenario, page A needs to use a voltage display control, page B needs to use a current display control, and page C needs to use both a voltage display control and a current display control. Using the method provided in this embodiment, a unique voltage display control is created and bound to voltage data, and a unique current display control is created and bound to current data. When used, page A calls the voltage control through the address of the voltage display control, page B calls the current control through the address of the current display control, and page C calls the voltage control through the address of the voltage display control and calls the current control through the address of the current display control. Since the controls have been bound to the corresponding data respectively, only a simple call using the address of the control is required to complete the display and other functions of the voltage display control, ensuring that the data displayed by the controls with the same function on each page are consistent when the pages are switched, and are changed synchronously when the data to be displayed changes.
[0056] In actual implementation, in order to facilitate the management and calling of controls, an interface manager can be used to uniformly manage the unique instances of all controls, obtain the unique instance of the control through the interface manager, and obtain the pointer of the instance through the obtained unique instance.
[0057] For example, in the above actual implementation scenario, page A, page B and page C can be uniformly acquired through the interface manager management. After page A, page B and page C are created, their addresses are passed to the interface manager and bound to the page name. The acquisition method of each page and control is:
[0058] Page A = Interface Manager->Get Page ("Page A");
[0059] Voltage display control address = Page A->Get Control ("Voltage Display Control");
[0060] Voltage display control address = Interface Manager->Get Page ("Page A")->Get Control ("Voltage Display Control").
[0061] The return value of the control acquisition interface is a control pointer or other forms of control address values. In this way, the address of the required control can be easily acquired through the interface manager.
[0062] After directly obtaining the address of the control or obtaining the address of the control through the interface manager, you can use the address of the control to call the display interface and the state setting interface on the current page, set the display position and size of the control through the parameters of the display interface, and set the display state of the control through the state setting interface. In actual implementation, you can choose a specific usage method according to specific needs. The following briefly lists some available methods, which can be used separately or simultaneously without conflict as needed, or other methods supported by the development tool can be used.
[0063] (1) On the current page, bind the address of the control to the control generated in the visual editor to set the display position and size of the control. For example, use the interface editor of the development tool to layout the visual interface, and use the property setting function of the interface editor to bind the visual controls on different pages in the interface editor to their corresponding spatial addresses. Using this method, visual controls corresponding to the same control address on different pages can be bound to the same control address, which facilitates the layout of the position and size of each control on the interface.
[0064] (2) On the current page, use the address of the control to call the display interface, and set the display position and size of the control through the parameters of the display interface. For example, directly use the control pointer to call the SetSize() interface, and set the position and size of the control on different interfaces through the parameters of the interface; then call the Show() interface through the control pointer, and control whether the control is displayed on different pages through the parameters of the interface. Therefore, you only need to use the same control pointer to call the corresponding interface on different pages to display the only control instance on different pages. Using this method, the control is more flexible, and you can easily dynamically layout and adjust the display status of the control on the page as needed.
[0065] It can be seen from the above examples that the method provided in this embodiment can realize the display of the same control on different pages through the pointer of the unique instance of the control.
[0066] After setting the display position and size of the control in the above way, you can also use the address of the control to call the state setting interface, and set the display state of the control through the state setting interface. The display states that can be set include but are not limited to: show / hide, available / unavailable, dynamic changes in position and size, dynamic changes in color, text and images, etc. The state setting interface can be a general interface such as Show, Enable, SetSize, or a functional interface that is self-written and encapsulated according to functional and business needs during the development process. In the above example, the display call method of the voltage display interface can be: voltage display control address->interface name (interface parameters).
[0067] When displaying controls, if the same control is used on different pages, in order to avoid space conflicts on different pages, it is also necessary to switch the display of different pages and display the control only on the current page. Specifically: when switching pages, use the control address to set the display state of the control on the previous page to hidden, and set the display state of the control on the current page to displayed. Furthermore, in some scenarios, in order to avoid misoperation of the hidden control, it is also necessary to set the properties of the control on the previous page to disabled (disable), and set the properties of the control on the current page to enabled (enable).
[0068] In some embodiments, the display form and display content of the control can also be set using the address of the control as needed to expand the scope of use of the method provided in this embodiment. The following provides some specific implementation methods for reference, and the specific implementation process is described in detail in the following embodiments 2 to 4. It can be understood that in addition to the following methods, the data presentation method of the control can be adjusted as needed, or a combination of multiple data presentation methods can be performed without conflict, and the present invention does not limit this.
[0069] (1) When a control has multiple display formats, use the control's address to set the desired display format on the current page.
[0070] (2) When a control contains multiple sub-controls, use the address of the control to obtain the address of each sub-control that needs to be displayed, and use the address of the sub-control to set the display position and display status of the sub-control.
[0071] (3) When the page is switched, the content of the last data to be displayed displayed by the control on the previous page is recorded; when switching back from the current page to the previous page, the content of the last data to be displayed displayed on the previous page is restored.
[0072] It can be seen that through the above method, different data presentation methods can be implemented on different pages through the address of the control, achieving more flexible control reuse.
[0073] The software interface control reuse method provided by this embodiment has the advantages over the prior art in that it uses the address of a unique control instead of directly generating multiple instances of the control, does not increase the additional system resources occupied by the control instance, does not require additional binding function interfaces, reduces the possible abnormal problems caused by re-adding new logic to the control, and reduces the debugging time in the middle. In actual implementation, the address of the required control can also be obtained through the unified interface of the interface manager, which complies with the software design specifications and facilitates the unified management of all controls.
[0074] Embodiment 2
[0075] In actual implementation, some controls may have different display forms. Based on the software interface control reuse method in the first embodiment, in order to meet different display requirements of controls on different pages, different settings can be made for the use of controls on different pages as needed.
[0076] Specifically, when the control has multiple display forms, the address of the control is used to set the required display form on the current page.
[0077] In the specific implementation, Figure 4 As shown, the conversion of display forms on different pages can be achieved through the following process, and the following process can also be adjusted according to actual needs. In the following steps, page A and page B respectively represent the display pages before and after the user switches during operation, and the first display form and the second display form respectively represent the display forms of controls on different pages during operation.
[0078] Step 201: Use the address of the only control to call the display mode setting interface and set the control to the first display mode.
[0079] For controls with multiple display modes, you can use the display mode setting interface to set the display mode, and set the display mode currently required through different parameters of the display mode setting interface. Corresponding to the display requirements of page A, use the corresponding parameters of the display mode setting interface to set the control display mode to the first display mode. After setting, the control will be displayed in the first display mode on page A when the program is running.
[0080] Step 202: Use the address of the unique control to call the display interface, and display the control on page A in the first display form.
[0081] After setting the display form of the control, it needs to be displayed on page A. In the display event of page A, the display interface parameter of the control is set to "display", so that the control can be displayed on page A using the first display form when the program is running.
[0082] Step 203: In response to the page switching event, the display interface is called using the address of the unique control to hide the control on page A.
[0083] When the user switches from page A to page B, a page switching event is triggered. At this time, the controls on page A need to be hidden to avoid display conflicts. In the hide event of page A, set the display interface parameter of the control to "not display" to hide the control and page A at the same time when the program is running. You can also set the available state interface parameter of the control to "unavailable" to prevent the control from responding to user operations in the hidden state.
[0084] Step 204: Use the address of the only control to call the display mode setting interface and set the control to the second display mode.
[0085] Corresponding to the display requirements of page B, the corresponding parameters of the display mode setting interface are used to set the control display mode to the second display mode. After setting, the control will be displayed in the second display mode on page B when the program is running.
[0086] Step 205: Use the address of the unique control to call the display interface, and display the control on page B in the second display form.
[0087] After setting the display form of the control, it needs to be displayed on page B. In the display event of page B, set the display interface parameter of the control to "display", so that the control can be displayed on page B using the second display form when the program is running.
[0088] After steps 201 to 205 provided in this embodiment, the display form of the control can be switched on different pages according to the address of the control.
[0089] For example, in an actual implementation scenario, the voltage display control is a table control, which is bound to the current voltage data. The table control includes multiple display forms such as tables, lists, and icons. In this scenario, page A is a voltage monitoring page for different devices, which only needs to display the current voltage data of each device; page B is a voltage debugging page for different devices, which needs to display two columns of data, the set voltage data and the current voltage data of each device. Therefore, different display forms can be set for different pages through the address of the voltage display control. When switching to page A, the voltage display control is set to a list form on page A, and only the current voltage data column is displayed; when switching to page B, the voltage display control is set to a table form on page B, and the set voltage data and the current voltage data are displayed at the same time. Since the same voltage display control address is used on both pages, and the voltage display control is bound to the current voltage data, when the current voltage data changes, the voltage display control on each page has a different display form, but can synchronously display the same current voltage data, thereby simply and conveniently realizing the reuse of the same control on different pages and meeting the needs of different display forms on different pages. In this example, the control display effects on page A and page B are as follows: Figure 5 shown.
[0090] Embodiment 3
[0091] In actual implementation, some controls may include multiple sub-controls due to functional requirements. Based on the software interface control reuse method in Example 1, in order to meet the display requirements of different sub-controls that may exist in different pages of the control, the sub-control display of the control can be set differently on different pages as needed.
[0092] Specifically: When a control contains multiple sub-controls, the address of the control is used to obtain the address of each sub-control that needs to be displayed, and the address of the sub-control is used to set the display position and display status of the sub-control.
[0093] In the specific implementation, Figure 6 As shown, the conversion of display forms on different pages can be achieved through the following process, and the following process can also be adjusted according to actual needs. In the following steps, page A and page B respectively represent the display pages before and after the user switches during operation, and the first sub-control and the second sub-control respectively represent different sub-controls displayed on different pages during operation.
[0094] Step 301: Obtain the address of each child control through the address of the unique control.
[0095] In order to control the display of each sub-control separately, it is necessary to first obtain the address of each sub-control. Usually each sub-control is a member of the control class, so the address of each member can be directly obtained through the address of the control, that is: (*unique instance name of the control) -> Get sub-control ("sub-control name"), where the return value of the Get sub-control interface is a pointer to the sub-control or other forms of address. In this embodiment, it is necessary to obtain the address of the first sub-control and the address of the second sub-control.
[0096] Step 302: Call the display interface using the address of the first sub-control to be displayed, and display the first sub-control on page A.
[0097] After obtaining the sub-control address, the first sub-control needs to be displayed on page A. In the display event of page A, set the display interface parameter of the first sub-control to "display" and the display interface parameters of the remaining sub-controls to "not display", so that only the first sub-control can be displayed on page A when the program is running.
[0098] Step 303: In response to the page switching event, the display interface is called using the first sub-control address to hide the first sub-control on page A.
[0099] When the user switches page A to page B, a page switching event is triggered. At this time, the first sub-control on page A needs to be hidden to avoid display conflicts. In the hide event of page A, the display interface parameter of the first sub-control is set to "not display", so that the first sub-control and page A can be hidden at the same time when the program is running. You can also set the available state interface parameter of the first sub-control to "unavailable" to prevent the first sub-control from responding to user operations in the hidden state.
[0100] Step 304: Use the second sub-control address to call the display interface and display the second sub-control on page B.
[0101] Corresponding to the display requirements of page B, the display interface parameters of the second sub-control are set to "display", and the display interface parameters of the remaining sub-controls are set to "not display". When the program is running, the control can only display the second sub-control on page B.
[0102] After steps 301 to 304 provided in this embodiment, different sub-controls can be selectively displayed on different pages by the address of the control. In actual implementation, the first sub-control and the second sub-control can be one or more, and the sub-controls displayed on different pages can be the same or different.
[0103] For example, in an actual implementation scenario, the customized online status display control includes a text box sub-control that displays the device status text, and also includes a picture sub-control that simulates the LED display, which is bound to the online status data of the current device. When the online status data of the device changes, the device status text and the simulated LED picture in the online status display control are simultaneously changed to the text description and LED picture corresponding to the current status. In this scenario, there is more space in page A, and the layout position is sufficient to display the text box sub-control and the picture sub-control at the same time; there is less space in page B, and the layout position is only sufficient to display the picture sub-control. Therefore, the display settings of different sub-controls can be made through the online status display control. When switching to page A, the online status display control is set to display the text box sub-control and the picture sub-control at the same time on page A; when switching to page B, the online status display control is set to display only the picture sub-control on page B. Since the same online status display control address is used on both pages, and the online status display control is bound to the online status data of the current device, when the online status of the current device changes, the online status display control on each page can display the same online status synchronously, although the display form is different, so that the same control can be reused on different pages easily and conveniently, and the needs of different display forms on different pages can be met. In this example, the control display effect on page A and page B is as follows Figure 7 shown.
[0104] Embodiment 4
[0105] In the actual implementation process, some controls may have different display forms, so the same data to be displayed may be displayed in different forms on different pages. Based on the software interface control reuse method in Example 1, in order to meet the different display requirements that may exist between controls on different pages, the display form and display data of the controls can also be set differently on different pages as needed.
[0106] Some specific implementation methods for reference are provided below. It can be understood that in addition to the following methods, the data presentation method of the control can be adjusted as needed, or a combination of multiple data presentation methods can be performed without conflict, and the present invention does not limit this.
[0107] (1) When the page is switched, the content of the last data to be displayed displayed by the control on the previous page is recorded; when switching back from the current page to the previous page, the content of the last data to be displayed displayed on the previous page is restored.
[0108] In the specific implementation, Figure 8 As shown, the conversion of display forms on different pages can be achieved through the following process, and the following process can also be adjusted according to actual needs. In the following steps, page A and page B respectively represent the display pages before and after the user switches during the operation process.
[0109] Step 401: Obtain the bound data to be displayed through the address of the unique control.
[0110] In this embodiment, each group of data to be displayed may be one or more. When displaying, only one or more data may be displayed at the same time, only part or all of them may be displayed. In order to use the data to be displayed, it is necessary to obtain the data to be displayed through the data acquisition interface corresponding to the data to be displayed.
[0111] Step 402: Use the address of the unique control to call the data setting interface, and display the current data to be displayed in the control on page A.
[0112] The data to be displayed on the current page is used as the current data to be displayed. Before page A is displayed, the current display data is set through the control's data setting interface, so that the control can display the current data to be displayed on page A.
[0113] Step 403: In response to the switching event from page A to page B, the data acquisition interface is called using the address of the unique control to obtain the last data displayed by the control on page A as the first data, and the first data is saved in the data structure of the data to be displayed.
[0114] Every data displayed by the control on the page, whether it is set through the data display interface or input or selected by the user, can be obtained through the control's data acquisition interface. Before page A is hidden, the control calls the data acquisition interface to obtain the last data displayed by the control before page A is hidden. This data is called the first data.
[0115] Step 404: Use the address of the unique control to call the data setting interface, and display the current data to be displayed in the control on page B.
[0116] Before page B is displayed, the current display data to be displayed on page B is set through the control's data setting interface, so that the control can display the current data to be displayed on page B.
[0117] Step 405: In response to the switching event from page B to page A, the data acquisition interface is called using the address of the unique control to obtain the last data displayed by the control on page B as the second data, and the second data is saved in the data structure of the data to be displayed.
[0118] Before page B is hidden, the control calls the data acquisition interface to obtain the last data displayed by the control before page B is hidden. This data is called the second data.
[0119] Step 406: Use the address of the unique control to call the data setting interface, and display the saved first data in the control on page A.
[0120] After switching back to page A from page B, the first data is displayed again on page A, that is, the last data before page A switches to page B is displayed. For the user, the data before the switch is retained on page A.
[0121] Step 407: When switching from page A to page B again, the data setting interface is called using the address of the unique control, and the saved second data is displayed in the control on page B.
[0122] After switching back to page B from page A, the second data is displayed again on page B, that is, the last data before page B switches to page A is displayed. For the user, when page A and page B are switched, the data on each page are presented independently of each other.
[0123] After steps 401 to 407 provided in this embodiment, different data in the data to be displayed can be selectively displayed on different pages through the address of the control. In actual implementation, the data structure of the data to be displayed can be a conventional data structure such as array, list, map, etc., or a custom data structure that can meet the data storage requirements can be used.
[0124] For example, an actual implementation scenario includes multiple device status display pages, each of which displays the status of a device. In this scenario, the current device selection control is used to select the device displayed on each page. The control is a drop-down selection control, and the data in the drop-down list is bound to the current online device. In a certain scenario, the user's last selection on page A is device 1, and the last selection on page B is device B. When the user switches to page A, the address of the current device selection control is used to set the display content to the last selection of page A, "Device 1"; when the user switches to page B, the address of the current device selection control is used to set the display content to the last selection of page B, "Device 2". Using this method, the consistency of the current online device data contained in the drop-down list of each page can be guaranteed, and the user does not need to make a selection again when switching between different pages. In this example, the control display effect on page A and page B is as follows: Fig. 9 shown.
[0125] (2) Record the historical data that the control has displayed on each page, and display all historical data in the control when necessary.
[0126] In the specific implementation, Fig.10 As shown, the conversion of display forms on different pages can be achieved through the following process, and the following process can also be adjusted according to actual needs. In the following steps, page A and page B respectively represent the display pages before and after the user switches during the operation process.
[0127] Step 501: Obtain the bound data to be displayed through the address of the unique control.
[0128] In order to use the data to be displayed, it is necessary to obtain the data to be displayed through a data acquisition interface corresponding to the data to be displayed.
[0129] Step 502: Use the address of the unique control to call the data setting interface, and display the current data to be displayed in the control on page A.
[0130] The data to be displayed on the current page is used as the current data to be displayed. Before page A is displayed, the current display data is set through the control's data setting interface, so that the control can display the current data to be displayed on page A.
[0131] Step 503: In response to each change event of the data to be displayed on page A, the data acquisition interface is called using the address of the unique control to obtain each data displayed by the control on page A as historical data, and all historical data are saved in the data structure of the data to be displayed.
[0132] During the entire process of displaying page A, each time the data to be displayed of the control changes, the control calls the data acquisition interface to obtain the data displayed by the control, and all the data displayed by the control can be obtained. The obtained data is called historical data.
[0133] Step 504: Use the address of the unique control to call the data setting interface, and display the specified historical data in the data to be displayed in the control on page B.
[0134] When page B is displayed, all specified historical data can be used as data to be displayed through the data setting interface of the control, so that the control can display all specified historical data on page B.
[0135] After steps 501 to 504 provided in this embodiment, different data in the data to be displayed can be selectively displayed on different pages through the address of the control. In actual implementation, the data structure of the data to be displayed can be a conventional data structure such as array, list, map, etc., or a custom data structure that meets the data storage requirements can be used.
[0136] For example, in an actual implementation scenario, the voltage selection control is an input drop-down selection control. The user can enter the available device voltage in the control, and the data in the drop-down list is bound to all available device voltage data. During use, the user can enter the available device voltage data in different pages as needed. The voltage selection control records the device voltage data entered in all pages so that the previously entered device voltage data can be selected through the drop-down list in subsequent use. At the same time, the device voltage data selected by the user on this page can be displayed separately on each page so that there is no need to select again when switching between different pages. Using this method, it can ensure that the device voltage data contained in the drop-down list of the voltage selection control on each page is consistent, and the user does not need to repeatedly enter the device voltage data that has been used. In this example, the control display effect on page A and page B is as follows. Fig.11 shown.
[0137] (3) Record the historical data corresponding to the preset features, and when necessary, display the historical data corresponding to the preset features in the control.
[0138] In the specific implementation, Fig.12 As shown, the conversion of display forms on different pages can be achieved through the following process, and the following process can also be adjusted according to actual needs. In the following steps, page A and page B respectively represent the display pages before and after the user switches during the operation process.
[0139] Step 601: Obtain the bound data to be displayed through the address of the unique control.
[0140] In order to use the data to be displayed, it is necessary to obtain the data to be displayed through a data acquisition interface corresponding to the data to be displayed.
[0141] Step 602: Use the address of the unique control to call the data setting interface, and display the current data to be displayed in the control on page A.
[0142] The data to be displayed on the current page is used as the current data to be displayed. Before page A is displayed, the current display data is set through the control's data setting interface, so that the control can display the current data to be displayed on page A.
[0143] Step 603: call the data acquisition interface using the address of the unique control, obtain each data that meets the preset characteristics displayed by the control on page A as characteristic data, and save all characteristic data in the data structure of the data to be displayed.
[0144] During the entire process of displaying page A, each time the control's to-be-displayed data meets the preset characteristics, the control calls the data acquisition interface to obtain the data displayed by the control. All data that meets the preset characteristics displayed by the control can be obtained. The obtained data is called feature data.
[0145] Step 604: Use the address of the unique control to call the data setting interface, and display the specified characteristic data in the data to be displayed in the control on page B.
[0146] When page B is displayed, all specified characteristic data are used as data to be displayed through the data setting interface of the control, so that the control can display all specified characteristic data on page B.
[0147] After steps 601 to 604 provided in this embodiment, different data in the data to be displayed can be selectively displayed on different pages through the address of the control. In actual implementation, the data structure of the data to be displayed can be a conventional data structure such as array, list, map, etc., or a custom data structure that can meet the data storage needs can be used.
[0148] For example, in an actual implementation scenario, the voltage display control can use a table control, which is bound to the voltage data list. When displaying, you can use a table with one row and one column to display only the current voltage data, you can also use a table with multiple rows to display the current data of multiple devices, and you can also use a table with multiple columns to display the voltage data of a device at multiple times. In use, the control automatically records each voltage data displayed into the voltage data list, and according to the needs of the user, the display format is set on each page to: display only the current voltage data, display the voltage data of a part of the time interval, or display all the historical voltage data, etc. Among them, the time interval is the specified feature. The specified feature can also be set to: voltage data exceeding a certain threshold, voltage data below a certain threshold, voltage data with a jump interval less than a certain threshold, etc., so as to facilitate the viewing of possible fault data. The specified feature can also be the user's operation feature, such as the voltage data entered by the user, the voltage data marked by the user, etc., for the convenience of subsequent use and viewing by the user. When displaying data, you can use a table to directly display the text corresponding to the voltage data as needed, or you can use a picture to display a line chart after the voltage data is processed. This method can ensure that the voltage data used by the voltage display control on each page is consistent, and users can view the data in different ways as needed. In this example, the control display effect on page A and page B is as follows: Fig.13 shown.
[0149] It can be seen from the above method and specific examples that since the address of the same control is used on different pages, if a group of data to be displayed bound to the control contains multiple data, different display data can be selected as needed, and different display formats can be selected according to the amount of data, thereby simply and conveniently realizing the reuse of the same control on different pages and meeting the needs of different display formats on different pages.
[0150] Embodiment 5
[0151] The embodiment of the present invention also provides a software interface control multiplexing device, see Fig.14 , which shows that it is possible to execute Figure 1 The hardware structure of the software interface control multiplexing method.
[0152] The software interface control multiplexing device comprises: at least one processor 11; and a memory 12 connected to the at least one processor 11 for communication. Fig.14 The memory 12 stores instructions that can be executed by the at least one processor 11, and the instructions are executed by the at least one processor 11 so that the at least one processor 11 can perform the above Figure 1 , Figure 4The processor 11 and the memory 12 may be connected via a bus or other means. Fig.14 The example of connecting through bus is taken in the following.
[0153] The memory 12 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the software interface control reuse method in the embodiment of the present invention. The processor 11 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 12, that is, the methods in the above method embodiments 1 to 4 are implemented.
[0154] The memory 12 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function; the data storage area may store data created according to the use of the software interface control multiplexing device, etc. In addition, the memory 12 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 12 may optionally include a memory remotely arranged relative to the processor 11, and these remote memories may be connected to the software interface control multiplexing device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0155] The one or more modules are stored in the memory 12, and when executed by the one or more processors 11, the software interface control multiplexing method in any of the above method embodiments is executed, for example, the software interface control multiplexing method described above is executed. Figure 1 , Figure 4 etc. method steps.
[0156] The above product can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by the embodiment of the present invention.
[0157] The embodiment of the present invention further provides a non-volatile computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more processors, for example, to execute the above-described Figure 1 , Figure 4 etc. method steps.
[0158] The embodiment of the present invention further provides a computer program product, including a computer program stored on a non-volatile computer-readable storage medium, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the software interface control reuse method in any of the above method embodiments, for example, executing the above described Figure 1 , Figure 4 etc. method steps.
[0159] The embodiment of the present invention provides a software interface control reuse method, which creates a unique control for each group of data to be displayed, binds the control to the data to be displayed, and is used to display the bound data to be displayed; obtains the address of the control, and uses the address of the control to display the control on the current page, so that the data to be displayed bound to the control is displayed consistently on different pages. The software interface control reuse method provided by the embodiment of the present invention can realize the reuse of controls on different pages without using a dynamic library or creating additional control instances, and keeps the data displayed by the controls on different pages consistent during reuse.
[0160] It should be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0161] Through the description of the above implementation methods, ordinary technicians in this field can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Ordinary technicians in this field can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0162] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may also be combined, the steps may be implemented in any order, and there are many other changes in different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A software interface control multiplexing method, characterized in that: include: Creating a unique control for each set of data to be displayed, binding the control to the data to be displayed, and the control being used to display the bound data to be displayed; Get the address of the control, and use the address of the control to call the display interface on the current page to display the control; When controls are laid out on different pages through the address of the same control, the displayed content of the data to be displayed bound to the controls is consistent at runtime.
2. The software interface control reuse method according to claim 1, characterized in that: Binding the control to the data to be displayed specifically includes: According to the business logic, an event that causes the data to be displayed to change is obtained, and the event is bound to a control corresponding to the data to be displayed, so that the content displayed by the control can be changed by driving the event.
3. The software interface control reuse method according to claim 1, characterized in that: The obtaining of the address of the control specifically includes: Get the pointer generated when the control creates a unique instance, and use the pointer of the unique instance as the address of the control.
4. The software interface control reuse method according to claim 3, characterized in that: The step of obtaining the pointer generated by the control when creating a unique instance also includes: The unique instances of all controls are uniformly managed using the interface manager, the unique instance of the control is obtained through the interface manager, and the pointer of the instance is obtained through the obtained unique instance.
5. The software interface control reuse method according to claim 1, characterized in that: The use of the address of the control to call a display interface on the current page to display the control specifically includes: On the current page, bind the control address to the control generated in the visual editor to set the display position and size of the control; And / or, on the current page, calling the display interface using the address of the control, and setting the display position and size of the control through the parameters of the display interface; In addition, the state setting interface is called using the address of the control, and the display state of the control is set through the state setting interface.
6. The software interface control reuse method according to claim 5, characterized in that: The step of setting the display state of the control through the state setting interface further includes: When switching pages, use the address of the control to set the display state of the control on the previous page to hidden, and set the display state of the control on the current page to displayed.
7. The software interface control reuse method according to claim 5, characterized in that: The step of setting the display state of the control through the state setting interface further includes: When a control has multiple display forms, use the control's address to set the required display form on the current page.
8. The software interface control reuse method according to claim 5, characterized in that: The step of setting the display state of the control through the state setting interface further includes: When a control contains multiple sub-controls, use the address of the control to obtain the address of each sub-control that needs to be displayed, and use the address of the sub-control to set the display position and display status of the sub-control.
9. The software interface control reuse method according to claim 5, characterized in that: The step of setting the display state of the control through the state setting interface further includes: When the page is switched, the content of the last data to be displayed displayed by the control on the previous page is recorded. When switching back to the previous page from the current page, the content of the last data to be displayed displayed on the previous page is restored; and / or, record the historical data displayed by the control on each page, and display all the historical data in the control when necessary; And / or, record historical data corresponding to the preset features, and when necessary, display the historical data corresponding to the preset features in the control.
10. A software interface control multiplexing device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the software interface control reuse method as described in any one of claims 1-9.
11. A non-volatile computer-readable storage medium, characterized in that: include: The computer-readable storage medium stores computer-executable instructions, which are executed by one or more processors to facilitate the execution of the software interface control reuse method described in any one of claims 1-9.
12. A computer program product, characterized in that It comprises a computer program stored on a non-volatile computer-readable storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by a computer, the computer is caused to execute the software interface control reuse method according to any one of claims 1 to 9.
