AutoHotkey Community

It is currently May 27th, 2012, 5:33 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: February 23rd, 2010, 3:32 pm 
Offline

Joined: January 30th, 2006, 2:53 pm
Posts: 51
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


Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 23rd, 2010, 4:19 pm 
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)...


Report this post
Top
  
Reply with quote  
PostPosted: February 23rd, 2010, 8:25 pm 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
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.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 12th, 2010, 11:18 pm 
Offline

Joined: July 9th, 2009, 1:13 am
Posts: 140
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 12th, 2010, 11:23 pm 
Offline

Joined: July 9th, 2009, 1:13 am
Posts: 140
Has this been submitted as a bug report yet?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2010, 5:41 pm 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
It has now: Adding tabs via GuiControl. I was just waiting for someone to confirm it.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 13th, 2010, 11:19 pm 
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?


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: dra, HotkeyStick, rbrtryn, XstatyK and 64 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