I declared a variable:
Code: Select all
Global fooCode: Select all
fooCode: Select all
Global fooCode: Select all
fooHow does the dialog library connect the variable name in a string to the actual variable?AZJIO wrote: Mon Nov 03, 2025 11:46 am Map?
In compiled languages, the name is not stored. But you can make a connection through "Map".
Just curious: what would the "button ID translation routine" do, exactly?diceman wrote: Mon Nov 03, 2025 12:11 pm...Gotta do this manually then with a "buttonID translation routine".![]()
I can call the procedure with a String (e.g. "#PB_Keyboard_Return") and then get in return the respective buttonID (#PB_Keyboard_Return), and another procedure with a vice versa functionality (pass a variable, and get the corresponding String for display).TI-994A wrote: Mon Nov 03, 2025 12:29 pmJust curious: what would the "button ID translation routine" do, exactly?
Code: Select all
Macro _dq_
"
EndMacro
Macro MyDebug(_value_, _proc_=#PB_Compiler_Procedure, _line_=#PB_Compiler_Line)
Debug "Proc "+_proc_+" / Line "+_line_+": Variable "+_dq_#_value_ = _dq_ + _value_
EndMacro
Global foo = 100
MyDebug(foo)
Procedure MyFunction()
Protected iValue = 1000
MyDebug(iValue)
EndProcedure
MyFunction()
AutoIt3 has the Assing() and Eval() functions, one creates a variable from a string, the other reads a variable from a string. I once needed access to a list of variables, and I created it using these functions before I knew what an array was. You can store a name in a map and access its value. Just create an example, even if it doesn't work, and I'll convert it into an example using a map.jacdelad wrote: Mon Nov 03, 2025 12:23 pm How does the dialog library connect the variable name in a string to the actual variable?
Code: Select all
name$ = "5"
debug nameof(name$)
AddMapElement(Map(), "name$")
Map() = "5"
debug Map()Code: Select all
CompilerIf #PB_Compiler_Debugger
Macro _dq_ : "
EndMacro
Macro MyDebug(_value_, assert=1, _proc_="PROC "+#PB_Compiler_Procedure+" / ", _line_="LINE "+#PB_Compiler_Line+" /")
If assert
Debug _proc_+_line_+" VAR "+_dq_#_value_ = _dq_ + _value_
Else
Debug "LINE "+#PB_Compiler_Line+": "+_dq_#assert#_dq_+" is not true!"
CallDebugger ; "Breakpoint"
EndIf
EndMacro
CompilerElse
Macro MyDebug(a,b=,c=,d=) : EndMacro
CompilerEndIf
Global foo = 101
MyDebug(foo,1,"")
MyDebug(foo, foo>100, "All OK; foo is greater than 100:","")
Procedure MyFunction()
Protected iValue = 1000
MyDebug(iValue)
EndProcedure
MyFunction()