A method and device for displaying a selection box
By updating global variables on the client and assigning values to local variables, processing the display request of the selection box, the linkage problem when the user double-clicks is solved, ensuring the accuracy and consistency of the display of the selection box.
Patent Information
- Application Number
- CN202111333977.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-11
- Publication Date
- 2024-11-12
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When the user double-clicks the trigger button, there is a linkage problem in the display of the selection box, causing the client to obtain the result of the second request first and overwrite the result of the first request, which violates the display rules of the selection box.
By updating the global variable during the first trigger operation and the second trigger operation of the user, and assigning it to the corresponding local variable, sending a request to the server and receiving a return message, determining the display of the selection box based on the local variable and the global variable, avoiding the The result coverage is completed.
It ensures that the display of the selection box complies with the display rules, avoids the occurrence of linkage problems, and ensures that the client displays the correct options for the selection box according to the latest global variable values.
Smart Images

Figure CN114047849B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a method and device for displaying a selection box. Background Art
[0002] When the user is in the client, he can type in the input box to input information, or select information in the selection box. The options in the selection box are not displayed when the user does not make a selection. When the user makes a selection, he needs to click the trigger button to trigger the client to display the corresponding options in the selection box. When the user clicks the trigger button again, the corresponding options in the selection box are withdrawn.
[0003] When the user double-clicks the trigger button, the selection box should not display its corresponding options. However, when the user clicks for the first time, the client needs to request data from the server. After receiving the request, the server returns the option data corresponding to the selection box. When the user clicks for the second time, the request sent by the client to the server is empty, and the request returned by the server to the client is also empty. In this way, the time it takes to obtain the result of the first request is longer than the time it takes to obtain the result of the second request. This may cause the client to obtain the result corresponding to the second request first, without displaying the option corresponding to the selection box, and then obtain the result corresponding to the first request, and the result corresponding to the second request is overwritten by the result corresponding to the first request. Therefore, when the user double-clicks the trigger button, the client may display the option corresponding to the selection box according to the result corresponding to the first request, which does not comply with the display rules for the options corresponding to the selection box, resulting in a linkage problem. Summary of the invention
[0004] In order to solve the above technical problems, the present application provides a method and device for displaying a selection box, which are used to solve the linkage problem of the display of the selection box.
[0005] In order to achieve the above purpose, the technical solutions provided by the embodiments of the present application are as follows:
[0006] The present application provides a method for displaying a selection box, including:
[0007] In response to a first trigger operation by a user, updating a value of the global variable, and assigning the updated value of the global variable to the first local variable;
[0008] Sending a first request message to a server, and receiving a first return message sent by the server, wherein the first return message corresponds to the first local variable;
[0009] In response to a second trigger operation by the user, updating the value of the global variable, and assigning the updated value of the global variable to the second local variable;
[0010] Sending a second request message to the server, and receiving a second return message sent by the server, wherein the second return message corresponds to the second local variable;
[0011] According to the first local variable, the second local variable and the global variable, a selection box is displayed according to the first return message or the second return message.
[0012] As a possible implementation manner, displaying the selection box according to the first local variable, the second local variable, and the global variable includes:
[0013] When the value of the first local variable is equal to the value of the global variable, displaying the selection box according to the first return message;
[0014] When the value of the second local variable is equal to the value of the global variable, the selection box is displayed according to the second return message.
[0015] As a possible implementation, when the first trigger operation occurs before the second trigger operation, the value of the second local variable is equal to the value of the global variable.
[0016] As a possible implementation, when the first trigger operation is after the second trigger operation, the value of the first local variable is equal to the value of the global variable.
[0017] As a possible implementation manner, after displaying the selection box, the method further includes:
[0018] The first local variable and the second local variable are deleted.
[0019] According to the method for displaying a selection box provided in the above embodiment, an embodiment of the present application further provides a device for displaying a selection box, including:
[0020] A first assignment module, configured to update the value of the global variable in response to a first trigger operation of the user, and assign the updated value of the global variable to the first local variable;
[0021] A first request module, used for sending a first request message to a server, and receiving a first return message sent by the server, wherein the first return message corresponds to the first local variable;
[0022] A second assignment module, configured to update the value of the global variable in response to a second trigger operation of the user, and assign the updated value of the global variable to the second local variable;
[0023] A second request module, used for sending a second request message to the server and receiving a second return message sent by the server, wherein the second return message corresponds to the second local variable;
[0024] A display module is used to select, according to the first local variable, the second local variable and the global variable, to display a selection box according to the first return message or the second return message.
[0025] As a possible implementation manner, the display module is specifically used for:
[0026] When the value of the first local variable is equal to the value of the global variable, displaying the selection box according to the first return message;
[0027] When the value of the second local variable is equal to the value of the global variable, the selection box is displayed according to the second return message.
[0028] As a possible implementation, when the first trigger operation occurs before the second trigger operation, the value of the second local variable is equal to the value of the global variable.
[0029] As a possible implementation, when the first trigger operation is after the second trigger operation, the value of the first local variable is equal to the value of the global variable.
[0030] As a possible implementation manner, after displaying the selection box, the device further includes:
[0031] A deleting module is used to delete the first local variable and the second local variable.
[0032] Through the above technical solution, it can be seen that the present application has the following beneficial effects:
[0033] An embodiment of the present application provides a method and device for displaying a selection box, the method comprising: in response to a first trigger operation of a user, updating the value of a global variable, and assigning the updated value of the global variable to a first local variable; sending a first request message to a server, and receiving a first return message sent by the server, the first return message corresponding to the first local variable; in response to a second trigger operation of the user, updating the value of the global variable, and assigning the updated value of the global variable to a second local variable; sending a second request message to the server, and receiving a second return message sent by the server, the second return message corresponding to the second local variable; and according to the first local variable, the second local variable and the global variable, selecting to display the selection box according to the first return message or the second return message.
[0034] It can be seen that in the display method of the selection box provided in the embodiment of the present application, when the user performs a double-click operation, the client stores the first local variable, the second local variable and the global variable, and receives the first return message and the second return message. Since the value of the global variable at this time is the value of the last global variable update, the client can determine the return message corresponding to the subsequent triggering operation based on the first local variable, the second local variable and the global variable, ensuring that the display of the selection box complies with the display rules and avoiding the occurrence of linkage problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0036] Figure 1 A schematic diagram of a selection box provided in an embodiment of the present application;
[0037] Figure 2 A flowchart of a method for displaying a selection box provided in an embodiment of the present application;
[0038] Figure 3 A schematic diagram of a display device for a selection box provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to help better understand the solution provided by the embodiments of the present application, before introducing the method provided by the embodiments of the present application, the application scenario of the solution of the embodiments of the present application is first introduced.
[0040] When the user is browsing the client, he can enter information by typing in the input box or by selecting information in the selection box. Figure 1 As shown, the user clicks the trigger button to display the options corresponding to the selection box, namely option 1, option 2, option 3, option 4, etc. The application does not limit the specific number of options. When the user clicks the trigger button again, the option box retracts the options and returns to the original state.
[0041] However, when the user clicks for the first time, the client needs to request data from the server. After receiving the request, the server returns the option data corresponding to the selection box. When the user clicks for the second time, the request sent by the client to the server is empty, and the request returned by the server to the client is also empty. In this way, the time it takes to make the first request and obtain the result is longer than the time it takes to make the second request and obtain the result. This may cause the client to first obtain the result corresponding to the second request, without displaying the option corresponding to the selection box, and then obtain the result corresponding to the first request, and the result corresponding to the second request is overwritten by the result corresponding to the first request. Therefore, when the user double-clicks the trigger button, the client may display the option corresponding to the selection box based on the result corresponding to the first request, which does not comply with the display rules for the option corresponding to the selection box, resulting in a linkage problem.
[0042] In order to solve the above technical problems, an embodiment of the present application provides a method for displaying a selection box. When a user's trigger operation is detected, the value of the global variable is updated, and then the value of the global variable is assigned to the local variable, and a request message is sent to the server, and a corresponding return message is obtained, which can correspond to the local variable. When the user double-clicks, the client stores the first local variable, the second local variable, and the global variable, and receives the first return message and the second return message. In order to determine the order of the trigger operations corresponding to the first return message and the second return message, the client can compare the local variables corresponding to the two with the global variables, so as to determine the return message corresponding to the subsequent trigger operation, thereby ensuring that the display of the selection box complies with the display rules and avoiding the occurrence of linkage problems.
[0043] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0044] See also Figure 2 , which is a flowchart of a method for displaying a selection box provided in an embodiment of the present application.
[0045] like Figure 2 As shown, the method for displaying a selection box provided in an embodiment of the present application includes:
[0046] S101: In response to a first trigger operation of a user, updating the value of a global variable, and assigning the updated value of the global variable to a first local variable.
[0047] S102: Send a first request message to a server, and receive a first return message sent by the server, where the first return message corresponds to a first local variable.
[0048] S103: In response to a second trigger operation of the user, the value of the global variable is updated, and the updated value of the global variable is assigned to the second local variable.
[0049] S104: Send a second request message to the server, and receive a second return message sent by the server, where the second return message corresponds to the second local variable.
[0050] S105: According to the first local variable, the second local variable and the global variable, a selection box is selected to be displayed according to the first return message or the second return message.
[0051] The method for displaying the selection box provided in the embodiment of the present application can be implemented by a client. Specifically, the client in the embodiment of the present application can include: a terminal such as a mobile phone or a computer. In order to better understand the solution provided in the embodiment of the present application, the method for displaying the selection box provided in the embodiment of the present application is described below with the client as the execution subject.
[0052] It should be noted that the embodiment of the present application does not limit the order of the first trigger operation and the second trigger operation. There is no strict order relationship between step S101 and step S103. Step S101 may be before step S103, and step S101 may also be after step S103. When step S101 is before step S103, the global variable is eventually updated to the value of the second local variable. When step S101 is after step S103, the global variable is eventually updated to the value of the first local variable. It can be seen that the client provided by the embodiment of the present application can determine the order of the first trigger operation and the second trigger according to the first local variable, the second local variable and the global variable, so as to avoid the return message corresponding to the request triggered first from covering the return message corresponding to the request triggered later due to the slower return, thereby ensuring that the display of the selection box complies with the display rules and avoiding the occurrence of linkage problems.
[0053] Specifically, displaying a selection box according to the first local variable, the second local variable, and the global variable in the embodiment of the present application may include: when the value of the first local variable is equal to the value of the global variable, displaying the selection box according to the first return message; when the value of the second local variable is equal to the value of the global variable, displaying the selection box according to the second return message. When the value of the first local variable is equal to the value of the global variable, it means that the global variable is first updated to the value of the second local variable, and then updated to the value of the first local variable. The first trigger operation is after the second trigger operation, so the client should display the selection box according to the first return message. Correspondingly, when the value of the second local variable is equal to the value of the global variable, it means that the global variable is first updated to the value of the first local variable, and then updated to the value of the second local variable. The second trigger operation is after the first trigger operation, so the client should display the selection box according to the second return message.
[0054] As an example, when the client detects the first trigger operation, the global parameter is updated to 1, and 1 is assigned to the first local variable m1, and then the first request message is sent; when the client detects the second trigger operation, the global parameter is updated to 2, and 2 is assigned to the second local variable m2, and then the second request message is sent. If the client first receives the second return message corresponding to the second request message, since m2(2) corresponding to the second return message is equal to the global parameter (2), the selection box is displayed according to the second return message. Then the client will receive the first return message corresponding to the first request message. Since m1(1) corresponding to the first request message is not equal to the global parameter (2), this return message is ignored and the previous display result is not overwritten. This ensures that the display of the selection box complies with the display rules and avoids the occurrence of linkage problems.
[0055] In actual applications, the client can also limit the interval between the first trigger operation and the second trigger operation to prevent the return message corresponding to the first triggered request from overwriting the return message corresponding to the later triggered request due to a slow return. The client can also limit the interval between sending the first request and sending the second request to prevent the return message corresponding to the first triggered request from overwriting the return message corresponding to the later triggered request due to a slow return. In order to ensure the user experience, the interval time is usually not set too long. When the network speed between the client and the server is slow, the return message corresponding to the first triggered request may also overwrite the return message corresponding to the later request, so the above method cannot fundamentally solve the linkage problem.
[0056] In an embodiment of the present application, after the first local variable and the second local variable are used by the client, in order to reduce the client's cache, the first local variable and the second local variable can be directly deleted. In actual applications, the user may double-click the trigger button, or the motor trigger button three times in a row. When the user clicks the trigger button three times in a row, the global variable will be updated three times, and the value of the global variable will be equal to the local variable corresponding to the last trigger operation. The method provided in the embodiment of the present application can still determine the return message corresponding to the last trigger operation based on the global variables and the local variables, and display the selection box based on the return message. Similarly, no matter how many times the user connects the trigger button continuously, the display method of the selection box provided in the embodiment of the present application can determine the return message corresponding to the last trigger operation, and display the selection box based on the return message.
[0057] In summary, in the method for displaying a selection box provided by the embodiment of the present application, when the user performs a double-click operation, the client stores the first local variable, the second local variable, and the global variable, and receives the first return message and the second return message. Since the value of the global variable at this time is the value of the last global variable update, the client can determine the return message corresponding to the subsequent triggering operation based on the first local variable, the second local variable, and the global variable, thereby ensuring that the display of the selection box complies with the display rules and avoiding the occurrence of linkage problems.
[0058] According to the display device provided in the above embodiment, an embodiment of the present application further provides a display device for a selection box.
[0059] See also Figure 3 , which is a schematic diagram of a display device for a selection box provided in an embodiment of the present application.
[0060] like Figure 3 As shown, the display device of the selection box provided in the embodiment of the present application includes:
[0061] A first assignment module 100, configured to update the value of the global variable in response to a first trigger operation of the user, and assign the updated value of the global variable to the first local variable;
[0062] A first request module 200 is used to send a first request message to a server and receive a first return message sent by the server, where the first return message corresponds to a first local variable;
[0063] A second assignment module 300, configured to update the value of the global variable in response to a second trigger operation of the user, and assign the updated value of the global variable to the second local variable;
[0064] A second request module 400 is used to send a second request message to the server and receive a second return message sent by the server, where the second return message corresponds to a second local variable;
[0065] The display module 500 is used to select to display a selection box according to the first return message or the second return message according to the first local variable, the second local variable and the global variable.
[0066] As a possible implementation, the display module is specifically used to: when the value of the first local variable is equal to the value of the global variable, display the selection box according to the first return message; when the value of the second local variable is equal to the value of the global variable, display the selection box according to the second return message.
[0067] As a possible implementation, when the first trigger operation is before the second trigger operation, the value of the second local variable is equal to the value of the global variable. Correspondingly, when the first trigger operation is after the second trigger operation, the value of the first local variable is equal to the value of the global variable.
[0068] As a possible implementation, after the selection box is displayed, the device further includes: a deletion module, configured to delete the first local variable and the second local variable.
[0069] In summary, when the user performs a double-click operation, the client stores the first local variable, the second local variable, and the global variable, and receives the first return message and the second return message. Since the value of the global variable at this time is the value of the last global variable update, the display device of the selection box provided in the embodiment of the present application can determine the return message corresponding to the subsequent triggering operation based on the first local variable, the second local variable, and the global variable, thereby ensuring that the display of the selection box complies with the display rules and avoiding the occurrence of linkage problems.
[0070] It can be known from the description of the above implementation mode that those skilled in the art can clearly understand that all or part of the steps in the above-mentioned embodiment method can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., including several instructions for enabling a computer device (which can be a personal computer, a server, or a network communication device such as a media gateway, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0071] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the method disclosed in the embodiment, since it corresponds to the system disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the system part description.
[0072] It should also be noted that, in this article, the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0073] The above description of the disclosed embodiments will enable professionals in the field to implement or use the various modifications of these embodiments to be apparent to professionals in the field, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for displaying a selection box, characterized in that: include: In response to a first trigger operation by a user, updating a value of the global variable, and assigning the updated value of the global variable to the first local variable; Sending a first request message to a server, and receiving a first return message sent by the server, wherein the first return message corresponds to the first local variable; In response to a second trigger operation by the user, updating the value of the global variable, and assigning the updated value of the global variable to the second local variable; Sending a second request message to the server, and receiving a second return message sent by the server, wherein the second return message corresponds to the second local variable; When the value of the first local variable is equal to the value of the global variable, displaying a selection box according to the first return message; When the value of the second local variable is equal to the value of the global variable, the selection box is displayed according to the second return message.
2. The method according to claim 1, characterized in that When the first trigger operation is before the second trigger operation, the value of the second local variable is equal to the value of the global variable.
3. The method according to claim 1, characterized in that When the first trigger operation is after the second trigger operation, the value of the first local variable is equal to the value of the global variable.
4. The method according to claim 1, characterized in that: After displaying the selection box, the method further includes: The first local variable and the second local variable are deleted.
5. A display device for a selection box, characterized in that: include: A first assignment module, configured to update the value of the global variable in response to a first trigger operation of the user, and assign the updated value of the global variable to the first local variable; A first request module, used for sending a first request message to a server, and receiving a first return message sent by the server, wherein the first return message corresponds to the first local variable; A second assignment module, configured to update the value of the global variable in response to a second trigger operation of the user, and assign the updated value of the global variable to the second local variable; A second request module, used for sending a second request message to the server, and receiving a second return message sent by the server, wherein the second return message corresponds to the second local variable; The display module is used to display a selection box according to a first return message when the value of the first local variable is equal to the value of the global variable; and to display a selection box according to a second return message when the value of the second local variable is equal to the value of the global variable.
6. The device according to claim 5, characterized in that When the first trigger operation is before the second trigger operation, the value of the second local variable is equal to the value of the global variable.
7. The device according to claim 5, characterized in that When the first trigger operation is after the second trigger operation, the value of the first local variable is equal to the value of the global variable.
8. The device according to claim 5, characterized in that After displaying the selection box, the device further includes: A deleting module is used to delete the first local variable and the second local variable.
