 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Icarus
Joined: 24 Nov 2005 Posts: 507
|
Posted: Tue Sep 16, 2008 7:13 am Post subject: Tab control without the tabs |
|
|
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:
I would like to control the change of tabs from a different control.
Thanks in advance. _________________ Sector-Seven (Music and Utilities)
Last edited by Icarus on Tue Sep 16, 2008 8:26 am; edited 1 time in total |
|
| Back to top |
|
 |
TutorialWhat Guest
|
Posted: Tue Sep 16, 2008 7:25 am Post subject: |
|
|
| What? |
|
| Back to top |
|
 |
Mustang
Joined: 17 May 2007 Posts: 415 Location: England
|
Posted: Tue Sep 16, 2008 8:08 am Post subject: |
|
|
| TutorialWhat wrote: | | What? |
lol, never heard of hotlinking?
Right Click On Image > Copy This Image URL > Paste Into Address Bar > Press Enter |
|
| Back to top |
|
 |
Pawan Kelkar Guest
|
Posted: Tue Sep 16, 2008 9:06 am Post subject: |
|
|
You Can try this. Not exactly as your picture looks, but functionality wise it works just fine.
| Code: |
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 |
|
| Back to top |
|
 |
Icarus
Joined: 24 Nov 2005 Posts: 507
|
Posted: Tue Sep 16, 2008 9:56 am Post subject: |
|
|
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 (Music and Utilities) |
|
| Back to top |
|
 |
Pawan Kelkar Guest
|
Posted: Tue Sep 16, 2008 12:05 pm Post subject: |
|
|
here you go. Tabs with Icons and text. You can remove any of it.
Reference http://www.autohotkey.com/forum/topic6060.html
| Code: |
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 |
|
| Back to top |
|
 |
Icarus
Joined: 24 Nov 2005 Posts: 507
|
Posted: Tue Sep 16, 2008 1:08 pm Post subject: |
|
|
Thanks for the efforts, but not exactly what I meant.
I wanted to remove the tab text placeholder altogether.
Like this:
| Code: |
#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 (Music and Utilities) |
|
| Back to top |
|
 |
Pawan Kelkar Guest
|
Posted: Tue Sep 16, 2008 1:43 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Icarus
Joined: 24 Nov 2005 Posts: 507
|
Posted: Tue Sep 16, 2008 1:54 pm Post subject: |
|
|
| Pawan Kelkar wrote: |
Probably we need a custom Panel control.
Pawan Kelkar |
Yeah. A Gui Container, that can be hidden or shown or moved as one unit.
| Code: |
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 (Music and Utilities) |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6264
|
Posted: Tue Sep 16, 2008 2:45 pm Post subject: |
|
|
| Icarus wrote: | | 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..
| Code: | #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 |
 _________________
 |
|
| Back to top |
|
 |
Pawan Kelkar Guest
|
Posted: Wed Sep 17, 2008 8:26 am Post subject: |
|
|
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
| Code: |
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 |
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Wed Sep 17, 2008 7:02 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|