AutoHotkey Community

It is currently May 27th, 2012, 1:53 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Tabs layout GUI
PostPosted: January 24th, 2010, 2:04 am 
Offline

Joined: August 15th, 2009, 7:20 am
Posts: 308
Hello, is there anyway to get tabs to appear as buttons and be on the left and be horizontal. Hope that makes sense. I got them to appear vertically by amending code from the help file:
Code:
Gui, Add, Tab2,buttons left, TAB ONE|TAB TWO|TAB THREE|TAB FOUR  ; Tab2 vs. Tab requires v1.0.47.05.
Gui, Add, Checkbox, vMyCheckbox, Sample checkbox
Gui, Tab, 2
Gui, Add, Radio, vMyRadio, Sample radio1
Gui, Add, Radio,, Sample radio2
Gui, Tab, 3
Gui, Add, Edit, vMyEdit r5  ; r5 means 5 rows tall.
Gui, Tab, 4
Gui, Add, Text,, Tab Four
Gui, Tab  ; i.e. subsequently-added controls will not belong to the tab control.
Gui, Add, Button, default xm, OK  ; xm puts it at the bottom left corner.
Gui, Show
return

ButtonOK:
GuiClose:
GuiEscape:
Gui, Submit  ; Save each control's contents to its associated variable.
MsgBox You entered:`n%MyCheckbox%`n%MyRadio%`n%MyEdit%
ExitApp


Thanks,

GP


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 24th, 2010, 3:04 am 
??
Code:
Gui, Add, Tab2,buttons w100, TAB ONE|TAB TWO|TAB THREE|TAB FOUR  ; Tab2 vs. Tab requires v1.0.47.05.
Gui, Add, Checkbox, vMyCheckbox, Sample checkbox
Gui, Tab, 2
Gui, Add, Radio, vMyRadio, Sample radio1
Gui, Add, Radio,, Sample radio2
Gui, Tab, 3
Gui, Add, Edit, vMyEdit r5  ; r5 means 5 rows tall.
Gui, Tab, 4
Gui, Add, Text,, Tab Four
Gui, Tab  ; i.e. subsequently-added controls will not belong to the tab control.
Gui, Add, Button, default xm, OK  ; xm puts it at the bottom left corner.
Gui, Show,w300
return

ButtonOK:
GuiClose:
GuiEscape:
Gui, Submit  ; Save each control's contents to its associated variable.
MsgBox You entered:`n%MyCheckbox%`n%MyRadio%`n%MyEdit%
ExitApp


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 24th, 2010, 3:37 am 
Offline

Joined: August 15th, 2009, 7:20 am
Posts: 308
Thanks, that's almost what I want but I'd like the buttons to be on the left of the tab controls rather than above them. This would cut down on wasted space.

GP


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 24th, 2010, 3:42 am 
the below was just an example, u need to play around with the w,h,x,y

example:
Code:
Gui, Add, Checkbox, vMyCheckbox x150 y10, Sample checkbox


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 24th, 2010, 4:22 am 
Offline

Joined: August 15th, 2009, 7:20 am
Posts: 308
I see, I get what you mean, now. One more thing, do you know how to control the gap between each tab button? I'd like to add some space.

Thanks,

GP


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 24th, 2010, 4:53 am 
Gui tab can be useful
but if u want a more customizable Gui layout, its better to start from scratch
example:
Code:
Gui, Add, Button, gtb1 w50, tab 1
Gui, Add, Button, gtb2 w50 y+30, tab 2
Gui, Add, Button, gtb3 w50 y+30, tab 3
Gui, Add, Button, gtb4 w50 y+30, tab 4
;Gui, Tab, 1
Gui, Add, Checkbox, vt11 x150 y10, Sample checkbox

;Gui, Tab, 2
Gui, Add, Radio, vt21 x150 y10, Sample radio1
Gui, Add, Radio,vt22, Sample radio2

;Gui, Tab, 3
Gui, Add, Edit, vt31 r5 x150 y10

;Gui, Tab, 4
Gui, Add, Text,vt41, Tab Four

;Gui, Tab  ; i.e. subsequently-added controls will not belong to the tab control.
Gui, Add, Button, default xm, OK  ; xm puts it at the bottom left corner.

loop 1
GuiControl, show, t1%A_index%
loop 2
GuiControl, hide, t2%A_index%
loop 1
GuiControl, hide, t3%A_index%
loop 1
GuiControl, hide, t4%A_index%

Gui, Show,w300
return

tb1:
loop 1
GuiControl, show, t1%A_index%
loop 2
GuiControl, hide, t2%A_index%
loop 1
GuiControl, hide, t3%A_index%
loop 1
GuiControl, hide, t4%A_index%
return
tb2:
loop 1
GuiControl, hide, t1%A_index%
loop 2
GuiControl, show, t2%A_index%
loop 1
GuiControl, hide, t3%A_index%
loop 1
GuiControl, hide, t4%A_index%
return
tb3:
loop 1
GuiControl, hide, t1%A_index%
loop 2
GuiControl, hide, t2%A_index%
loop 1
GuiControl, show, t3%A_index%
loop 1
GuiControl, hide, t4%A_index%
return
tb4:
loop 1
GuiControl, hide, t1%A_index%
loop 2
GuiControl, hide, t2%A_index%
loop 1
GuiControl, hide, t3%A_index%
loop 1
GuiControl, show, t4%A_index%
return

 


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 24th, 2010, 5:14 am 
Offline

Joined: August 15th, 2009, 7:20 am
Posts: 308
Thanks for taking the time to put the example together. I'll need to study it.

GP


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 24th, 2010, 5:22 am 
button 1 contains control t11
button 2 contains control t21 and t22
button 3 contains control t31
button 4 contains control t41

so what i did is "show/hide" the controls using loop
(so even if u have 100 controls in button1, u can do loop 100, but the control names must be t11, t12, t13, t14...t100)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 24th, 2010, 5:31 am 
better version just thought about using GuiControl Choose option
Code:
Gui, Add, Button, gtb1 w50, tab 1
Gui, Add, Button, gtb2 w50 y+30, tab 2
Gui, Add, Button, gtb3 w50 y+30, tab 3
Gui, Add, Button, gtb4 w50 y+30, tab 4

Gui, Add, Tab2,buttons w100 vTAB_BUTTON x-100, a|b|c|d  ; note that the position is x-100, so it wont show up in the gui
Gui, tab, a
Gui, Add, Checkbox, vMyCheckbox x150 y10, Sample checkbox
Gui, Tab, b
Gui, Add, Radio, vMyRadio x150 y10, Sample radio1
Gui, Add, Radio,, Sample radio2
Gui, Tab, c
Gui, Add, Edit, vMyEdit r5  x150 y10
Gui, Tab, d
Gui, Add, Text,x150 y10, Tab Four
Gui, Tab
Gui, Add, Button, default xm, OK 
Gui, Show,w300
return

tb1:
GuiControl, Choose, TAB_BUTTON, 1
return
tb2:
GuiControl, Choose, TAB_BUTTON, 2
return
tb3:
GuiControl, Choose, TAB_BUTTON, 3
return
tb4:
GuiControl, Choose, TAB_BUTTON, 4
return


Report this post
Top
  
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: Apollo, engunneer, JSLover, sjc1000, Yahoo [Bot] and 19 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