Control display method, wearable device and computer program product

By creating and displaying only the controls needed on the screen in the user interface, the memory usage problem when the user interface is larger than the physical screen is solved, achieving efficient resource utilization and stable interface display.

CN121785705APending Publication Date: 2026-04-03BEIJING CALORIE INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-31
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

When the user interface is larger than the physical screen, existing technologies create all controls within the user interface before rendering, resulting in excessive memory consumption, system crashes, and limitations on interface size.

Method used

By responding to display commands, the part of the user interface to be displayed on the screen is determined, the control description structure linked list is read, and only the necessary controls are created and displayed on the screen. The creation and display of controls are controlled by the control description structure linked list, avoiding the creation and storage of controls that are not displayed.

Benefits of technology

It reduces memory consumption, improves resource utilization efficiency and user interface scalability, maintains responsiveness and system stability, and avoids system crashes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121785705A_ABST
    Figure CN121785705A_ABST
Patent Text Reader

Abstract

The invention discloses a control display method, wearable equipment and a computer program product. Relates to the technical field of front-end interface display. The method comprises the steps that a display instruction is responded, the display range of a to-be-displayed part of a user interface on a screen is determined, and the size of the user interface is larger than that of the screen; a control description structure linked list of the user interface is read, the control description structure linked list comprises control description structures of a plurality of controls to be displayed, and each control description structure at least comprises the control size, the control position and the control creation function of one control; and based on the control description structure in the control description structure linked list, controlling the creation of the control in the user interface so as to display the to-be-displayed part on the screen. By means of the method and device, the technical problem that in the prior art, under the condition that the user interface is larger than a physical screen, all controls in the user interface are created, then the to-be-displayed control is rendered, and a large amount of memory needs to be occupied is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of front-end interface display technology, and more specifically, to a method for displaying controls, wearable devices, and computer program products. Background Technology

[0002] During interface display, there are situations where the content of a UI (User Interface) exceeds the area of ​​one physical screen. Viewing the entire interface requires navigating the screen. To ensure proper display, related technologies create all controls (basic controls and composite controls) within the interface at predetermined positions and render them based on the current page's coordinates during display.

[0003] However, when the UI itself is large, containing numerous basic and composite controls, and each created basic control requires a corresponding object for storage, it consumes a significant amount of memory. In scenarios with limited memory resources, this can easily exhaust memory, leading to system crashes and other problems, and also restricts the actual size of the interface that can be drawn.

[0004] There is currently no effective solution to the technical problem that requires a large amount of memory to create all the controls within the user interface and then render the controls to be displayed when the user interface is larger than the physical screen. Summary of the Invention

[0005] The main objective of this application is to provide a method for displaying controls, a wearable device, and a computer program product to solve the technical problem in the related art where, when the user interface is larger than the physical screen, creating all the controls within the user interface and then rendering the controls to be displayed requires a large amount of memory.

[0006] To achieve the above objectives, according to one aspect of this application, a method for displaying controls is provided. The method includes: responding to a display instruction; determining the display area of ​​a portion of the user interface to be displayed on the screen, wherein the size of the user interface is larger than the size of the screen; reading a linked list of control description structures of the user interface, wherein the linked list includes control description structures of multiple controls to be displayed, each control description structure including at least one control's size, control position, and control creation function; and controlling the creation of controls in the user interface based on the control description structures in the linked list to display the portion to be displayed on the screen.

[0007] Optionally, controlling the creation of controls in the user interface based on the control description structures in the control description structure linked list to display the part to be displayed on the screen includes: sequentially traversing the control description structures in the control description structure linked list, determining whether the control range of the current control associated with the current control description structure falls within the display range; if the control range of the current control falls within the display range and the current control has not been created, creating the current control based on the current control description structure and displaying the current control within the control range; if the control range of the current control does not fall within the display range and the current control has not been created, skipping the current control description structure; if the control range of the current control does not fall within the display range and the current control has already been created, deleting the current control.

[0008] Optionally, creating the current control based on the current control description structure and displaying the current control within the control range includes: calling the control creation function in the current control description structure to create the current control according to the control size; and displaying the current control on the screen according to the control position in the current control description structure.

[0009] Optionally, determining whether the control range of the current control falls within the display range based on the control description structure associated with the current control node includes: determining that the vertical range of the control range does not fall within the display range if the lower right ordinate of the control range is less than or equal to the upper left ordinate of the display range, or if the upper left ordinate of the control range is greater than or equal to the lower right ordinate of the display range; determining that the horizontal range of the control range does not fall within the display range if the lower right abscissa of the control range is less than or equal to the upper left abscissa of the display range, or if the upper left abscissa of the control range is greater than or equal to the lower right abscissa of the display range; and determining that the control range does not fall within the display range if at least one of the vertical and horizontal ranges does not fall within the display range.

[0010] Optionally, in response to a display instruction, determining the display range of the user interface on the screen includes: in response to a display instruction from the user interface, determining the coordinates of a first key point of the first part of the user interface to be displayed on the screen based on the display instruction, and determining the display range of the first part of the user interface to be displayed based on the coordinates of the first key point and the size of the screen; or in response to an adjustment instruction from the user interface, determining the coordinates of a second key point of the second part of the user interface to be displayed on the screen based on the adjustment instruction, and determining the display range of the second part of the user interface to be displayed based on the coordinates of the second key point and the size of the screen.

