Jump to content

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

Tab control without the tabs


  • Please log in to reply
16 replies to this topic
Icarus
  • Members
  • 851 posts
  • Last active: Jan 02 2012 11:17 AM
  • Joined: 24 Nov 2005
Hello everyone,

Does anyone know of a way to use the tab control without the tabs?
In fact, I just want to do a multi-page GUI, something like you see on some preference dialogs

For example:
Posted Image

I would like to control the change of tabs from a different control.

Thanks in advance.
Sector-Seven - Freeware tools built with AutoHotkey

TutorialWhat
  • Guests
  • Last active:
  • Joined: --
What?

Mustang
  • Members
  • 421 posts
  • Last active: Dec 26 2010 10:08 PM
  • Joined: 17 May 2007

What?

lol, never heard of hotlinking?
Right Click On Image > Copy This Image URL > Paste Into Address Bar > Press Enter

Pawan Kelkar
  • Guests
  • Last active:
  • Joined: --
You Can try this. Not exactly as your picture looks, but functionality wise it works just fine.

TabList = General|Interface|File
Gui, Add, ListBox, x16 y14 w100 h340 gListbox vMyListBox, %TabList%

;All the tabs are added on the same location on the screen.

Gui, Add, Tab, x136 y14 w610 h330 vGeneral, General
Gui, Add, Text, x186 y54 w100 h30 , Inside General Tab
Gui, Add, Edit, x306 y54 w400 h30 , Edit
Gui, Add, Text, x186 y104 w100 h30 , Inside General Tab
Gui, Add, Edit, x306 y104 w400 h30 , Edit

Gui, Add, Tab, x136 y14 w610 h330 vInterface, Interface
Gui, Add, Text, x186 y54 w100 h30 , Inside Interface Tab
Gui, Add, Edit, x316 y54 w320 h30 ,  Inside Interface Tab

Gui, Add, Tab, x136 y14 w610 h330 vFile, File
Gui, Add, Text, x186 y54 w100 h30 , Inside File Tab

GuiControl, Hide, Interface
GuiControl, Hide, File
Gui, Show, x131 y91 h421 w817, New GUI Window
Return

listbox:
Gui, submit, NoHide
Loop, Parse, TabList, |
	{
		If (MyListBox = A_LoopField)
			GuiControl, Show, %A_LoopField%
		else
			GuiControl, Hide, %A_LoopField%
	}
return

GuiClose:
GuiEscape:
ExitApp

:)
Pawan Kelkar

Icarus
  • Members
  • 851 posts
  • Last active: Jan 02 2012 11:17 AM
  • Joined: 24 Nov 2005
Hey thats nice, thanks.

Trying to get rid of the tab name on top - making it blank prevents the controls from being drawn, but I will try to dig deeper.
Sector-Seven - Freeware tools built with AutoHotkey

Pawan Kelkar
  • Guests
  • Last active:
  • Joined: --
here you go. Tabs with Icons and text. You can remove any of it.

Reference http://www.autohotke.../topic6060.html

TabList = General|Interface|File
Gui, Add, ListBox, x16 y14 w100 h340 gListbox vMyListBox, %TabList%

MyImageList := IL_Create()
Loop 3  ; Load the ImageList with a series of icons from the DLL.
   IL_Add(MyImageList, "shell32.dll", A_Index)  ; Omits DLL path so that it works on Windows 9x too.

Gui, Add, Tab, x136 y14 w610 h330 vGeneral,
AddTab(1, "General - Icon And Text","SysTabControl321")

Gui, Add, Text, x186 y54 w100 h30 , Inside General Tab
Gui, Add, Edit, x306 y54 w400 h30 , Edit
Gui, Add, Text, x186 y104 w100 h30 , Inside General Tab
Gui, Add, Edit, x306 y104 w400 h30 , Edit

Gui, Add, Tab, x136 y14 w610 h330 vInterface,
AddTab(0, "Interface - Text Only" , "SysTabControl322")

Gui, Add, Text, x186 y54 w100 h30 , Inside Interface Tab
Gui, Add, Edit, x316 y54 w320 h30 ,  Inside Interface Tab


Gui, Add, Tab, x136 y14 w610 h330 vFile,
AddTab(0, "" , "SysTabControl323")
Gui, Add, Text, x186 y54 w100 h30 , Inside File Tab

GuiControl, Hide, Interface
GuiControl, Hide, File
Gui, Show, x131 y91 h421 w817, New GUI Window
Return

