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 

Selecting the position of tab added to existing tab control

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



Joined: 30 Jan 2006
Posts: 51

PostPosted: Tue Feb 23, 2010 2:32 pm    Post subject: Selecting the position of tab added to existing tab control Reply with quote

I am adding a tab to an existing tab control using

Code:
GuiControl,4:,MyTab,Test


But it creates the tab as the leftmost tab
(i.e.
Before adding...
|Tab 1|Tab 2|Tab 3|
After adding...
|Test|Tab 1|Tab 2|Tab 3|
)

I know that you can have Param3 of GuiControl contain all the tab names and have them recreated (i.e. GuiControl,4:,MyTab,|Tab 1|Tab 2|Tab 3|Test)... but I don't want to do this because I have several controls in each tab.

Does anyone know how to select the position of the new tab (or at least have it be the rightmost tab)?

Thanks,
Eddie
Back to top
View user's profile Send private message
Guest






PostPosted: Tue Feb 23, 2010 3:19 pm    Post subject: Re: Selecting the position of tab added to existing tab cont Reply with quote

Not pretty, but works(ish)...

Code:
TabCtrl_List:="Tab 1|Tab 2|Tab 3"
TabCtrl_List_Current:=TabCtrl_List

Gui, Add, Tab, vTab, %TabCtrl_List%
Gui, Tab, Tab 1
   Gui, Add, Text, , Tab 1
Gui, Tab, Tab 2
   Gui, Add, Text, , Tab 2
Gui, Tab, Tab 3
   Gui, Add, Text, , Tab 3
Gui, Tab
Gui, Show, AutoSize Center
return

F9::
nt++
NewTab:="New Tab " nt

TabCtrl_List_Current.="|" NewTab
GuiControl, , Tab, |%TabCtrl_List_Current%

Gui, Tab, %NewTab%
   Gui, Add, Text, , New Tab %nt%
Gui, Tab
return

...Bug: Add too many new Tabs & they wrap & then the initial controls are on top of the Tabs (cuz the initial controls position was calculated with a single line of tabs, before wrapping)...
Back to top
jaco0646



Joined: 07 Oct 2006
Posts: 3113
Location: MN, USA

PostPosted: Tue Feb 23, 2010 7:25 pm    Post subject: Re: Selecting the position of tab added to existing tab cont Reply with quote

ehagood wrote:
... but I don't want to do this because I have several controls in each tab.

AHK Help File wrote:
...a tab's sub-controls stay associated with their original tab number; that is, they are never associated with their tab's actual display-name.

You shouldn't have to worry about the controls. They should stay put.
Code:
Gui, Add, Tab, vTab, 1|2|3
Gui, Add, Button,,Add
Loop,4 {
 Gui, Tab, %A_Index%
 Gui, Add, Text,,Tab #%A_Index%
}
Gui, Show
return
GuiClose:
 ExitApp

ButtonAdd:
 GuiControl,,Tab, |1|2|3|4
return

The behavior of GuiControl looks like a bug to me, since the documentation states that tabs will be appended at the end, while they are in fact appended at the beginning.
Back to top
View user's profile Send private message Visit poster's website
Tyrsius



Joined: 09 Jul 2009
Posts: 140

PostPosted: Fri Mar 12, 2010 10:18 pm    Post subject: Re: Selecting the position of tab added to existing tab cont Reply with quote

Anonymous wrote:
Not pretty, but works(ish)...
...Bug: Add too many new Tabs & they wrap & then the initial controls are on top of the Tabs (cuz the initial controls position was calculated with a single line of tabs, before wrapping)...


This can be fixed by disabling wrap in the tab options.
Back to top
View user's profile Send private message
Tyrsius



Joined: 09 Jul 2009
Posts: 140

PostPosted: Fri Mar 12, 2010 10:23 pm    Post subject: Reply with quote

Has this been submitted as a bug report yet?
Back to top
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 3113
Location: MN, USA

PostPosted: Sat Mar 13, 2010 4:41 pm    Post subject: Reply with quote

It has now: Adding tabs via GuiControl. I was just waiting for someone to confirm it.
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Sat Mar 13, 2010 10:19 pm    Post subject: Re: Selecting the position of tab added to existing tab cont Reply with quote

Tyrsius wrote:
This can be fixed by disabling wrap in the tab options.

...it can be worked-around by doing that, but what if you want it to wrap?
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