 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Areilius
Joined: 16 Feb 2006 Posts: 42
|
Posted: Thu Mar 30, 2006 11:14 am Post subject: Tab control in another tab control? |
|
|
This is my first time using the tab control, so sorry if this is a stupid question.
Say I have a tab control with 3 tabs.
Is it possible to have a second tab control as part of one of the tabs in the first set?
All my attempts have resulted in the second tab control being created behind the first tab control, or beside it.
Is this impossible or am I stupid  |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Thu Mar 30, 2006 1:17 pm Post subject: |
|
|
No, I recall having seen that it is a limitation of Gui Tab, but I can't find it back in the manual, so perhaps I saw this in the forum. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Grendel
Joined: 18 Nov 2005 Posts: 25 Location: Germany
|
Posted: Thu Mar 30, 2006 4:28 pm Post subject: |
|
|
hmm, maybe not with GUI,Tab...
but he can do a workaround emulating the main tab with some radiobuttons.
So each radiobutton-selection can produce their own dialog elements (incl. tabs) inside the main dialog dynamically.
I know, this is much harder to code, but it should be possible. _________________ greets Grendel |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Thu Mar 30, 2006 4:49 pm Post subject: |
|
|
Having subtabs may create a confusing GUI...
Perhaps the GUI should be rethinked to something simplier.
Otherwise, as Grendel stated, this can be emulated with other controls, even active Picture controls showing tabs... _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
shimanov
Joined: 25 Sep 2005 Posts: 612
|
Posted: Thu Mar 30, 2006 5:34 pm Post subject: |
|
|
The only known disadvantage of embedding a tab control within another, seems to be a side effect altering the behavior of relative positioning. Otherwise, it is the best method for selectively displaying a set of controls, since it capitalizes on existing AHk mechanisms.
Try this:
| Code: | Gui, +LastFound
hw_gui := WinExist()
Gui, Add, Tab, x5 y5 w200 h200 vTabControl1, Tab 1|Tab 2
hw_gui_tab1 := DllCall( "FindWindowEx", "uint", hw_gui, "uint", 0, "str", "SysTabControl32", "uint", 0 )
Gui, Tab, Tab 1
Gui, Add, Edit, x10 y30 w190 h170
Gui, Tab, Tab 2
Gui, Add, Tab, x5 y25 w190 h170 Hidden vTabControl2, Tab 2.1|Tab 2.2
hw_gui_tab2 := DllCall( "FindWindowEx", "uint", hw_gui, "uint", hw_gui_tab1, "str", "SysTabControl32", "uint", 0 )
DllCall( "SetParent", "uint", hw_gui_tab2, "uint", hw_gui_tab1 )
Gui, Tab, Tab 2.1
Gui, Add, Text, x15 y55, This is Tab 2.1
Gui, Add, Edit, x15 y75 w180 h120
Gui, Tab, Tab 2.2
Gui, Add, Text, x15 y55, This is Tab 2.2
Gui, Add, Button, x15 y75 w50 h20, button
Gui, Show, w210 h210
OnMessage( 0x4E, "WM_NOTIFY" )
return
WM_NOTIFY( p_w, p_l )
{
global hw_gui_tab1
if ( DecodeInteger( "uint4", p_l, 0 ) = hw_gui_tab1
and DecodeInteger( "int4", p_l, 8, false ) = -550-1 ) ; TCN_SELCHANGE
{
GuiControlGet, tab,, TabControl1
if ( tab = "Tab 2" )
GuiControl, Show, TabControl2
else
GuiControl, Hide, TabControl2
}
}
GuiClose:
ExitApp
DecodeInteger( p_type, p_address, p_offset, p_hex=true )
{
old_FormatInteger := A_FormatInteger
ifEqual, p_hex, 1, SetFormat, Integer, hex
else, SetFormat, Integer, dec
StringRight, size, p_type, 1
loop, %size%
value += *( ( p_address+p_offset )+( A_Index-1 ) ) << ( 8*( A_Index-1 ) )
if ( size <= 4 and InStr( p_type, "u" ) != 1 and *( p_address+p_offset+( size-1 ) ) & 0x80 )
value := -( ( ~value+1 ) & ( ( 2**( 8*size ) )-1 ) )
SetFormat, Integer, %old_FormatInteger%
return, value
} |
|
|
| Back to top |
|
 |
