Sign in to follow this  
Followers 0
Holger

Child-Windows in Tab-Controls

3 posts in this topic

Here is this small sample (just a little bit modified from my 'old' child sample :( )

#include <GUIConstants.au3>

Global $main_GUI,$ok_button,$cancel_button,$prefs_GUI

; this window has no controls except the 2 ok/cancel-buttons
$main_GUI           = GUICreate("Window Title",260,250,-1,-1,BitOr($GUI_SS_DEFAULT_GUI,$WS_CLIPSIBLINGS))
$ok_button          = GUICtrlCreateButton("OK",40,220,70,20)
$cancel_button      = GUICtrlCreateButton("Cancel",150,220,70,20)


GUISetState()

; creates the about child window that is implemented into the main GUI
$about_GUI          = GUICreate("",220,160,20,40,$WS_CHILD,-1,$main_GUI)
GUISetBkColor(0xA0A0B0); just for dimensing the child
$about_label        = GUICtrlCreateLabel("Only a Parent/Child Window Demo by Holger Kotsch",10,30,180,40)
$input              = GUICtrlCreateInput(">>Put your name here<<",10,100,200,20,$ES_CENTER)

GUISetState()

; creates the prefs child window that is implemented into the main GUI
$prefs_GUI  = GUICreate("",220,160,20,40,$WS_CHILD,-1,$main_GUI)
GUISetBkColor(0x257788); just for dimensing the child
$prefs_treeview     = GUICtrlCreateTreeView(10,10,200,80,BitOr($TVS_HASBUTTONS,$TVS_DISABLEDRAGDROP,$TVS_CHECKBOXES),$WS_EX_CLIENTEDGE)
$prefs_symbols      = GUICtrlCreateTreeViewItem("Show Symbols",$prefs_treeview)
$prefs_backup_item  = GUICtrlCreateTreeViewItem("Enable Backup",$prefs_treeview)
$prefs_toggle_item  = GUICtrlCreateTreeViewItem("Show ToggleButton",$prefs_treeview)

$prefs_button1      = GUICtrlCreateCheckbox("Check1",10,100,70,20,$BS_PUSHLIKE)
$prefs_button2      = GUICtrlCreateCheckbox("Check2",90,100,70,20,$BS_PUSHLIKE)
$prefs_button3      = GUICtrlCreateCheckbox("Check3",10,130,70,20,$BS_PUSHLIKE)
$prefs_button4      = GUICtrlCreateCheckbox("Check4",90,130,70,20,$BS_PUSHLIKE)

GUISwitch($main_GUI)
$main_tab           = GUICtrlCreateTab(10,10,240,200)
$about_item         = GUICtrlCreateTabItem("About")
$preferences_item   = GUICtrlCreateTabItem("Preferences")
GUICtrlCreateTabItem("")

While 1
    $msg = GUIGetMsg(1)
    Select
        Case $msg[0] = $GUI_EVENT_CLOSE Or $msg[0] = $cancel_button
            ExitLoop
            
        Case $msg[0] = $main_tab
            
            $tab_item = GUICtrlRead($main_tab)
            Select 
                Case $tab_item = 0
                   GUISetState(@SW_HIDE,$prefs_GUI)
                   GUISetState(@SW_SHOW,$about_GUI)
            
               Case $tab_item  = 1
                  GUISetState(@SW_HIDE,$about_GUI)
                  GUISetState(@SW_SHOW,$prefs_GUI)
            EndSelect
    EndSelect
WEnd

Fell free to use and modify it.

If you find it usefull the also let me know :(

Regards

Holger

Share this post


Link to post
Share on other sites



aha! Thanks very much!!

was wondering how to pull that off....Thanks again!!


[u]Do more with pre-existing apps![/u]ANYGUIv2.8

Share this post


Link to post
Share on other sites

Holger, very nice. It is a clean, sharp example of a Tab-Control. This will come in very handy for what I am working on..

Cheers...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0