AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Order of multiple GUI's

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
JamesVan



Joined: 01 Oct 2007
Posts: 17

PostPosted: Wed Feb 20, 2008 3:43 am    Post subject: Order of multiple GUI's Reply with quote

I've read alot of the posts on using multiple GUI's and I'm still trying to understand the concept of using different GUI's out of order. I have a complex script which currently has 4 GUI's. I want to add a new one that will appear at the beginning of the script if a certain condition is met. I created the new GUI as #5 using code such as Gui, 5:Show.

My problem happens when the condition is met and I use Goto to get to GUI #5, get the input I need, then return to show GUI #1. GUI #1 displays OK, but none of the buttons work. Is this possible to accomplish or do I need to re-number all my GUI's?

Here's the beginning of the code (check for condition):
Code:
IfExist, %ProgramFiles%\Newforma\Fourth Edition\Project Center\ProjectCenter.exe
{
   IfExist, C:\Program Files\DriveMap\DriveMap.exe
   {
   IfExist, %ProgramFiles%\LaunchPad\LaunchPadPrefs.ini
   {
      IniRead, PrefSet, %ProgramFiles%\LaunchPad\LaunchPadPrefs.ini, Settings, MappingProgram
     If PrefSet = 1
        Mapper = Drivemap
      If PrefSet = 2
        Mapper = Newforma
   }
   else
   Goto, MappingPref
   }
   else
      Mapper = Newforma
}


Here's the GUI #5:
Code:
MappingPref:
Gui, 5:Add, Text, x36 y10 w220 h20 , Choose your drive mapping preference:
Gui, 5:Add, Radio, vMapPref Checked x76 y40 w120 h30 , DriveMap
Gui, 5:Add, Radio, x76 y70 w120 h30 , Newforma
Gui, 5:Add, Button, x86 y110 w100 h30 , OK
; Generated using SmartGUI Creator 4.0
IfExist, %ProgramFiles%\LaunchPad\LaunchPadPrefs.ini
{
   IniRead, PrefSet, %ProgramFiles%\LaunchPad\LaunchPadPrefs.ini, Settings, MappingProgram
   GuiControl,, MapPref, %PrefSet%
}
Gui, 5:Show, x131 y91 h159 w293, New GUI Window
pause

5GuiClose:
ExitApp

5ButtonOK:
Gui,5:submit,hide
IfNotExist, %ProgramFiles%\LaunchPad
   FileCreateDir, %ProgramFiles%\LaunchPad
IniWrite, %MapPref%, %ProgramFiles%\LaunchPad\LaunchPadPrefs.ini, Settings, MappingProgram
Gui,5:destroy
Gui, 1:Default
Goto, Step1


Goto, Step1 brings the script back to a point right where we were after the condition checking to launch GUI #1.

Any help is much appreciated!!
Back to top
View user's profile Send private message
Superfraggle



Joined: 02 Nov 2004
Posts: 853
Location: London, UK

PostPosted: Wed Feb 20, 2008 7:14 pm    Post subject: Reply with quote

Goto is probably the wrong way of doing this and the pause is probably not helping things.

I cant see it unpause.

I think if you put a pause,off in the ok subroutine, that may resolve it. Otherwise the better way might be to restructure the code.
_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle
Back to top
View user's profile Send private message MSN Messenger
TheIrishThug



Joined: 19 Mar 2006
Posts: 370

PostPosted: Wed Feb 20, 2008 8:47 pm    Post subject: Reply with quote

I agree with Superfraggle, the pause is probably causing problems. Since you used Goto to get to MappingPref, a return where the pause is should make the script wait for further input. Where as, if you used GoSub, a return would jump back to the line following the GoSub.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group