Areilius
Joined: 16 Feb 2006 Posts: 42
|
Posted: Fri Mar 31, 2006 6:40 am Post subject: |
|
|
Wow, shimanov's got a working solution, but it will be a while before I understand what the hell 90% of that script does! **looks at DllCall and OnMessage**
But I think you're probably right PhiLho, if I need to go as far as putting in sub tabs then it's time to re-think my layout.
If I do decide i need sub tabs i'll use the button\radio idea.
I just realised you could make "toggle" buttons by adding the "BS_PUSHLIKE" style to a radio... That could be handy.
Anyway thanks again for the help guys  |
|
| Back to top |
|
 |
Thalon
Joined: 12 Jul 2005 Posts: 640
|
Posted: Fri Mar 31, 2006 7:35 am Post subject: |
|
|
This was my solution as I had the problem here
| Code: | Gui, Add, Tab, vTab2 x30 y65, Test3|Test4
Gui, Tab, 1
Gui, Add, Edit, , First on Second Tab-Control
Gui, Tab, 2
Gui, Add, Edit, , Second on Second Tab-Control
Gui, Add, Tab, vTab1 gTab1 x5 y5, Test1|Test2
Gui, Tab, 1
Gui, Add, Edit, , First on First Tab-Control
Gui, Tab, 2
Gui, Add, Edit, , Second on First Tab-Control
Gui, Show
return
Tab1:
Gui, Submit, NoHide
if Tab1 = Test2
GuiControl, Hide, Tab2
else
GuiControl, Show, Tab2
WinSet, Redraw, , A
return | Maybe it is good enough for you and a bit simplier to understand
Thalon _________________ AHK-Icon-Changer
AHK-IRC
deutsches Forum
SacredVault |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Fri Mar 31, 2006 10:51 am Post subject: |
|
|
I tried SetParent too, without success. I though that the tab control managed automatically the swapping of its content, but reading MSDN it seems we have to do the hard job ourselves. Well, actually, AHK does most of this job, relieving the pain... (GuiType::ControlUpdateCurrentTab)
So Thalon's solution works well, once the respective sizes of the tabs are ajusted to make the second looks being inside the first:
Gui, Add, Tab, vTab2 x30 y65 w200 h75, Test3|Test4
Gui, Tab, 1
Gui, Add, Edit, , First on Second Tab-Control
Gui, Tab, 2
Gui, Add, Edit, , Second on Second Tab-Control
Gui, Add, Tab, vTab1 gTab1 x5 y5 w250 h150, Test1|Test2
Gui, Tab, 1, 2
Gui, Add, Edit, , First on First Tab-Control
Gui, Tab, 2, 2
Gui, Add, Edit, , Second on First Tab-Control
I added the , 2 part just to see if it works, it isn't necessary as Gui Tab seems to apply to the latest created tab.
A way to make it needed:
Gui, Add, Tab, vTab2 x30 y65 w200 h75, Test3|Test4
Gui, Add, Tab, vTab1 gTab1 x5 y5 w250 h150, Test1|Test2
Gui, Tab, 1, 1
Gui, Add, Edit, , First on Second Tab-Control
Gui, Tab, 2, 1
Gui, Add, Edit, , Second on Second Tab-Control
Gui, Tab, 1, 2
Gui, Add, Edit, , First on First Tab-Control
Gui, Tab, 2, 2
Gui, Add, Edit, , Second on First Tab-Control
The z-order makes that we must define Tab2 before Tab1, so Tab2 is referred as , 1. It's a bit confusing... I don't recall if we can change the default z-order of GUI controls. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Thalon
Joined: 12 Jul 2005 Posts: 640
|
|
| 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
|