[0011] Optionally, before responding to a display instruction and determining the display range of the user interface on the screen, the method further includes: obtaining control description structures of multiple controls to be displayed on the user interface, thus obtaining multiple control description structures; and storing the multiple control description structures in a linked list format, thus obtaining a control description structure linked list.

[0012] Optionally, obtaining the control description structure of multiple controls to be displayed on the user interface includes: obtaining the layout design data of the user interface, extracting the control description structure of multiple controls to be displayed from the layout design data; or pre-creating each control according to the control creation function of multiple controls to be displayed on the user interface to obtain multiple pre-created controls; for each pre-created control, calculating the actual size of the pre-created control and the actual position of the pre-created control in the user interface to obtain the control size and control position, recording the creation function of the pre-created control, determining the control description structure according to the control size, control position and control creation function of the pre-created control, and deleting the pre-created control.

[0013] Optionally, the display area of ​​the part to be displayed is larger than the screen size.

[0014] To achieve the above objectives, according to another aspect of this application, a wearable device is provided. The wearable device includes: a display device, including a screen; and a controller for displaying controls in a user interface on the screen according to a control display method.

[0015] To achieve the above objectives, according to another aspect of this application, a computer program product is provided, including computer instructions that, when executed by a processor, implement steps for displaying a control.

[0016] In this embodiment, by responding to a display command, the display area of ​​the user interface to be displayed on the screen is determined, wherein the size of the user interface is larger than the size of the screen. The control description structure linked list of the user interface is read, wherein the control description structure linked list includes control description structures of multiple controls to be displayed, each control description structure including at least one control's size, position, and creation function. Based on the control description structures in the control description structure linked list, the creation of controls in the user interface is controlled to display the portion to be displayed on the screen. This solves the technical problem in related technologies where, when the user interface is larger than the physical screen, creating all controls within the user interface and then rendering the controls to be displayed requires a large amount of memory. By creating only the controls that need to be displayed on the screen, memory consumption is reduced while maintaining response speed, thereby improving resource utilization efficiency and the scalability of the user interface. Attached Figure Description

[0017] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0018] Figure 1A hardware structure block diagram of a computer terminal for implementing a method of displaying controls is shown.

[0019] Figure 2 This is a flowchart of a control display method according to an embodiment of this application;

[0020] Figure 3 This is a schematic diagram illustrating the user interface range, display range, and screen range according to embodiments of this application;

[0021] Figure 4 This is a schematic diagram of the display area and control area according to an embodiment of this application;

[0022] Figure 5 This is a schematic diagram of a control description structure linked list according to an embodiment of this application;

[0023] Figure 6 This is a schematic diagram of a control display device according to an embodiment of this application;

[0024] Figure 7 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0027] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of related data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding operation entry points are provided for users to choose to authorize or refuse. For example, interfaces are set up between this system and relevant users or organizations, providing users with corresponding operation entry points for them to choose to agree to or refuse automated decision-making results; if the user chooses to refuse, the process proceeds to the expert decision-making stage. If the user chooses to agree, the user can view the purpose of data use in real time through the authorization interface and has the right to withdraw authorization or delete data at any time. After authorization is withdrawn, the system will terminate the relevant data processing within 24 hours.

[0028] Example 1

[0029] According to an embodiment of this application, a method embodiment for displaying a control is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0030] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware structure block diagram of a computer terminal for implementing a method of displaying controls is shown. For example... Figure 1 As shown, computer terminal 10 (or mobile device) may include one or more ( Figure 1 The processor 102 (illustrated as 102a, 102b, ..., 102n) may include, but is not limited to, a microprocessor (MCU) or a field-programmable gate array (FPGA), etc., a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may include: a display, an input / output interface (I / O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0031] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0032] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the control display method in the embodiments of this application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the control display method described above. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0033] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0034] The display can be, for example, a touchscreen liquid crystal display (LCD), which allows the user to interact with the user interface of the computer terminal 10 (or mobile device).

[0035] Under the aforementioned operating environment, this application provides the following: Figure 2 The display method of the control shown. Figure 2This is a flowchart of a control display method according to an embodiment of this application.

[0036] Step S201: In response to the display command, determine the display range of the user interface on the screen, wherein the size of the user interface is larger than the size of the screen.

[0037] Display commands are instructions that trigger the user interface framework to update the screen's displayed content when the user interacts with the screen (such as dragging, scrolling, or pressing buttons) or when the system requires it (such as automatic refresh). For example, when a user scrolls or swipes on a smartwatch, the smartwatch receives this information and issues a display command.

[0038] A user interface (UI) refers to the graphical interface through which an application interacts with a user, while a screen is the physical display screen of a display device. UI elements may be larger than the screen size, thus requiring scrolling or dragging to view the entire interface, such as message lists or activity log lists. Because UI elements may be larger than the screen size, only a portion of the UI is displayed on the screen.