listbox:
Gui, submit, NoHide
Loop, Parse, TabList, |
	{
		If (MyListBox = A_LoopField)
			GuiControl, Show, %A_LoopField%
		else
			GuiControl, Hide, %A_LoopField%
	}
return

GuiClose:
GuiEscape:
ExitApp
  ; Relies on caller having set the last found window for us.
  
AddTab(IconNumber, TabName, TabControl)
{
	global MyImageList
	Gui +LastFound
	SendMessage, 0x1303, 0, MyImageList, %TabControl% 
   VarSetCapacity(TCITEM, 100, 0)
   InsertInteger(3, TCITEM, 0)  ; Mask (3) comes from TCIF_TEXT(1) + TCIF_IMAGE(2).
   InsertInteger(&TabName, TCITEM, 12)  ; pszText
   InsertInteger(IconNumber - 1, TCITEM, 20)  ; iImage: -1 to convert to zero-based.
   SendMessage, 0x1307, 999, &TCITEM, %TabControl%  ; 0x1307 is TCM_INSERTITEM
}

InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4)
{
   Loop %pSize%  ; Copy each byte in the integer into the structure as raw binary data.
      DllCall("RtlFillMemory", "UInt", &pDest + pOffset + A_Index-1, "UInt", 1, "UChar", pInteger >> 8*(A_Index-1) & 0xFF)
}


--
I am no expert
Pawan Kelkar

Icarus
  • Members
  • 851 posts
  • Last active: Jan 02 2012 11:17 AM
  • Joined: 24 Nov 2005
Thanks for the efforts, but not exactly what I meant.
I wanted to remove the tab text placeholder altogether.

Like this:
#SingleInstance Force
Gui Margin,2,2

Gui, Add, Tab2, vTabOne           ; Not Working
;Gui, Add, Tab2, vTabOne,Tab One   ; Working
Gui, Add, Text,, Inside Tab 1
Gui Show

Return

GuiClose:
GuiEscape:
ExitApp

I mean the tab control is just used as a container for all the other controls, so there is no need for the tab's clickable area in such case.

But I guess thats the most that can be done at this point with AHK and without using some fancy DllCalls :)

Thanks again Pawan.
Sector-Seven - Freeware tools built with AutoHotkey

Pawan Kelkar
  • Guests
  • Last active:
  • Joined: --
I got your point earlier. But it seems that tab control cannot be created without the clickable area.
Probably we need a custom Panel control.

Pawan Kelkar

Icarus
  • Members
  • 851 posts
  • Last active: Jan 02 2012 11:17 AM
  • Joined: 24 Nov 2005

Probably we need a custom Panel control.
Pawan Kelkar

Yeah. A Gui Container, that can be hidden or shown or moved as one unit.

Gui Add, Container, w200 h200 vMyContainer
Gui Container, MyContainer 
Gui Add, text,, this text is added to the container
Gui Container
Gui Add, text,, this text is added without a container

Like the Gui, Tab command.
Sector-Seven - Freeware tools built with AutoHotkey

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

Trying to get rid of the tab name on top - making it blank prevents the controls from being drawn, but I will try to dig deeper.


Cheap workaround.. Put the tab name on the right and reduce the width of the GUI..

#SingleInstance Force
Gui Margin,2,2

Border=Border ; for design debugging

MyTabstyle := (TCS_BUTTONS:=0x100) + (TCS_RIGHT:=0x2) + (TCS_VERTICAL:=0x80) 
; Gui, Add, Text, x3 y3 w642 h482 0x1000 ; uncomment this line in second run .. 
Gui, Add, Tab2, x4 y4 w640 h480 vTabOne %MyTabStyle% ,Tab One   ; Working
Gui, Add, Text,, Inside Tab 1
Gui Show

Return

GuiClose:
GuiEscape:
ExitApp

:)
kWo4Lk1.png

Pawan Kelkar
  • Guests
  • Last active:
  • Joined: --
Workaround are many then, Try the groupbox right above the tabs so there will be no tab clickable area displayed.
Then you can give the groupbox a style as it draws only top border or some thing

TabList = General|Interface|File
Gui, Add, ListBox, x16 y14 w100 h340 gListbox vMyListBox, %TabList%

MyImageList := IL_Create()
Loop 3  ; Load the ImageList with a series of icons from the DLL.
   IL_Add(MyImageList, "shell32.dll", A_Index)  ; Omits DLL path so that it works on Windows 9x too.

