Dictionary Definition Issue

I'm developing an app which requires multiple parameters to be set with button options and textbox values. To avoid many almost identical button.click routines i am using the when any Button.Click functionality. The problem is how to assign the selected option to a variable. Attached is a screenshot of a sample dictionary for three buttons. This holds the text for the button and the available options that each click of the button toggles and weel as the selected value. But I need to asign that to a variable. However, I've not found any way to identify the particular variable (see error). If each variable requires its own assignment there seems little point in having a when any Button.Click routine. Any suggestions??

Instead of a global variable named dicButtonOptions, create a value procedure named ButtonOptions, returning what you currently have in dicButtonOptions.

Everywhere you referred to global variable dicButtonOptions, change that to a value call to ButtonOptions.

Run time procedures are allowed to refer to global variables.

Allowing global variables to refer to other global variables would be way too complex for AI2 to build.

This

image

also needs to be valid (i.e. no red cross) at runtime

Thanks for your response and confirming what I had feared which was there is no way to refer to a variable indirectly. I considered your suggested solution, but instead decided to use a database approach because I can store the database tags in the dictionary. In addition a database (a) stores the status / values between individual uses of the app and (b) provides an easy way to pick up variable values between different screens in a multi-screen app.
In effect using a database approach has dealt with the three aspects of functionality I required namely: controlled data entry, app initialisation / restarts and 'globalising' variables across screens.
I've attached a testbed aia that deals with buttons and textboxes in case anyone is interested. Using when any Button / TextBox . Click is an overkill for only a few data entries, but not when say 15 or 20 variables need to be set.

AnyButtonTest.aia (77.1 KB)

1 Like