[0039] The portion to be displayed is determined by the user's actions or the current system state. For example, when a user is swiping to view a message list, the portion of the screen corresponding to the current swipe position is the portion to be displayed. The display range of the portion to be displayed is the area of ​​the user interface to be displayed on the screen at the current moment. It can be defined by the coordinates of the top-left and bottom-right corners of the screen, or by the coordinates of the screen center and the displayable width and height.

[0040] Through this step, when the user interacts with the device or the system automatically triggers a display command, the user interface framework recognizes the display command and determines which part of the user interface should be displayed on the screen, as well as the display range. This allows it to know which controls are in the visible area, providing a basis for the on-demand generation of these controls and reducing unnecessary memory usage.

[0041] Step S202: Read the control description structure linked list of the user interface. The control description structure linked list includes control description structures of multiple controls to be displayed. Each control description structure includes at least the control size, control position, and control creation function of a control.

[0042] User interface controls can be categorized into basic controls and composite controls. Basic controls are the fundamental elements displayed on the screen, such as a button, a piece of text, a card, an image, a dividing line, or a child window. Composite controls are larger, more complex controls formed by nesting basic controls according to certain arrangement rules, such as a button with an image or text, or a small card with a lot of information.

[0043] Considering that storing the object structure of the control itself requires a large amount of memory, each node in the control description structure linked list in this embodiment is not the object structure of the created control, but a control description structure (widget_desc). The spatial data of the control description structure includes the control size, the control position (position in the user interface), and the control creation function, which describes how the control is generated on the user interface.

[0044] This step involves reading the linked list of control description structures in the user interface, examining each control description structure in the list, determining whether the control is within the current display area, and then deciding whether to call the control creation function to create the control.

[0045] Step S203: Based on the control description structure in the control description structure linked list, control the creation of controls in the user interface to display the part to be displayed on the screen.

[0046] The creation of controls in the user interface is controlled by the control creation function in the control description structure linked list. The control creation function is a function pointer stored in each control description structure, which is used to generate the actual control object when needed. This allows controls to be dynamically generated according to the current display requirements, rather than pre-creating all controls.

[0047] For example, if the control to be displayed is within the display area, the control creation function in the control description structure is called to generate the actual control object and place it at the position recorded in the control description structure for display on the screen. If the control to be displayed is not within the display area, the control creation function is not called, thus avoiding wasted memory.

[0048] The control display method provided in this application determines the display range of the user interface on the screen in response to a display command, wherein the size of the user interface is larger than the screen size; reads a linked list of control description structures of the user interface, wherein the linked list includes control description structures of multiple controls to be displayed, each control description structure including at least one control's size, control position, and control creation function; and controls the creation of controls in the user interface based on the control description structures in the linked list to display the portion to be displayed on the screen. This solves the technical problem in related technologies where, when the user interface is larger than the physical screen, creating all controls within the user interface and then rendering the controls to be displayed requires a large amount of memory. By creating only the controls that need to be displayed on the screen, memory consumption is reduced while maintaining response speed, thereby improving resource utilization efficiency and the scalability of the user interface.

[0049] To maintain system stability and improve resource utilization efficiency, optionally, in the control display method provided in this application embodiment, controlling the creation of controls in the user interface based on the control description structure in the control description structure linked list to display the part to be displayed on the screen includes: sequentially traversing the control description structures in the control description structure linked list, and determining whether the control range of the current control associated with the traversed current control description structure falls within the display range; if the control range of the current control falls within the display range and the current control has not been created, creating the current control based on the current control description structure and displaying the current control within the control range; if the control range of the current control does not fall within the display range and the current control has not been created, skipping the current control description structure; if the control range of the current control does not fall within the display range and the current control has already been created, deleting the current control.

[0050] It should be noted that creating and storing all user interface controls would result in significant memory usage, and the process of creating controls that are not displayed would also incur additional CPU consumption. Furthermore, since the actual screen size is fixed, this embodiment does not create controls outside the display area. Instead, it dynamically identifies the controls that need to be displayed based on the current display area and creates them accordingly.

[0051] For example, the linked list of control description structures associated with the user interface is traversed. The linked list of control description structures includes multiple control description structures. For each control description structure in the linked list, the control extent of the associated current control can be defined by the top-left corner coordinates (x, y) and bottom-right corner coordinates (x+w, y+h) of the control. The display extent is defined by the top-left corner coordinates (X, Y) and bottom-right corner coordinates (Xc, Yc) of the portion of the user interface to be displayed.

[0052] If the current control's bounds fall within the display area and the control has not yet been created, the control creation function stored in the control description structure is called to generate the actual control, and the control is placed on the screen according to its position recorded in the linked list (i.e., widget_pos_x, widget_pos_y). If the current control's bounds are not within the display area and the control has not yet been created, the current control description structure is skipped, and the process moves to the next control description structure. If a created control is found during the traversal, but its bounds are not within the display area, this indicates that the control no longer needs to be displayed, and the control is deleted.

