 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Guest Guest
|
Posted: Mon Mar 14, 2005 5:46 pm Post subject: GUI destroy |
|
|
Here is a snippet of a code that used to work, until recently.
gui, add, edit, vField8, %Field8%
Then it would be Gui sumitt
Copied to Excel.
Then Gui destroy
Then rerun the entire GUI from the top, with the new value for %Field8%
I do not if that was a best way, but it worked.
Latel, however, something has been modified or changed, and freezies/locks my machine? |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Mon Mar 14, 2005 6:34 pm Post subject: |
|
|
Dear Guest,
Could you please post some more code, I doubt that the one line you posted is the problem.
And please use the "code" button to post it. Thank you. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Mon Mar 14, 2005 6:48 pm Post subject: |
|
|
Because your description of your problem was quite generalised I can't give a direct solution. However, some guildelines to consider:
Gui, Destroy
This destroys the gui window and corresponding variables
Gui, x:Destroy (e.g. 2:Destroy)
This destroys the x'th gui window, so if you had five gui windows and you want to close the third one you would use Gui, 3:Destroy
Reload
This could be called a novice way to go about it but it is extremely easy to use a reload command to start the gui you wanted from start again. _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
Tuest Guest
|
Posted: Mon Mar 14, 2005 6:57 pm Post subject: GUI destrpy |
|
|
Thank you for your replies.
It appears to Gui, destroy has stopped working, as the fol e.g.
; Example: Simple input-box:
START:
Gui, Add, Text,, First name:
Gui, Add, Text,, Last name:
Gui, Add, Edit, vFirstName ym ; The ym option starts a new column of controls.
Gui, Add, Edit, vLastName
Gui, Add, Button, default, OK ; The label ButtonOK (if it exists) will be run when the button is pressed.
Gui, Show,, Simple Input Example
return ; End of auto-execute section. The script is idle until the user does something.
GuiClose:
ButtonOK:
Gui, Submit ; Save the input from the user to each control's associated variable.
MsgBox You entered "%FirstName% %LastName%".
gui, destroy
goto start
ExitApp |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Mon Mar 14, 2005 8:21 pm Post subject: |
|
|
I didn't test, but I think it works fine.
The only problem is that you have a endless loop in your code.
This should work fine | Code: | Gui, Add, Text,, First name:
Gui, Add, Text,, Last name:
Gui, Add, Edit, vFirstName ym ; The ym option starts a new column of controls.
Gui, Add, Edit, vLastName
Gui, Add, Button, default, OK ; The label ButtonOK (if it exists) will be run when the button is pressed.
Gui, Show,, Simple Input Example
return ; End of auto-execute section. The script is idle until the user does something.
ButtonOK:
Gui, Submit ; Save the input from the user to each control's associated variable.
MsgBox You entered "%FirstName% %LastName%".
GuiControl,,FirstName ,
GuiControl,,LastName ,
return
GuiClose:
ExitApp |
_________________ Ciao
toralf  |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2397
|
Posted: Mon Mar 14, 2005 8:23 pm Post subject: |
|
|
The problem seems to be with deleting all windows then trying to recreate one. This seems to work ok:
| Code: | Gui, 2:Add, Text,, hmm
Gui, 2:Hide
Gosub, START
Return
START:
Gui, Add, Text,, First name:
Gui, Add, Text,, Last name:
Gui, Add, Edit, vFirstName ym ; The ym option starts a new column of controls.
Gui, Add, Edit, vLastName
Gui, Add, Button, default, OK ; The label ButtonOK (if it exists) will be run when the button is pressed.
Gui, Show,, Simple Input Example
Return
ButtonOK:
Gui, Submit ; Save the input from the user to each control's associated variable.
MsgBox You entered "%FirstName% %LastName%".
Gui, DESTROY
Gosub, START
Return
GuiClose:
ExitApp |
Removing the second window at the beginning of the script will cause a crash after pressing ok for the MsgBox. |
|
| Back to top |
|
 |
Guest - of the first post Guest
|
Posted: Mon Mar 14, 2005 8:33 pm Post subject: GUI destroy |
|
|
Yes Thank you so much.
Like I mentioned earlier it worked fine, countless times, but only recently stopped working. So something changed somewhere, but now I am back in business and wish to thank all you good people for this. |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2397
|
Posted: Mon Mar 14, 2005 8:44 pm Post subject: |
|
|
| After a bit more testing... the crash only seems to appear if Gui, Destroy is used on the first window created (if the first window created does not have a label) when/if the window is later recreated... |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Mar 15, 2005 1:23 am Post subject: |
|
|
I can't reproduce this problem. Even when the program is compiled in debug mode, there is no complaint while running the script.
Which version of AutoHotkey are you using (there was a bug related to "Gui Destroy" fixed a few months ago).
If you're using a fairly new version, which OS are you using?
Thanks. |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2397
|
Posted: Tue Mar 15, 2005 1:32 am Post subject: |
|
|
AutoHotkey version - 1.0.30.03
O/S version - XP pro SP2 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Mar 15, 2005 1:48 am Post subject: |
|
|
This might be a bug revealed only by SP2's stricter security and buffer checking.
With the use of an extra Pause or MsgBox, can you isolate for me whether it's the "Gui Destroy" line itself or something that comes afterward that causes the crash.
Thanks for your help.
Last edited by Chris on Tue Mar 15, 2005 1:49 am; edited 1 time in total |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2397
|
Posted: Tue Mar 15, 2005 1:49 am Post subject: |
|
|
This crashes for me after I click OK then click Ok for the MsgBox | Code: | Gosub, START
Return
START:
Gui, Add, Text,, AHK Version:
Gui, Add, Edit, vtest, %A_AhkVersion%
Gui, Add, Button,default gGo, OK
Gui, Show,w160, Crash Test
Return
Go:
Gui, Submit
MsgBox, Destroying and recreating Form...
Gui, DESTROY
Gosub, START
Return
GuiClose:
ExitApp |
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Mar 15, 2005 1:53 am Post subject: |
|
|
Yes, but there's doubt about which line causes the crash. Obviously it happens after the MsgBox, but on which line?
By the way, it still doesn't crash on my SP1 system (I'll be applying SP2 soon, so that should help reveal the problem).
Thanks. |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2397
|
Posted: Tue Mar 15, 2005 2:01 am Post subject: |
|
|
This might help pin it down a bit...
| Code: | Gui, Add, Text,, AHK Version:
Gui, Add, Edit, vtest, %A_AhkVersion%
Gui, Add, Button,default gGo, OK
Gui, Show,w160, Crash Test
Return
START:
MsgBox, Got here ok
Gui, Add, Text,, AHK Version:
MsgBox, created control
Gui, Add, Edit, vtest, %A_AhkVersion%
MsgBox, created 2nd control
Gui, Add, Button,default gGo, OK
MsgBox, created 3rd control
Gui, Show,w160, Crash Test
MsgBox, Form showing
Return
Go:
Gui, Submit
Gui, DESTROY
MsgBox, Destroying and recreating Form...
Gosub, START
Return
GuiClose:
ExitApp |
It gets past all the MsgBox lines then crashes at Return
Edit: The Form is recreated and displays ok with the last MsgBox showing until Ok is pressed in the "Form showing" MsgBox. After pressing Ok the script crashes
Glad to help if I can  |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Mar 15, 2005 5:31 am Post subject: |
|
|
Thanks a lot. Those details helped isolate the problem even though it would never crash on my system.
Although a problem was definitely fixed, I can't be 100% sure it was THIS problem until one or both of you retests it:
http://www.autohotkey.com/download/
Thanks again. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|