User-defined interface generation method and device during LabVIEW operation, terminal and storage medium
By combining Windows API and LabVIEW technology, the control window is encapsulated and the master-slave relationship is established, and the custom interface generation is realized when LabVIEW runtime is solved, which solves the problem that controls cannot be dynamically added and modified during runtime, and improves the flexibility and efficiency of interface customization.
Patent Information
- Application Number
- CN202510186924.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-06-27
AI Technical Summary
LabVIEW cannot dynamically add controls when running, and the existing controls are stuttered, and the control size cannot be modified, which limits the function of custom interface generation.
By combining the API and LabVIEW programming technology that comes with Windows, the encapsulated control window is in a window form, establishing the relationship between the control window and the main interface, and using Windows Multi-Document Interface Interface (MDI) to achieve control movement, position recording and size modification.
It realizes the custom interface generation of LabVIEW runtime, solves the problems that control creation, modification, movement and editing cannot be achieved at runtime, and improves the flexibility and efficiency of interface customization.
Smart Images

Figure CN120215937A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automated testing, and particularly to a method, device, terminal, and storage medium for generating a custom interface during LabVIEW runtime. Background Art
[0002] When developing a signal-oriented test system, in addition to generating a test report through automated testing, the process variables are also continuously monitored during the test execution. The display of input or output process variables is essential during the system testing process. To quickly and flexibly adapt to different test strategies and meet the observation requirements of key process variables, it is necessary to custom-generate the required display interface.
[0003] LabVIEW has an important influence in the development of test systems. In the development environment, various controls can be quickly configured and selected to display the key information of the test system. However, when developing the software for a general test system research and development platform based on LabVIEW, LabVIEW is in the running state, and the generation of its custom interface involves two key aspects: one is the placement position of the controls, and the other is the modification of the control size.
[0004] Regarding the placement position of the controls, the process is generally to first obtain the left mouse button press event, then obtain the mouse movement event and the final coordinates of the mouse release, and finally modify the coordinate attributes to the final coordinates. During the mouse movement process, the program needs to continuously respond to the mouse movement event and update the position information of the control, resulting in a lag problem.
[0005] Regarding the modification of the control size, the process is generally to first obtain the left mouse button press event and record the pressed coordinates; then drag the outer border of the control with the mouse and move it, and calculate and record the modified control size based on the mouse release coordinates and the pressed coordinates. However, LabVIEW in the running environment does not support the control to change its size following the mouse movement, and the modification of the control size conflicts with the placement position logically and cannot coexist.
[0006] In the prior art, a Chinese invention patent document with the publication number CN111966393A and the publication date of November 20, 2020 is proposed. The technical solution disclosed in this patent document is as follows: A method and system for custom-generating a configurable interface, including: obtaining an XML configuration file generated according to the configuration information of the controls required for the target interface; parsing the XML configuration file to obtain the target controls, control attributes, and interface layout styles; sending the target controls, control attributes, and interface layout styles to a custom window for running to complete the display of the target interface.
[0007] The above technical solution is applied to a WINCE embedded system, and the configuration information of the controls is transmitted using an XML file.
[0008] In the prior art, a Chinese invention patent document with a publication number of CN1808381A and a publication date of July 26, 2006 was also proposed. The technical solution disclosed in this patent document is as follows: A user panel manager and a method for creating a custom dynamic sub-window using the user panel manager. The user panel manager includes an interface module, an interface module, a file module, a configuration module, a deployment module, and a communication module. The interface module is set in the macro editor of the software system. In response to the user executing the "User Panel" menu command in the "Insert" menu of the macro editor, the file module, the configuration module, and the deployment module complete the work of complex user programming, relationship configuration, and interface setting in the prior art. The user only needs to perform simple element selection and arrangement operations to construct the required custom sub-window.
[0009] The above technical solution uses the technology of Office macro editing to implement the encapsulation, configuration, and invocation of sub-windows, and also realizes the mutual invocation and communication functions with Office software. Essentially, it belongs to the extension of Office functions.
[0010] In the prior art, there has not yet been a technical solution that combines the operating system API with LabVIEW to generate a custom interface when LabVIEW is running. Summary of the Invention
[0011] To solve the above technical problems, the present invention proposes a method, device, terminal, and storage medium for generating a custom interface when LabVIEW is running, which can solve the problem that LabVIEW can only create, modify, move, and edit controls in the development mode, but cannot complete the functions of creating, modifying, moving, and editing controls when running, and realizes the generation of a custom interface when LabVIEW is running.
[0012] The present invention is realized by adopting the following technical solutions: A method for generating a custom interface when LabVIEW is running, including the following steps: Encapsulate the control window in the form of a window; Establish the relationship between the control window and the main interface; Move and record the position of the control window; Modify the control size and other attributes.
[0013] Encapsulating the control window in the form of a window specifically means: establishing a window, embedding the control in the window, programming each action of the control within the window, and encapsulating the custom control in the form of a window.
[0014] Establishing the relationship between the control window and the main interface specifically means: establishing a master-slave relationship between the main interface window and the control window.
[0015] Use the SetParent function to establish a master-slave relationship between the main interface window and the control window.
[0016] Recording the position of the control window specifically means: using the GetWindowRect function to record the coordinate position of the control window; when opening the page, using the MoveWindow function to place the control window at the saved control coordinates.
[0017] The other attributes include the control label name, control color, data binding relationship, and control status meaning.
[0018] Modifying the control size specifically means: obtaining the left mouse button click event; setting the control window property to be resizable to display the window border; dragging the window border with the mouse to modify the size of the control; using the GetWindowRect function to record and save the size of the control window.
[0019] A custom interface generation device during LabVIEW runtime, including: An encapsulation unit for encapsulating the control window in the form of a window; An interface relationship management unit for establishing the relationship between the control window and the main interface; A window position management unit for moving and recording the position of the control window; A parameter adjustment unit for modifying the control size and other attributes.
[0020] A terminal, the terminal includes: One or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned custom interface generation method during LabVIEW runtime.
[0021] A computer-readable storage medium, the storage medium contains computer-executable instructions, and the computer-executable instructions are used to execute the above-mentioned custom interface generation method when executed by a computer processor.
[0022] Compared with the prior art, the beneficial effects of the present invention are shown in: 1. When LabVIEW is in the running environment, it is unable to dynamically add controls, lags when arranging existing controls, and cannot modify the control size. The present invention makes use of the APIs built into Windows and cleverly combines the Windows Multiple Document Interface (MDI) technology with LabVIEW programming technology to solve the problem that LabVIEW can only create, modify, move, and edit controls in the development mode, but cannot complete functions such as control creation, modification, movement, and editing during runtime. The key point is that it can generate a custom interface when LabVIEW is running, which is an innovation in the field of LabVIEW programming technology. Compared with the conventional solutions that use Office macro editing technology to encapsulate, configure, and call sub-windows, there are significant differences in the usage scenarios, technical routes, and maturity. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The present invention will be further described in detail below in conjunction with the accompanying drawings of the specification and specific embodiments, where: Figure 1 is a flowchart of the present invention. SPECIFIC EMBODIMENTS
[0024] Embodiment 1 As a preferred embodiment of the present invention, the present invention includes a method for generating a custom interface during LabVIEW runtime, comprising the following steps: Step S1. Encapsulate the control window in the form of a window.
[0025] Step S2. Establish the relationship between the control window and the main interface.
[0026] Step S3. Move and record the position of the control window.
[0027] Step S4. Modify the control size and other properties.
[0028] Embodiment 2 As a preferred embodiment of the present invention, the present invention includes a method for generating a custom interface during LabVIEW runtime, comprising the following steps: Step S1. Encapsulate the control window in the form of a window. Specifically, it includes: creating a window, embedding a control in the window, programming each action of the control within the window, and encapsulating the custom control in the form of a window.
[0029] Step S2. Establish the master-slave relationship between the main interface and the control window.
[0030] Step S3. Modify the control size and other properties. The other properties include the control label name, control color, data binding relationship, and control status meaning.
[0031] Step S4. Move the position of the control window and use the GetWindowRect function to record the coordinate position of the control window.
[0032] Embodiment 3 As another preferred embodiment of the present invention, the present invention includes a custom interface generation device during LabVIEW runtime, including: An encapsulation unit for encapsulating the control window in the form of a window. Specifically, a window is established, the control is embedded in the window, each action of the control is programmed within the window, and the custom control is encapsulated in the form of a window.
[0033] An interface relationship management unit for establishing the relationship between the control window and the main interface. Specifically, the SetParent function is used to establish a master-slave relationship between the main interface window and the control window.
[0034] A window position management unit for moving and recording the position of the control window. Among them, recording the position of the control window specifically means: using the GetWindowRect function to record the coordinate position of the control window; when opening a page, the MoveWindow function can be used to place the control window at the saved control coordinates.
[0035] A parameter adjustment unit for modifying the control size and other attributes. Among them, modifying the control size specifically means: obtaining the left mouse button click event; setting the control window attribute to be resizable and showing the window edge; dragging the window border with the mouse to modify the size of the control; using the GetWindowRect function to record and save the size of the control window. The other attributes include the control label name, control color, data binding relationship, and control status meaning.
[0036] Embodiment 4 As the best embodiment of the present invention, the present invention includes a custom interface generation method during LabVIEW runtime, referring to the attached Figure 1 description, including the following steps: Step S1. Encapsulate the control window in the form of a window. One window corresponds to one control. First, a window is established, the control is embedded in the window, and then each action of the control is programmed within the window. For example, after detecting a mouse press action within the control range, the control color and status are changed, and the custom control is encapsulated in the form of a window. Operating on the control means operating on this window.
[0037] Step S2. Establish the relationship between the control window and the main interface. Relative to the control window, the main interface window is the main window, and the SetParent function in the user32.dll library function (as shown in Table 1 below) is used to establish a master-slave relationship between the two.
[0038] Table 1 Step S3. Move and record the position of the control window. Moving the control position means moving the control window position. After the control window establishes a master-slave relationship with the page window, the control window can be dragged freely within the page window range. The GetWindowRect function in the user32.dll library function (as shown in Table 2 below) can be used to record the coordinate position of the control window.
[0039] Table 2 When opening the page, the MoveWindow function in the user32.dll library function (as shown in Table 3 below) can be used to place the control window at the saved control coordinates.
[0040] Table 3 Step S4. Modify the control size and other properties.
[0041] When the control is encapsulated in window form, modifying the control size means modifying the size of the control window, and at this time, the mouse events will not conflict and occupy the main window memory. The functional logic is as follows: First, obtain the left mouse button click event; secondly, set the control window property to be resizable and display the window edge; then, drag the window border with the mouse to modify the size of the control; finally, use the GetWindowRect function in the user32.dll library function again to record and save the size of the control window.
[0042] Other properties include the control label name, control color, data binding relationship, and control status meaning.
[0043] Furthermore, the order of Step S3 and Step S4 can be interchanged.
[0044] The present invention further includes a terminal, and the terminal includes: One or more processors; A memory for storing one or more programs.
[0045] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating a custom interface during LabVIEW runtime as described in any one of Embodiment 1, Embodiment 2, and this embodiment.
[0046] The present invention further includes a computer-readable storage medium, the storage medium containing computer-executable instructions, and the computer-executable instructions are used to execute the method for generating a custom interface during LabVIEW runtime as described in any one of Embodiment 1, Embodiment 2, and this embodiment when executed by a computer processor.
[0047] In summary, after those of ordinary skill in the art read the present invention document, all other corresponding transformation schemes made without creative mental labor according to the technical solutions and technical concepts of the present invention fall within the scope protected by the present invention.
Claims
1. A method for generating a custom interface during LabVIEW runtime, characterized in that: The following steps are involved: Encapsulate the control window in the form of a window; Establish the relationship between the control window and the main interface; Move and record the position of the control window; Modify the size and other properties of the control.
2. The method for generating a custom interface during LabVIEW runtime according to claim 1, wherein: Encapsulating the control window in the form of a window specifically means: establishing a window, embedding the control in the window, programming each action of the control in the window, and encapsulating the custom control in the form of a window.
3. The method for generating a custom interface during LabVIEW runtime according to claim 1, wherein: Establishing the relationship between the control window and the main interface specifically refers to: establishing a master-slave relationship between the main interface window and the control window.
4. The method for generating a custom interface during LabVIEW runtime according to claim 3, wherein: Use the SetParent function to establish a master-slave relationship between the main interface window and the control window.
5. The method for generating a custom interface during LabVIEW runtime according to claim 1, wherein: Recording the position of the control window specifically means: using the GetWindowRect function to record the coordinate position of the control window; when opening the page, using the MoveWindow function can place the control window on the saved control coordinates.
6. The method for generating a custom interface during LabVIEW runtime according to claim 1, wherein: The other attributes include control label name, control color, data binding relationship and control state meaning.
7. The method for generating a custom interface during LabVIEW runtime according to claim 1, wherein: Modifying the size of a control specifically means: obtaining a left-button click event; setting the control window property to be resizable to display the window edge; using the mouse to drag the window border to modify the size of the control; and using the GetWindowRect function to record and save the size of the control window.
8. A custom interface generation device for LabVIEW runtime, characterized in that: include: The encapsulation unit is used to encapsulate the control window in the form of a window; An interface relationship management unit, used to establish the relationship between the control window and the main interface; A window position management unit, used to move and record the position of the control window; Parameter adjustment unit, used to modify the size and other properties of the control.
9. A terminal, characterized in that: The terminal comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the custom interface generation method during LabVIEW runtime as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The storage medium contains computer executable instructions, which are used to execute the custom interface generation method of LabVIEW runtime as claimed in any one of claims 1 to 7 when executed by a computer processor.
Citation Information
Patent Citations
Configurable interface custom generation method and system
CN111966393A
User panel manager and method for creating user-defined dynamic subwindow
CN1808381A