[0053] In this embodiment, when the user interface is to be displayed, the linked list or array is traversed according to the display range of the part to be displayed. If a control is within the display range, its creation function is called to actually create it. After creation, it is placed in the position where the control should be. If a control that has already been created is moved out of the display range, it is cleared to reduce memory usage. Since the creation of controls is no longer limited by the total size of the user interface, but only by the current display range, unnecessary memory usage is reduced. Especially when the interface contains a large number of complex combined controls, it not only maintains the smoothness and responsiveness of the user interface, but also enables the display of more and more complex content on devices with limited memory, while reducing the risk of system crashes and enhancing system stability.

[0054] Optionally, in the control display method provided in the embodiments of this application, creating the current control based on the current control description structure and displaying the current control within the control range includes: calling the control creation function in the current control description structure to create the current control according to the control size; and displaying the current control on the screen according to the control position in the current control description structure.

[0055] For example, when the control's area falls within the display area and the control has not yet been created, the control creation function in the control's control description structure is called. The control creation function creates the actual control based on the control size information in the control description structure. The control is then placed at the appropriate position according to the control position information (such as widget_pos_x, widget_pos_y) recorded in the control description structure and rendered, ensuring the control is accurately displayed within the display area.

[0056] In this embodiment, the creation and display of controls are based on the screen display range, realizing the on-demand generation of controls and avoiding the memory waste caused by pre-creating all controls. This allows the user interface to adapt more flexibly to different screen sizes and user interactions.

[0057] Optionally, in the control display method provided in this application embodiment, determining the display range of the user interface to be displayed on the screen in response to a display instruction includes: in response to a display instruction from the user interface, determining the coordinates of a first key point of the first part of the user interface to be displayed on the screen based on the display instruction, and determining the display range of the first part of the user interface to be displayed based on the coordinates of the first key point and the size of the screen; or in response to an adjustment instruction from the user interface, determining the coordinates of a second key point of the second part of the user interface to be displayed on the screen based on the adjustment instruction, and determining the display range of the second part of the user interface to be displayed based on the coordinates of the second key point and the size of the screen.

[0058] For example, when a user first opens the user interface or the system initializes the user interface, the user interface framework receives a display instruction from the front end. The user interface framework responds to the display instruction to determine the coordinates of the first key point of the first part of the user interface to be displayed on the screen. The coordinates of the first key point are the starting coordinates of the display range, which can be the coordinates of the upper left corner of the display range (X1, Y1). Then, based on the screen size, the display range of the entire part to be displayed is calculated. The display range is represented by the upper left corner coordinates (X1, Y1) and the lower right corner coordinates (X1+W, Y1+H), where W is greater than or equal to the width of the screen and H is greater than or equal to the height of the screen.

[0059] For example, after a user scrolls, drags, or otherwise adjusts the interface, the user interface framework receives an adjustment instruction, which instructs the content on the user interface to shift. In response to the adjustment instruction, the user interface framework recalculates the starting coordinates of the screen display area, which can be the top-left corner coordinates (X2, Y2). Then, based on the screen size, it re-determines the display area to be shown. The updated display area can be represented by the top-left corner coordinates (X2, Y2) and the bottom-right corner coordinates (X2+W, Y2+H), where W is greater than or equal to the screen width and H is greater than or equal to the screen height, ensuring that the screen content is synchronized with the user's actions.

[0060] This embodiment dynamically calculates the display range of the part to be displayed by responding to display commands and adjustment commands. When the user interface size far exceeds the screen, the creation and display of controls are guided according to the display range. The part to be displayed on the user interface is determined and adjusted in real time and accurately. This ensures that the update of the displayed content reflects the latest user interaction actions, makes full use of the screen space, avoids excessive memory consumption, and also ensures fast response and smooth display of the interface content.

[0061] To improve the smoothness of dragging, optionally, in the control display method provided in this application embodiment, the display area of ​​the part to be displayed is larger than the screen size.

[0062] In this embodiment, the display range is defined as the total range of the current visible area of ​​the screen plus the extended area. The extended area forms a preloaded area, the purpose of which is to prepare controls that are about to enter the visible area of ​​the screen in advance when the user interface is scrolled or dragged, so as to ensure the continuity and smoothness of the content display.

[0063] For example, Figure 3 This is a schematic diagram illustrating the user interface range, display range, and screen range according to embodiments of this application, such as... Figure 3As shown, area A is the user interface, area B is the display area, and area C is the screen. The display area can be larger than the screen, for example, half the height of the physical screen vertically and half the width of the physical screen horizontally. When the user performs a fast scrolling or dragging operation, the corresponding controls are pre-created in the pre-loaded areas in front, behind, left, and right of the current screen to avoid delays or stuttering caused by creating controls in real time during dragging.

[0064] This embodiment expands the display range to the vertical and horizontal directions of the currently visible area of ​​the screen, thereby smoothly transitioning the displayed content when the user performs scrolling or dragging operations. This avoids excessive unnecessary memory consumption and visual stuttering caused by control creation delays.

[0065] Optionally, in the control display method provided in this application embodiment, determining whether the control range of the current control falls within the display range based on the control description structure associated with the current control node includes: determining that the vertical range of the control range does not fall within the display range if the lower right ordinate of the control range is less than or equal to the upper left ordinate of the display range, or if the upper left ordinate of the control range is greater than or equal to the lower right ordinate of the display range; determining that the horizontal range of the control range does not fall within the display range if the lower right abscissa of the control range is less than or equal to the upper left abscissa of the display range, or if the upper left abscissa of the control range is greater than or equal to the lower right abscissa of the display range; and determining that the control range does not fall within the display range if at least one of the vertical and horizontal ranges does not fall within the display range.

