Jump to content


Photo

Adding tabs via GuiControl


  • Please log in to reply
6 replies to this topic

#1 jaco0646

jaco0646
  • Fellows
  • 3163 posts

Posted 13 March 2010 - 04:35 PM

The documentation states that tabs will be appended at the end, while they are in fact appended at the beginning.
tabs = 3
Gui, Add, Tab2, vTab -wrap, 1|2|3
Gui, Add, Button, Default, Add

Gui, Show
return
GuiClose:
 ExitApp

ButtonAdd:
 GuiControl,,Tab,% ++tabs
return
The issue has come up twice recently.
1. Selecting the position of tab added to existing tab control
2. GuiControl is adding Tabs backwards

I suppose it could be fixed by changing either the code or the documentation.

#2 Guests

  • Guests

Posted 13 March 2010 - 10:19 PM

I strongly recommend changing the behavior (if possible) not just changing the docs...

#3 Guests

  • Guests

Posted 14 March 2010 - 08:49 AM

if you change the behaviour it wil break any scripts where ppl have worked around or used it as it is.

if its possible what i suggest is to in next release add an optional parameter at end of guicontrol which when used with tabs would tell it whether you want new tabs added at end or start, with 0 or absent = at the start being the default.

#4 Tyrsius

Tyrsius
  • Members
  • 140 posts

Posted 15 March 2010 - 07:39 PM

I understand the desire not to break existing functionality, but this is a little strange. You are asking that we maintain broken behavior so that workaround fixes will still fix broken code?

#5 Guest Today

Guest Today
  • Guests

Posted 29 February 2012 - 09:51 PM

I understand the desire not to break existing functionality, but this is a little strange. You are asking that we maintain broken behavior so that workaround fixes will still fix broken code?


I recommend fixing this issue with Autohotkey V2 since Autohotkey V2 will be breaking 90 percent of all the scripts anyway.

#6 orbidia

orbidia
  • Members
  • 12 posts

Posted 22 March 2012 - 09:43 AM

It would be nice if this was fixed sooner rather than only with v2. It is a pretty large bug in AutoHotKey_L. I'm trying to use this functionality now and it is annoying.

How long to wait before v2 comes out? No one knows... and also this rather silly bug will just be in this version forever?

#7 jballi

jballi
  • Members
  • 940 posts

Posted 22 March 2012 - 02:37 PM

This appears to be both a bug and working as designed.

As the documentation indicates, new tabs are added to the end. When you run the script from the OP, notice that the "Add" button always remains in the left most tab. It is just an illusion (and a redrawing bug) that the "Add" button is located in any of the other tabs. To prove it, click on any of the other tabs after clicking on the "Add" button. You'll find that the "Add" button is only in the left most tab.

The bug is where the labels are added. New labels are added to the beginning of the control instead of to the end. Since new labels are added to the beginning of the control and new tabs are added to the end of the control, all tabs labels are renamed.

The workaround is to replace all of the tab labels when adding a new tab. For example:

#NoEnv
#SingleInstance Force

tabs:=3
gui Add,Tab2,vTab -wrap,1|2|3

gui Tab,1
gui Add,Button, Default,Add
gui Add,Text,,This is text on Tab 1

gui Tab,2
gui Add,Text,,This is text on Tab 2

gui Tab,3
gui Add,Button,,This is Tab 3

gui Show
return

GUIClose:
ExitApp

ButtonAdd:
tabs++

;-- Rebuild list of tab names
ListOfTabNames:=""
Loop %tabs%
    ListOfTabNames.="|" . A_Index

;-- Add new tab
GUIControl,,Tab,%ListOfTabNames%
gui Tab,%tabs%
gui Add,Text,,This is text on Tab %tabs%
return
Them be my thoughts...