Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How to Select a Tab I Created in my Gui


  • Please log in to reply
6 replies to this topic
sugardaddy
  • Members
  • 41 posts
  • Last active: Jan 26 2010 11:23 PM
  • Joined: 05 Aug 2006
I have a Gui I created through AHK. It has a tab control in it.

When I click a button, I want the subroutine to be able to bring a certain tab to the front, thereby making it active.

How can I do that programatically?

Slanter
  • Members
  • 739 posts
  • Last active: Jul 08 2011 05:26 AM
  • Joined: 28 May 2008
By reading The Manual

GuiControl, Choose, ControlID, N: Sets the selection in a ListBox, DropDownList, ComboBox, or Tab control to be the Nth entry. N should be 1 for the first entry, 2 for the second, etc (if N is not an integer, the ChooseString method described below will be used instead). Unlike Control Choose, this sub-command will not trigger any g-label associated with the control unless N is preceded by a pipe character (even then, the g-label is triggered only when the new selection is different than the old one, at least for Tab controls). For example: GuiControl, Choose, MyListBox, |3.

To additionally cause a finishing event to occur (a double-click in the case of ListBox), include two leading pipes instead of one (this is not supported for Tab controls).


Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.

sugardaddy
  • Members
  • 41 posts
  • Last active: Jan 26 2010 11:23 PM
  • Joined: 05 Aug 2006
The manual is where I go first. I spent a lot of time scanning the Tab section, because that's where I thought it would be. I also thought I looked through GuiControl, because I've used that before. I must have missed it. Thanks.

soggos
  • Members
  • 129 posts
  • Last active: Nov 30 2012 10:35 AM
  • Joined: 27 Mar 2008
ok very good with || or another gui delimiter like §§
when you run the gui
Gui, Add, Tab, Tab1§Tab2§§
but how to do if you want to select the tab after a gLabel
cause:
GuiControl , Choose, Tab, §Tab2
;info: i have a Gui, +Delimiter§
don't work's!
How to do for select a Tab when the gui is already exist??

Slanter
  • Members
  • 739 posts
  • Last active: Jul 08 2011 05:26 AM
  • Joined: 28 May 2008
GuiControl , Choose, Tab, §2
:?:
Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.

Serenity
  • Members
  • 1271 posts
  • Last active:
  • Joined: 07 Nov 2004

How to do for select a Tab when the gui is already exist??


If you don't specify a variable for the Tab control then you should use its ClassNN instead:

gui, add, button, gdo
; gui, add, tab, vmytab, tab1|tab2|| ; use variable 
gui, add, tab,, tab1|tab2||
gui show
return

do:
; guicontrol, choose, mytab, 1 ; uses the control's associated variable
guicontrol, choose, systabcontrol321, 1 ; uses the control classNN  
return

"Anything worth doing is worth doing slowly." - Mae West
Posted Image

soggos
  • Members
  • 129 posts
  • Last active: Nov 30 2012 10:35 AM
  • Joined: 27 Mar 2008

GuiControl , Choose, Tab, §2

don't work's for me.
but that is ok:
GuiControl , Choose, systabcontrol321, 2
it's very Good

Merçi :) à VOus!