[0066] For example, Figure 4 This is a schematic diagram of the display area and control area according to an embodiment of this application, such as... Figure 4 As shown, based on the coordinates (X, Y) and size (W, H) of the display area, two diagonal coordinates (X, Y) (X+W, Y+H) are obtained. The `widget_desc` linked list is traversed to determine the coordinates (x, y) and size (w, h) of each control. Based on the control's coordinates and size, the two diagonal coordinates (x+w, y+h) of the control's area are obtained. The display area is denoted as: top-left coordinates (X, Y) and bottom-right coordinates (Xc, Yc). The actual coordinates occupied by the control are top-left (x, y) and bottom-right (xo, yo).

[0067] If yo <= Y or y >= Yc, the vertical range of the control is outside the display range. If Xo >= X or x >= Xc, the horizontal range of the control is outside the display range. If both (yo <= Y or y >= Yc) and (Xo >= X or x >= Xc) are true, neither the horizontal nor the vertical range of the control is outside the display range. If at least one of the vertical or horizontal range is outside the display range, the control is determined to be outside the display range.

[0068] This implementation determines in real time and accurately which controls need to be created and displayed, and which controls can be ignored or deleted, by judging whether the control range falls within the display range during user interface scrolling or dragging. This ensures smooth user interface while significantly reducing memory consumption and improving system performance and stability.

[0069] The control description structure linked list needs to be created in advance. Optionally, in the control display method provided in this application embodiment, before responding to the display instruction and determining the display range of the part of the user interface to be displayed on the screen, the method further includes: obtaining the control description structures of multiple controls to be displayed on the user interface to obtain multiple control description structures; storing the multiple control description structures in the form of a linked list to obtain a control description structure linked list.

[0070] It should be noted that the user interface object structure describes information about a basic control, such as its position, size, and color. The object structure is as follows:

[0071] typedef struct _lv_obj_t {

[0072] struct _lv_obj_t parent

[0073] lv_ll_t child_ll;

[0074] lv_area_t coords;

[0075] lv_event_cb_t event_cb;

[0076] lv_signal_cb_t signal_cb;

[0077] lv_design_cb_t design_cb;

[0078] void ext_attr; / /

[0079] lv_style_list_t style_list;

[0080] uint8_t ext_click_pad_hor;

[0081] uint8_t ext_click_pad_ver;

[0082] lv_area_t ext_click_pad;

[0083] lv_coord_t ext_draw_pad;

[0084] uint8_t click : 1;

[0085] uint8_t drag : 1;

[0086] uint8_t drag_throw : 1;

[0087] uint8_t drag_parent : 1;

[0088] uint8_t hidden : 1;

[0089] uint8_t top : 1;

[0090] uint8_t parent_event : 1;

[0091] uint8_t adv_hittest : 1;

[0092] uint8_t gesture_parent : 1;

[0093] uint8_t focus_parent : 1;

[0094] lv_drag_dir_t drag_dir : 3;

[0095] lv_bidi_dir_t base_dir : 2;

[0096] void group_p;

[0097] uint8_t protect;

[0098] lv_state_t state;

[0099] lv_realign_t realign;

[0100] lv_obj_user_data_t user_data;

[0101] } lv_obj_t;

[0102] Each object occupies 84 bytes. Storing the object of a basic control requires 84 bytes, and storing the object of a composite control requires even more bytes. To avoid creating all the controls of the user interface and storing their object structures, which would consume a lot of memory, this embodiment uses a smaller memory structure (control description structure) to describe the creation method of composite controls or basic controls, instead of directly creating the controls and storing their object structures. The control description structure is as follows:

[0103] struct widget_desc

[0104] {

[0105] void widget_desc_next; / / 4 bytes, points to the next widget description structure, used to form a linked list.

[0106] void real_widget; / / 4 bytes. The widget will be actually created when the control is to be displayed.

[0107] Int16_t widget_pos_x; / / 2 bytes, the x-coordinate where the control should be placed.

[0108] Int16_t widget_pos_y; / / 2 bytes, the y-coordinate of the widget's placement.

[0109] Int16_t widget_width; / / 2 bytes, the width of the control.

[0110] Int16_t widget_height; / / 2 bytes, the height of the control.

[0111] void widget_create_method; / / Crucial part: The method used to create this widget. Occupies 4 bytes.

[0112] };

[0113] It should be noted that the control description structure is used to describe the creation method of a certain composite control (or basic control). The control description structure mainly includes the control creation method widget_create_method, the position coordinates (x, y) of the control to be placed on the interface, and the size (width, height) of the control itself. Regardless of the complexity of the control, each control description structure occupies 20 bytes.

