AutoHotkey Community

It is currently May 27th, 2012, 8:28 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: March 30th, 2006, 11:14 am 
Offline

Joined: February 16th, 2006, 8:29 am
Posts: 42
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 :P


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2006, 1:17 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2006, 4:28 pm 
Offline

Joined: November 18th, 2005, 11:18 pm
Posts: 25
Location: Germany
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2006, 4:49 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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...

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2006, 5:34 pm 
Offline

Joined: September 25th, 2005, 4:31 pm
Posts: 610
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
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2006, 6:40 am 
Offline

Joined: February 16th, 2006, 8:29 am
Posts: 42
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** :wink:

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 :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2006, 7:35 am 
Offline

Joined: July 12th, 2005, 1:21 pm
Posts: 633
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2006, 10:51 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2006, 11:05 am 
Offline

Joined: July 12th, 2005, 1:21 pm
Posts: 633
Yes, I didn't spend some time to adjust the size...
But it's only a sample to show the way.

Thalon

_________________
AHK-Icon-Changer
AHK-IRC
deutsches Forum


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, Google Feedfetcher, immunity, sjc1000 and 69 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group