Gui, Add, GroupBox, x136 y14 w610 h330 vGGroupBox , General
Gui, Add, Tab, x136 y14 w610 h330 vGeneral,
AddTab(1, "General - Icon And Text","SysTabControl321")

Gui, Add, Text, x186 y54 w100 h30 , Inside General Tab
Gui, Add, Edit, x306 y54 w400 h30 , Edit
Gui, Add, Text, x186 y104 w100 h30 , Inside General Tab
Gui, Add, Edit, x306 y104 w400 h30 , Edit

Gui, Add, Tab, x136 y14 w610 h330 vInterface,
AddTab(0, "Interface - Text Only" , "SysTabControl322")

Gui, Add, Text, x186 y54 w100 h30 , Inside Interface Tab
Gui, Add, Edit, x316 y54 w320 h30 ,  Inside Interface Tab


Gui, Add, Tab, x136 y14 w610 h330 vFile,
AddTab(0, "" , "SysTabControl323")
Gui, Add, Text, x186 y54 w100 h30 , Inside File Tab

GuiControl, Hide, Interface
GuiControl, Hide, File
Gui, Show, x131 y91 h421 w817, New GUI Window
Return

listbox:
Gui, submit, NoHide
Loop, Parse, TabList, |
	{
		If (MyListBox = A_LoopField)
		{
			GuiControl, Show, %A_LoopField%
			GuiControl, Text, GGroupBox, %A_LoopField%
		}
		else
		{
			GuiControl, Hide, %A_LoopField%
		}
	}
return

GuiClose:
GuiEscape:
ExitApp
  ; Relies on caller having set the last found window for us.
  
AddTab(IconNumber, TabName, TabControl)
{
	global MyImageList
	Gui +LastFound
	SendMessage, 0x1303, 0, MyImageList, %TabControl% 
   VarSetCapacity(TCITEM, 100, 0)
   InsertInteger(3, TCITEM, 0)  ; Mask (3) comes from TCIF_TEXT(1) + TCIF_IMAGE(2).
   InsertInteger(&TabName, TCITEM, 12)  ; pszText
   InsertInteger(IconNumber - 1, TCITEM, 20)  ; iImage: -1 to convert to zero-based.
   SendMessage, 0x1307, 999, &TCITEM, %TabControl%  ; 0x1307 is TCM_INSERTITEM
}

InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4)
{
   Loop %pSize%  ; Copy each byte in the integer into the structure as raw binary data.
      DllCall("RtlFillMemory", "UInt", &pDest + pOffset + A_Index-1, "UInt", 1, "UChar", pInteger >> 8*(A_Index-1) & 0xFF)
}


--
:-)
Pawan Kelkar

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
You don't need InsertInteger(/ExtractInteger) , you can use NumPut/NumGet now...

HTH
________________________________________________________
New here? Please, before you post...
1. Read the tutorial and try the examples. -> 2. Take a look at the command list to get an idea of what you could do. -> 3. Create your script. Consult the documentation and the FAQ if you get stuck. -> 4. Search the forum if you need help or examples, method 1 (forum), method 2 (site), method 3 (Google). -> 5. Post your code on the forum in the "Ask for Help" section if you still run into problems (but read this first). -> 6. There is more AHK on autohotkey.net and the Wiki and there is an AHK IRC chat.


fragman
  • Members
  • 1591 posts
  • Last active: Nov 12 2012 08:51 PM
  • Joined: 13 Oct 2009
Bump!
AddTab for 64bit AHK_L:

AddTab(IconNumber, TabName, TabControl) {
Gui 1: +LastFound
VarSetCapacity(TCITEM, 92 + A_PtrSize * 2, 0)
NumPut(3, TCITEM ,0) ; Mask (3) comes from TCIF_TEXT(1) + TCIF_IMAGE(2).
StrPut(TabName, &TCITEM + 12) ; pszText
NumPut(IconNumber - 1, TCITEM ,16 + A_PtrSize) ; iImage: -1 to convert to zero-based.
SendMessage, 0x1307, 999, &TCITEM, %TabControl% ; 0x1307 is TCM_INSERTITEM
}

Not that difficult, but I believe as much examples as possible should be converted.

hotkeyd
  • Guests
  • Last active:
  • Joined: --
Hi
Is it possible to remove the listview and replace it with a 'list' of buttons ?

and use variables for the button / tab names instead of hardcoding them ?
The names would be read from an ini..

Thanks

tabber
  • Guests
  • Last active:
  • Joined: --
give the tab control zero width and height, it will act as a container only. Change tabs using guicontrol, Choose.