[0114] Taking a message notification as an example, each notification card (described by a composite control) requires an average of 1370 bytes of memory for its object structure. In a 32-bit system, using a control description structure to describe the information of an uncreated control only requires 5 bytes. 4 bytes = 20 bytes, reducing memory usage by approximately 98.5%. Regardless of control complexity, the size of the control description structure remains constant. The more complex the user interface content and the more complex the combined controls, the more resources can be saved. This allows for increasing the number of controls that can be displayed on an interface, improving the user experience, or significantly reducing memory consumption while maintaining the same amount of content to be displayed.

[0115] For example, before entering the user interface, the control description structure is generated in advance, such as... Figure 5 As shown, the user interface includes N controls, generating N control description structures. Each control description structure includes the x and y coordinates of the control in the user interface, the width w and height h of the control, and the control creation function widget_creat. Each control description structure not only contains the information of the control, but also contains a pointer to connect to the next node. In this way, all control description structures are chained together to form a logical singly linked list, namely the control description structure linked list.

[0116] This embodiment uses a linked list to store the control description structure. Nodes in the control description structure linked list can be added and deleted according to the real-time state of the user interface, thereby flexibly adjusting the content of the control description structure linked list. When a display command is received, the system determines in real time which controls should be created and displayed on the screen, and which controls do not need to be created because they are outside the display range. This saves memory resources, improves the interface rendering speed, and ensures the instant response of user operations and the smoothness of the interface.

[0117] Optionally, in the control display method provided in this application embodiment, obtaining the control description structure of multiple controls to be displayed on the user interface includes: obtaining the layout design data of the user interface, extracting the control description structure of multiple controls to be displayed from the layout design data; or pre-creating each control according to the control creation function of multiple controls to be displayed on the user interface to obtain multiple pre-created controls; for each pre-created control, respectively calculating the actual size of the pre-created control and the actual position of the pre-created control in the user interface to obtain the control size and control position, recording the creation function of the pre-created control, determining the control description structure according to the control size, control position and control creation function of the pre-created control, and deleting the pre-created control.

[0118] For example, the layout design data of the user interface includes the position, size, creation method, nesting relationship and arrangement rules of the controls to be displayed. The actual size, position information, and control creation function of each control can be extracted from the layout design data. Based on this information, a widget_desc can be constructed, avoiding unnecessary pre-creation of controls and thus saving memory and CPU resources. This method of constructing a widget_desc is suitable for scenarios where the size and position of controls can be predicted and determined in advance.

[0119] For example, for controls whose size or position cannot be determined in advance—such as size-dependent or position-dependent controls whose size is affected by child controls or whose position depends on adjacent controls—each control can be pre-created according to its creation function. Then, for each pre-created control, its actual size and actual position in the user interface are calculated. The size, position, and corresponding control creation function are integrated into the `widget_desc`, and the pre-created control is then deleted to reclaim memory. Although controls consume some resources during the pre-creation phase, the accuracy of the control description structure is ensured. This method of creating `widget_desc` is suitable for handling complex and variable user interfaces, such as message lists or motion tracking pages, where the number, size, and position of controls change with the content.

[0120] For controls with clearly defined layout design data, this embodiment extracts information from the data source, eliminating the pre-creation step and further reducing resource consumption. For controls whose size and position require dynamic calculation, the pre-creation process ensures the real-time nature and accuracy of the control description structure, enabling precise and efficient on-demand creation during actual display and avoiding excessive memory consumption.

[0121] This application embodiment also provides an optional method for displaying controls, including:

[0122] First, a widget_desc linked list is generated: When the application needs to display the user interface on the display device's screen, it obtains the size of each control to be displayed on the user interface, the control's position in the user interface, and the control's creation function. The information for each control is saved as a widget_desc node, and multiple widget_desc nodes are stored in a linked list.

[0123] Then, after the user interface is displayed or dragged for the first time, for example, after being dragged, the coordinates (X, Y) of the display area corresponding to the part of the user interface to be displayed and the size (W, H) of the display area can be obtained according to the drag result. Based on the coordinates and size of the display area, two diagonal coordinates (X, Y) (X+W, Y+H) are obtained. The display area is recorded as the upper left coordinate (X, Y) and the lower right coordinate (Xc, Yc).

[0124] Then, traverse the widget_desc linked list to determine the coordinates (x, y) and size (w, h) of each control. Based on the coordinates and size of the control, obtain the coordinates of the two diagonals of the control's range (x+w, y+h). The control range is denoted as top left (x, y) and bottom right (xo, yo).

[0125] Then, determine whether the currently traversed control needs to be displayed: if yo <= Y or y >= Yc, it means the vertical range of the control is not within the display range; if Xo >= X or x >= Xc, it means the horizontal range of the control is not within the display range; if both (yo <= Y or y >= Yc) and (Xo >= X or x >= Xc) are true, it means neither the horizontal nor the vertical range of the control is within the display range. If at least one of the vertical or horizontal range of the control is not within the display range, it is determined that the control does not need to be displayed; if the control's range is within the display range, it is determined that the control needs to be displayed.

[0126] If a control needs to be displayed, the creation function in the associated `widget_desc` is called to generate the control, and it is placed at the positions indicated by `widget_pos_x` and `widget_pos_y` in that `widget_desc`. If the control does not need to be displayed, the creation action is skipped, and the next `widget_desc` is traversed. If a control that is not needed to be displayed is found to have already been created, it means that it was a control that was previously in the display area but has now been moved out of the display area; this control is then deleted to reduce memory consumption.

