Coding Question - Use of variables in Purevision Gadget name
Posted: Tue Apr 04, 2023 9:57 am
I have 84 Button Gadgets on a form. I need to hide / unhide some of them based on a value of a variable in an array.
Here is a snippet of the code I have that works. The button gadget caption is first assigned a text string that resides (or not) in an array.
There are 14 Rows of buttons with each row having 6 columns. some buttons are not assigned with anything and those are the ones to hide with the above code.
I have tried to find a way to use variables for the gadget row and column name so I don't have to duplicate the example 4 lines of code 84 times and use a simple for next loop to scan through the array and hide the buttons that are not assigned with a node name and ip address.
Does anyone have any suggestions as to how I can minimize the lines of code needed to accomplish the task of first setting the button gadget caption and then hiding the buttons that have no caption text?
Any help is appreciated.
Thank you,
Stephen
Here is a snippet of the code I have that works. The button gadget caption is first assigned a text string that resides (or not) in an array.
Code: Select all
SetGadgetText(#Gadget_Launch_VNC_Form1_Button_Row1_Col1, Array$(1,1,1)) ;array row (city), column(node name), IP address
If Len(Array$(1,1,1)) < 3 ;no data in array element = no button assignment
HideGadget(#Gadget_Launch_VNC_Form1_Button_Row1_Col1,1) ;hide button
EndIf
I have tried to find a way to use variables for the gadget row and column name so I don't have to duplicate the example 4 lines of code 84 times and use a simple for next loop to scan through the array and hide the buttons that are not assigned with a node name and ip address.
Does anyone have any suggestions as to how I can minimize the lines of code needed to accomplish the task of first setting the button gadget caption and then hiding the buttons that have no caption text?
Any help is appreciated.
Thank you,
Stephen