Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Can you show/hide a list Box by a BUTTON?

I have a list box that i want to show/hide by a button. How do you do that

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Ok, let me break it down here - i added explanation to the steps from my post above with the hope that it clarifies your doubt

Step 1: click Ctrl+Alt+V to bring up variables list, add a new variable called vHide and assign 0 to the value. - Here we are simply initiating a variable to be used as a flag based on which we will set the visibility of a list box.

Step 2: Create a button, in Properties go to Actions tab and add an "External" Action Type  and select "Set Variable" and hit ok. In the Actions tab of properties, variable is vHide and Value should be =if(vHide=0,1,0). - Here we are toggling the flag using a single button. So if the vHide value is 0, then clicking the button will set it to 1 and if it is equal to 1 (when you click this button, the value changes to 1), then clicking the button again will set it to 0.

Step 3: In the list box properties, go to Layout tab and below Apply Theme button, select Conditional Show and type in vHide. - Typing in vHide as a condition basically is equal to saying if(vHide = 1, true, false). so in other words, we are saying that show the list box if vHide is equal to 1 else hide it.

The textbox in my most recent post is just to verify the value of vHide since you stated that the list box is not showing at all which basically means that the condition is not being met to display it. i hope this helps.

View solution in original post

15 Replies
alexandros17
Partner - Champion III
Partner - Champion III

1) define a variable in the script (LET var = 0;)

2) add a button, in properties, actions -> add -> external -> set variable write in the upper box var and in the lower box write: =if(var=1,0,1)

3) at this point in the condizional display of the list box write var = 1

Let me know

Anonymous
Not applicable
Author

use variables....so something like below:

click Ctrl+Alt+V to bring up variables list, add a new variable called vHide and assign 0 to the value.

Create a button, in Properties go to Actions tab and add an "External" Action Type  and select "Set Variable" and hit ok. In the Actions tab of properties, variable is vHide and Value should be =if(vHide=0,1,0)

In the list box properties, go to Layout tab and below Apply Theme button, select Conditional Show and type in vHide.

You should be all set.

maxgro
MVP
MVP

PFA

Anonymous
Not applicable
Author

Massimo,

I cant open the qvw file. Can you post the script here

Anonymous
Not applicable
Author

the variables and parameters need to be set in a few different places and is not one script that you set in your edit script window. follow the steps in my post above...that is pretty much what needs done.

Anonymous
Not applicable
Author

Jsaradhi, I followed your instructions and now the issue is the list box is hidden at all times. Can we add another button that will show it? so there will be 2 buttons: one to show and another to hide.

Anonymous
Not applicable
Author

you do not need two buttons. the list box is hidden because the condition was not met. so create a text box to display the value of vHide and set the value in the variables dialog box accordingly. do you want to post your qvw here? i can help take a look at it and let you know exactly what needs to be modified.

Anonymous
Not applicable
Author

I am now beginning to understand the concept.   if(vHide=0,1,0)  Here, it means when the value assigned to variable vhide equals 0, the list box will show. if it is assigned some other value than 0, the list box will not show. Correct? Now how does adding a text box complete the process.? Can you please explain here

Anonymous
Not applicable
Author

Ok, let me break it down here - i added explanation to the steps from my post above with the hope that it clarifies your doubt

Step 1: click Ctrl+Alt+V to bring up variables list, add a new variable called vHide and assign 0 to the value. - Here we are simply initiating a variable to be used as a flag based on which we will set the visibility of a list box.

Step 2: Create a button, in Properties go to Actions tab and add an "External" Action Type  and select "Set Variable" and hit ok. In the Actions tab of properties, variable is vHide and Value should be =if(vHide=0,1,0). - Here we are toggling the flag using a single button. So if the vHide value is 0, then clicking the button will set it to 1 and if it is equal to 1 (when you click this button, the value changes to 1), then clicking the button again will set it to 0.

Step 3: In the list box properties, go to Layout tab and below Apply Theme button, select Conditional Show and type in vHide. - Typing in vHide as a condition basically is equal to saying if(vHide = 1, true, false). so in other words, we are saying that show the list box if vHide is equal to 1 else hide it.

The textbox in my most recent post is just to verify the value of vHide since you stated that the list box is not showing at all which basically means that the condition is not being met to display it. i hope this helps.