AutoHotkey Community

It is currently May 27th, 2012, 12:20 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: November 6th, 2008, 11:08 am 
Offline

Joined: November 24th, 2005, 8:16 am
Posts: 851
Can anyone recommend an approach for creating a wizard-style GUI?
A GUI that uses one window but redraws the controls whenever the user is pressing Next?

The two obvious solutions I can see are:
1. Use the GuiControl, Hide command
2. Destroy and recreate the entire GUI

Both of these look inadequate for complex wizards.
Any other thoughts?

_________________
Sector-Seven - Freeware tools built with AutoHotkey


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2008, 8:36 pm 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
Well, here's my brainfart on a wizard-like gui setup:
Gui 1: = the master, it doesn't have any controls but it does have a title bar and it does +OwnDialogues
Gui 2~?: are -Caption +Toolwindow and +Owner1, and they are sized to fit exactly on top of the non-title bar area of Gui1
All of the necessary guis are predefined at the beginning of the script, but they are shown in order, but also allowing for the user to 'go back' and view/change whatever other data they previously entered.

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2008, 8:40 pm 
Offline

Joined: November 24th, 2005, 8:16 am
Posts: 851
:)

sounds like a potential mess.

_________________
Sector-Seven - Freeware tools built with AutoHotkey


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2008, 9:26 pm 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
Icarus wrote:
:)

sounds like a potential mess.

Really ? I though it was a reasonable way to test / debug each 'page' individually before stringing it all together... Anyways, go with whatever floats your boat, and g/l !

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2008, 9:31 pm 
Offline

Joined: November 24th, 2005, 8:16 am
Posts: 851
[VxE] wrote:
Icarus wrote:
:)

sounds like a potential mess.

Really ? I though it was a reasonable way to test / debug each 'page' individually before stringing it all together... Anyways, go with whatever floats your boat, and g/l !

Thanks VxE

I am thinking more along the lines of wrapping Hide/Show functionality inside AddPage() / ShowPage() / HidePage() functions.

I was asking here, since I do not know how it is done in conventional programming languages, and thought maybe there is a known trick to do it.

_________________
Sector-Seven - Freeware tools built with AutoHotkey


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2008, 9:40 pm 
I guess a hidden tab-control would be the easiest way:
Code:
  Gui, Add, Tab, x-4 y-24 w-1 h-1 -Wrap vTabID, 1|2|3

  Gui, Tab, 1
  Gui, Add, Text, , This is Tab one
  Gui, Add, Button, gGotoTab2, Goto Tab 2
 
  Gui, Tab, 2
  Gui, Add, Text, , This is Tab two
  Gui, Add, Button, gGotoTab3, Goto Tab 3
 
  Gui, Tab, 3
  Gui, Add, Text, , This is Tab three
  Gui, Add, Button, gGotoTab1, Goto Tab 1
 
  Gui, Show, w300 h300, Wizard

Return

GotoTab1:
  GuiControl, Choose, TabID, 1
Return

GotoTab2:
  GuiControl, Choose, TabID, 2
Return

GotoTab3:
  GuiControl, Choose, TabID, 3
Return

GuiClose:
  ExitApp


HTH


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2008, 9:50 pm 
Offline

Joined: November 24th, 2005, 8:16 am
Posts: 851
n-l-i-d wrote:
I guess a hidden tab-control would be the easiest way:

Thats a neat trick.
A bit dirty with the way to hide the tab control, but I cannot see an immediate down side to this.

helps indeed.
Thanks.

_________________
Sector-Seven - Freeware tools built with AutoHotkey


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2008, 10:14 pm 
Offline

Joined: November 24th, 2005, 8:16 am
Posts: 851
Created a slightly more generic skeleton for making a wizard gui, if anyone else will be interested in the future:

Code:
Init()
AddPage_Welcome()
AddPage_Installing()
Show()

;--------------------------------------
Return

; Add pages here -----------------------
AddPage_Welcome() {
  Global
  NewTab()
  Gui, Add, Text, x10 y10 , Welcome to this wizard 
}

AddPage_Installing() {
  Global
  NewTab()
  Gui, Add, Text, x10 y10 , I will not install anything today, thanks 
  Gui, Add, Progress, w280, 50
}
; /Add pages here ----------------------



Init() {
  Global
  NextTab := 1
  Gui, Add, Tab, x-4 y-24 w-1 h-1 -Wrap vTabID, 1|2|3|4|5|6|7|8|9|10|11|12
}


NewTab() {
  Global 
  Gui, Tab, %NextTab%
  Gui, Add, Button, x100 y200 w100 gBack, < Back
  Gui, Add, Button, x200 y200 w100 gNext Default, Next >
  NextTab++
}

Show() {
  Global
  LastTab := NextTab-1
  ActiveTab := 1
  Gui, Show, w300 h300, Wizard
}

Next:
  If( ActiveTab < LastTab ) {
    ActiveTab++
    GuiControl, Choose, TabID, %ActiveTab%
  }
Return

Back:
  If( ActiveTab > 1 ) {
    ActiveTab--
    GuiControl, Choose, TabID, %ActiveTab%
  }
Return

GuiEscape:
GuiClose:
  ExitApp
Return



_________________
Sector-Seven - Freeware tools built with AutoHotkey


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2008, 2:01 am 
Offline

Joined: October 31st, 2008, 10:49 am
Posts: 20
that looks sweet :)

thx for sharing!!!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot] and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group