Variable by name question
Posted: Fri Apr 05, 2019 6:23 pm
Been looking for hours, but cannot find it:
The button is defined with #PB_Any and referenced by variable Button1_0
As i have many buttons, i would like to be able to play around with the names chosen.
Difficult to explain, but how can i use the integer variable name (Button1_0) from a string.
So for example i have a variable usevar.s which has "Button1_0" in it.
Howto convert my string variable to show the content of the containing int variable.
Perhaps with a example to clear it up:
The button is defined with #PB_Any and referenced by variable Button1_0
As i have many buttons, i would like to be able to play around with the names chosen.
Difficult to explain, but how can i use the integer variable name (Button1_0) from a string.
So for example i have a variable usevar.s which has "Button1_0" in it.
Howto convert my string variable to show the content of the containing int variable.
Perhaps with a example to clear it up:
Code: Select all
; I have this button defined:
Button1_0 = ButtonGadget(#PB_Any,130, 50, 30, 25, "", #PB_Button_Left)
; This is working, of course:
SetGadgetText(Button1_0, "E")
; But how do i get this to work?
usevar.s = "Button1_0" ; a string
SetGadgetText(usevar, "E") ; not working of course, because it is expecting that uservar is not a string but integer, howto convert?