[0127] This embodiment constructs a linked list of control description structures, traverses the linked list of control description structures, and generates controls as needed. The creation and display of controls are based on the screen display range, avoiding the memory waste caused by pre-creating all controls, so that the user interface can more flexibly adapt to different screen sizes and user interactions.

[0128] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0129] Example 2

[0130] This application also provides a control display device. It should be noted that the control display device of this application can be used to execute the control display method provided in this application. The control display device provided in this application will be described below.

[0131] According to an embodiment of this application, an apparatus for implementing the above-described control display method is also provided. Figure 6 This is a schematic diagram of a display device for a control according to an embodiment of this application, such as... Figure 6 As shown, the device includes:

[0132] The determining unit 601 is used to respond to a display command and determine the display range of the user interface to be displayed on the screen, wherein the size of the user interface is larger than the size of the screen;

[0133] The reading unit 602 is used to read the control description structure linked list of the user interface, wherein the control description structure linked list includes control description structures of multiple controls to be displayed, and each control description structure includes at least the control size, control position and control creation function of a control.

[0134] Control unit 603 is used to control the creation of controls in the user interface based on the control description structure in the control description structure linked list, so as to display the part to be displayed on the screen.

[0135] The control display device provided in this application embodiment, through a determining unit 601, responds to a display command to determine the display range of the user interface to be displayed on the screen, wherein the size of the user interface is larger than the size of the screen; a reading unit 602 reads a control description structure linked list of the user interface, wherein the control description structure linked list includes control description structures of multiple controls to be displayed, each control description structure including at least one control's size, control position, and control creation function; a control unit 603 controls the creation of controls in the user interface based on the control description structures in the control description structure linked list, so as to display the part to be displayed on the screen. This solves the technical problem in related technologies where, when the user interface is larger than the physical screen, creating all controls within the user interface and then rendering the controls to be displayed requires a large amount of memory. By creating only the controls that need to be displayed on the screen, memory consumption is reduced while maintaining response speed, thereby improving resource utilization efficiency and the scalability of the user interface.

[0136] Optionally, in the control display device provided in this application embodiment, the control unit 603 includes: a judgment module, configured to sequentially traverse the control description structures in the control description structure linked list and determine whether the control range of the current control associated with the traversed current control description structure falls within the display range; a creation module, configured to create the current control based on the current control description structure and display the current control within the control range if the control range of the current control falls within the display range and the current control has not been created; a skip module, configured to skip the current control description structure if the control range of the current control does not fall within the display range and the current control has not been created; and a deletion module, configured to delete the current control if the control range of the current control does not fall within the display range and the current control has been created.

[0137] Optionally, in the control display device provided in the embodiments of this application, the creation module includes: a creation submodule, used to call the control creation function in the current control description structure to create the current control according to the control size; and a display submodule, used to display the current control on the screen according to the control position in the current control description structure.

[0138] Optionally, in the control display device provided in the embodiments of this application, the determination module includes: a first determining submodule, used to determine that the vertical range of the control range does not fall within the display range when the lower right ordinate of the control range is less than or equal to the upper left ordinate of the display range, or the upper left ordinate of the control range is greater than or equal to the lower right ordinate of the display range; a second determining submodule, used to determine that the horizontal range of the control range does not fall within the display range when the lower right abscissa of the control range is less than or equal to the upper left abscissa of the display range, or the upper left abscissa of the control range is greater than or equal to the lower right abscissa of the display range; and a third determining submodule, used to determine that the control range does not fall within the display range when at least one of the vertical and horizontal ranges does not fall within the display range.

[0139] Optionally, in the control display device provided in the embodiments of this application, the determining unit 601 includes: a first determining module, configured to respond to a display instruction from the user interface, determine the coordinates of a first key point of a first part of the user interface to be displayed on the screen based on the display instruction, and determine the display range of the first part of the user interface to be displayed based on the coordinates of the first key point and the size of the screen; or a second determining module, configured to respond to an adjustment instruction from the user interface, determine the coordinates of a second key point of a second part of the user interface to be displayed on the screen based on the adjustment instruction, and determine the display range of the second part of the user interface to be displayed based on the coordinates of the second key point and the size of the screen.

[0140] Optionally, in the control display device provided in the embodiments of this application, the device further includes: an acquisition unit, configured to acquire control description structures of multiple controls to be displayed on the user interface before determining the display range of the user interface to be displayed on the screen in response to a display instruction, thereby obtaining multiple control description structures; and a storage unit, configured to store the multiple control description structures in a linked list format, thereby obtaining a control description structure linked list.

[0141] Optionally, in the control display device provided in the embodiments of this application, the acquisition unit includes: a first acquisition module, used to acquire layout design data of the user interface, and extract control description structures of multiple controls to be displayed from the layout design data; or a second acquisition module, used to pre-create each control according to the control creation function of multiple controls to be displayed on the user interface, to obtain multiple pre-created controls; for each pre-created control, to respectively count the actual size of the pre-created control and the actual position of the pre-created control in the user interface, to obtain the control size and control position, to record the creation function of the pre-created control, to determine the control description structure according to the control size, control position and control creation function of the pre-created control, and to delete the pre-created control.

