gui question control loses selection

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Bad husband
Posts: 54
Joined: 21 Oct 2017, 13:38

gui question control loses selection

16 Aug 2018, 19:23

I'm playing with a Calendar script I found on this wonderful site.

The GUI opens up and you have the calendar, I select the date and then select value from the dropdown list but my calendar selection becomes clear and I need to select the date again.

Is there a way that it doesn't lose the first section?

Code: Select all

Gui, Add, MonthCal, vDayPick
Gui, Add, DropDownList, vTimePick, 9:00am|10:00am|1:00pm|2:00pm
Gui, Add, DropDownList, vCourt, 11th|51st|125th|134th
Gui, Add, Button, Default, Submit
Gui, Show
return
 
ButtonSubmit:
Gui, Submit
FormatTime, DayPick, %DayPick%, dddd, MMMM d, yyyy
Send, %DayPick% at %TimePick% in the`r%Court% district court
Gui, Destroy
Return
Thanks for looking
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: gui question control loses selection

22 Aug 2018, 10:39

cant reproduce it, win10 ahk 1.1.30.
1. select date
2. select value from drop down
3. select second value from drop down
4. press submit
text gets sent with the correct previously selected date
User avatar
tidbit
Posts: 1272
Joined: 29 Sep 2013, 17:15
Location: USA

Re: gui question control loses selection

22 Aug 2018, 10:44

maybe he mean when he re-shows the gui. because he's using gui,destroy, he literally destroys the gui. all previous values are lost.

1. create the gui, usually at the top of the script.
2. then, if you want it gone, HIDE it. (gui, hide or gui, cancel). do not destroy it.
3. later on if you want to see it again, call gui,show only. do not re-create all of the gui. simply re-show it when needed.

but the way your code is setup, you do gui,submit. which automatically hides the window. do you don't even need the destroy/hide/cancel line I mentioned above..
rawr. fear me.
*poke*
Is it December 21, 2012 yet?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: OrangeCat and 240 guests