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 

Tabs layout GUI

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Puzzled Greatly



Joined: 15 Aug 2009
Posts: 274

PostPosted: Sun Jan 24, 2010 1:04 am    Post subject: Tabs layout GUI Reply with quote

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
Back to top
View user's profile Send private message
Guest






PostPosted: Sun Jan 24, 2010 2:04 am    Post subject: Reply with quote

??
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
Back to top
Puzzled Greatly



Joined: 15 Aug 2009
Posts: 274

PostPosted: Sun Jan 24, 2010 2:37 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Guest






PostPosted: Sun Jan 24, 2010 2:42 am    Post subject: Reply with quote

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
Back to top
Puzzled Greatly



Joined: 15 Aug 2009
Posts: 274

PostPosted: Sun Jan 24, 2010 3:22 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Guest






PostPosted: Sun Jan 24, 2010 3:53 am    Post subject: Reply with quote

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

 
Back to top
Puzzled Greatly



Joined: 15 Aug 2009
Posts: 274

PostPosted: Sun Jan 24, 2010 4:14 am    Post subject: Reply with quote

Thanks for taking the time to put the example together. I'll need to study it.

GP
Back to top
View user's profile Send private message
Guest






PostPosted: Sun Jan 24, 2010 4:22 am    Post subject: Reply with quote

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)
Back to top
Guest






PostPosted: Sun Jan 24, 2010 4:31 am    Post subject: Reply with quote

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
Back to top
Display posts from previous:   
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