[0142] Optionally, in the display device of the control provided in the embodiments of this application, the display range of the part to be displayed is larger than the size of the screen.

[0143] It should be noted that the above-mentioned units and modules correspond to the steps in Embodiment 1, and the instances and application scenarios implemented by the corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above-mentioned modules or units may be hardware components or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above-mentioned modules may also be part of the device and can run in the computer terminal 10 provided in Embodiment 1.

[0144] Example 3

[0145] Embodiments of this application may provide an electronic device. Figure 7 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 7 As shown, the electronic device may include: one or more ( Figure 7 (Only one is shown) processor 1002, memory 1004, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.

[0146] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0147] The processor can access information and applications stored in memory via a transmission device to execute the steps of the control display method.

[0148] Those skilled in the art will understand that Figure 7 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs (tablet computers), and other terminal devices. Figure 7 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 7 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 7 The different configurations shown.

[0149] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0150] Example 4

[0151] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the control display method provided in Embodiment 1.

[0152] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.

[0153] This application also provides a computer program product, which, when executed on a data processing device, is adapted to perform the steps of a method for displaying a control.

[0154] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0155] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0156] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0157] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0158] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0159] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0160] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for displaying a control, characterized in that, include: In response to a display command, the display area of ​​the user interface to be displayed on the screen is determined, wherein the size of the user interface is larger than the size of the screen; Read the control description structure linked list of the user interface, wherein the control description structure linked list includes control description structures of multiple controls to be displayed, and each control description structure includes at least the control size, control position and control creation function of a control; The creation of controls in the user interface is controlled based on the control description structure in the control description structure linked list, so as to display the part to be displayed on the screen.

2. The method according to claim 1, characterized in that, Controlling the creation of controls in the user interface based on the control description structure in the control description structure linked list, in order to display the part to be displayed on the screen, includes: The control description structures in the control description structure linked list are traversed sequentially, and it is determined whether the control range of the current control associated with the current control description structure falls within the display range. If the control range of the current control falls within the display range and the current control has not been created, the current control is created based on the current control description structure and displayed within the control range; If the control range of the current control does not fall within the display range and the current control has not been created, skip the description structure of the current control. If the current control's range does not fall within the display range, and if the current control has already been created, delete the current control.

3. The method according to claim 2, characterized in that, Creating the current control based on the current control description structure and displaying the current control within the control scope includes: Call the control creation function in the current control description structure to create the current control according to the control size; The current control is displayed on the screen according to its position in the current control description structure.

4. The method according to claim 2, characterized in that, Determining whether the control range of the current control falls within the display range based on the control description structure associated with the current control node includes: If the lower right ordinate of the control range is less than or equal to the upper left ordinate of the display range, or if the upper left ordinate of the control range is greater than or equal to the lower right ordinate of the display range, it is determined that the vertical range of the control range does not fall within the display range. If the lower right horizontal coordinate of the control range is less than or equal to the upper left horizontal coordinate of the display range, or if the upper left horizontal coordinate of the control range is greater than or equal to the lower right horizontal coordinate of the display range, it is determined that the horizontal range of the control range does not fall within the display range. If at least one of the vertical range and the horizontal range does not fall within the display range, it is determined that the control range does not fall within the display range.

5. The method according to claim 1, characterized in that, In response to display commands, determining the display area of ​​the user interface portion on the screen includes: In response to a display command from the user interface, the coordinates of a first key point of the first part of the user interface to be displayed on the screen are determined based on the display command, and the display range of the first part to be displayed is determined according to the first key point coordinates and the size of the screen; or In response to the adjustment command of the user interface, the coordinates of the second key point of the second part of the user interface to be displayed on the screen are determined based on the adjustment command, and the display range of the second part to be displayed is determined according to the coordinates of the second key point and the size of the screen.

6. The method according to claim 1, characterized in that, Before determining the display area of ​​the user interface on the screen to be displayed in response to a display command, the method further includes: Obtain the control description structure of the plurality of controls to be displayed on the user interface, and obtain the plurality of control description structures; The multiple control description structures are stored in a linked list format to obtain the control description structure linked list.

7. The method according to claim 6, characterized in that, The control description structure for obtaining multiple controls to be displayed on the user interface includes: Obtain the layout design data of the user interface, and extract the control description structure of the plurality of controls to be displayed from the layout design data; or Each control is pre-created based on the control creation function of the multiple controls to be displayed on the user interface, resulting in multiple pre-created controls; For each pre-created control, the actual size of the pre-created control and its actual position in the user interface are calculated to obtain the control size and position. The creation function of the pre-created control is recorded. The control description structure is determined based on the control size, control position, and control creation function of the pre-created control, and the pre-created control is deleted.

8. The method according to any one of claims 1 to 7, characterized in that, The display area of ​​the part to be displayed is larger than the size of the screen.

9. A wearable device, characterized in that, include: Display devices, including screens; A controller for displaying controls in a user interface on the screen according to the method of displaying controls according to any one of claims 1 to 8.

10. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the steps of the control display method according to any one of claims 1 to 8.