Hello all,
I've read all the related topics, didn't find one to my question, so here it is
Consider this scenario:
If i declare the $ticket_input as a global variables outside the 2 functions, the variable $ticket_input is visible in the verify_gui() function and it works fine of course
My question: Is there an alternative instead of declaring it as a global variable?
PS: i have to many child windows and variables. And functions (gui and the verification ones) must be separate as the example above
Thanks guys
Update
For the ones who are suggestion using global variables, i'm already using that, i'm looking for an alternative solution
Using a message loop won't work since i'm using
If using global variables is the solution so be it, but i would like to read your opinion
I've read all the related topics, didn't find one to my question, so here it is
Consider this scenario:
;main au3 file Opt("GuiOnEventMode", 1) $main=GUICreate("Test", 200, 200) $ticket_gui_btn = GUICtrlCreateButton("Ticket GUI", 10, 10, 50, 30) GUICtrlSetOnEvent(-1, "ticket_gui") #include <ticket.au3> GUISetState(@SW_SHOW) While 1 Sleep(1000) ;Idle around WEnd func close_func() ;bla bla bla endFunc
;another file: ticket.au3 Func ticket_gui() $child_gui = GUICreate("Test", 200, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "close_func") $ticket_input = GUICtrlCreateInput("", 10, 10, 140, 23) $send = GUICtrlCreateButton("Send", 10, 40 , 90, 25) GUICtrlSetOnEvent(-1, "verify_gui") GUISetState (@SW_SHOW, $child_gui) endFunc Func verify_gui() $ticket_value=GUICtrlRead($ticket_input, 1) if ticket_value="" then msgbox(0, "error", "Ticket is empty") endif endFunc
If i declare the $ticket_input as a global variables outside the 2 functions, the variable $ticket_input is visible in the verify_gui() function and it works fine of course
My question: Is there an alternative instead of declaring it as a global variable?
PS: i have to many child windows and variables. And functions (gui and the verification ones) must be separate as the example above
Thanks guys
Update
For the ones who are suggestion using global variables, i'm already using that, i'm looking for an alternative solution
Using a message loop won't work since i'm using
Opt("GuiOnEventMode", 1)
If using global variables is the solution so be it, but i would like to read your opinion