This is a continuation of my previous thread
[Moderator note: Now the same thread.]
Still struggling with passing a value selected in the ListBox back to the Hotkey code, the result variable.
So I have a ButtonClicked event handler, fine, not sure if it is needed at all.
In the Hotkey code I show the popup window, but the code doesnt wait for the user to make a selection, the code continues. I need it to wait for the user to make a selection and click the submit button.
Code: Select all
MyGui := Gui('AlwaysOnTop')
MyGui.AddText(, 'Select your category')
ListBox1 := MyGui.AddListBox('r6', ['Option1', 'Option2', 'Option3'])
MyGui.AddButton('Default w80', 'Submit').OnEvent('Click', ButtonClicked)
ButtonClicked(control, event) {
return ListBox1.Text ; Not shure how to pass it back to the result variable in the Hotkey defined below
}
Ins:: {
; How do I display the popup window and make it wait until a user clicks on Submit button and then assign a value of ListBox1 to the result variable below?
MyGui.Show() ; Displays the popup
; Here the code continues the execution, doesnt wait for user to click the Submit button -> problem, it needs to wait. How?
result := ListBox1.Text;
}