MrCreatoR

TreeViewTab UDF - Create pseudo tabs as TreeView

9 posts in this topic

#1 ·  Posted (edited)

This UDF allows to create pseudo TreeViewTab control (tabs as TreeView).

Useful for Settings dialog.

post-20477-0-52275800-1342126580_thumb.p

Notes:

* From usage perspective, this UDF is similar to Tabs controls.

But there is few small exceptions:

- To avoid problems and allow other controls to be outside the tab, you must close the created tab using _GUICtrlTreeViewTab_CloseTab.

- To create a new control on an existing «TreeViewTabItem», use _GUICtrlTreeViewTab_OpenTab, create your new control, and then close back with _GUICtrlTreeViewTab_CloseTab.

- After (or better before) parent GUI of the created «TreeViewTab» control is deleted, _GUICtrlTreeViewTab_DestroyTab must be called.

- You can create more than one TreeViewTab controls in one GUI, and even create it inside other TreeViewTab Item.

* External controls created with _GUICtrl* functions should be added manually using _GUICtrlTreeViewTab_AddExternalControl.

* To update/get data/state or perform other manipulation with created «TreeViewTab» control, use native GUICtrlTreeView* and other updating functions.

Example:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <GUIButton.au3>

#include "TreeViewTab.au3"

$hGUI = GUICreate("TreeViewTab Example", 300, 60)
$iSettings_Button = GUICtrlCreateButton("Settings", 20, 20, 260, 20)
GUISetState(@SW_SHOW, $hGUI)

While 1
    $iMsg = GUIGetMsg()

    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $iSettings_Button
            _Settings_GUI($hGUI)
    EndSwitch
WEnd

Func _Settings_GUI($hParent)
    Local Enum _
        $iGeneral_Indx, $iSettings_Indx, $iAbout_Indx, $iOther_Indx, $iWindow_Indx, _
        $iTotal_Indxs

    Local $aImage_Indxs[$iTotal_Indxs][2] = [["General", -170], ["Settings", -91], ["About", -24], ["Other", -77], ["Window", -3]]

    GUISetState(@SW_DISABLE, $hParent)
    $hSettings_GUI = GUICreate("TreeViewTab Example - Settings", 450, 400, -1, -1, -1, -1, $hParent)

    $iTreeViewTab = _GUICtrlTreeViewTab_CreateTab(5, 5, 150, 348, -1, BitOR($WS_EX_STATICEDGE, $WS_EX_CLIENTEDGE))

    #Region General TVItem

    $iGeneral_TVTItem = _GUICtrlTreeViewTab_CreateTabItem("General", $iTreeViewTab)
    GUICtrlSetColor(-1, 0x0000C0)
    GUICtrlSetImage(-1, "shell32.dll", $aImage_Indxs[$iGeneral_Indx][1])

    $iGeneralHeader_Icon = GUICtrlCreateIcon("shell32.dll", $aImage_Indxs[$iGeneral_Indx][1], 160, 3, 32, 32)
    $iGeneralHeader_Label = GUICtrlCreateLabel("General", 200, 10, 300, 40)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetFont(-1, 12, 800, 0, "Georgia")

    $hExternal_Button = _GUICtrlButton_Create($hSettings_GUI, 'External Button', 230, 150, 100, 25, $BS_SPLITBUTTON)
    _GUICtrlTreeViewTab_AddExternalControl($iTreeViewTab, $iGeneral_TVTItem, $hExternal_Button)

    ;Settings TVItem
    $iSettings_TVItem = _GUICtrlTreeViewTab_CreateTabItem("Settings", $iTreeViewTab, $iGeneral_TVTItem)
    GUICtrlSetImage(-1, "shell32.dll", $aImage_Indxs[$iSettings_Indx][1])

    $iSettingsHeader_Icon = GUICtrlCreateIcon("shell32.dll", $aImage_Indxs[$iSettings_Indx][1], 160, 3, 32, 32)
    $iSettingsHeader_Label = GUICtrlCreateLabel("Settings", 200, 10, 300, 40)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetFont(-1, 12, 800, 0, "Georgia")

    $iSettings_CheckBox1 = GUICtrlCreateCheckbox("Settings Checkbox 1", 180, 60)
    $iSettings_CheckBox2 = GUICtrlCreateCheckbox("Settings Checkbox 2", 180, 80)
    $iSettings_CheckBox3 = GUICtrlCreateCheckbox("Settings Checkbox 3", 180, 100)

    $iSettings_List = GUICtrlCreateList("List Item", 180, 140, 250, 210)

    ;About TVItem
    $iAbout_TVItem = _GUICtrlTreeViewTab_CreateTabItem("About", $iTreeViewTab, $iGeneral_TVTItem)
    GUICtrlSetImage(-1, "shell32.dll", $aImage_Indxs[$iAbout_Indx][1])

    $iAboutHeader_Icon = GUICtrlCreateIcon("shell32.dll", $aImage_Indxs[$iAbout_Indx][1], 160, 3, 32, 32)
    $iAboutHeader_Label = GUICtrlCreateLabel("About", 200, 10, 300, 40)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetFont(-1, 12, 800, 0, "Georgia")

    $iAbout_Label = GUICtrlCreateLabel( _
        "TreeViewTab - Settings Controls Concept" & @CRLF & @CRLF & _
        "By G.Sandler a.k.a CreatoR", 180, 70, 300, 50)
    GUICtrlSetFont(-1, 8, 400, 2, "Georgia")

    #EndRegion General TVItem

    #Region Other TVItem

    $iOther_TVTItem = _GUICtrlTreeViewTab_CreateTabItem("Other", $iTreeViewTab)
    GUICtrlSetColor(-1, 0x0000C0)
    GUICtrlSetImage(-1, "shell32.dll", $aImage_Indxs[$iOther_Indx][1])

    $iOtherHeader_Icon = GUICtrlCreateIcon("shell32.dll", $aImage_Indxs[$iOther_Indx][1], 160, 3, 32, 32)
    $iOtherHeader_Label = GUICtrlCreateLabel("Other", 200, 10, 300, 40)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetFont(-1, 12, 800, 0, "Georgia")

    ;Window TVItem
    $iWindow_TVItem = _GUICtrlTreeViewTab_CreateTabItem("Window", $iTreeViewTab, $iOther_TVTItem)
    GUICtrlSetImage(-1, "shell32.dll", $aImage_Indxs[$iWindow_Indx][1])

    $iWindowHeader_Icon = GUICtrlCreateIcon("shell32.dll", $aImage_Indxs[$iWindow_Indx][1], 160, 3, 32, 32)
    $iWindowHeader_Label = GUICtrlCreateLabel("Window", 200, 10, 300, 40)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetFont(-1, 12, 800, 0, "Georgia")

    $iWindowSetOnTop_CheckBox = GUICtrlCreateCheckbox("Set on top", 180, 100)

    #EndRegion Other TVItem

    _GUICtrlTreeViewTab_CloseTab($iTreeViewTab)

    ;Seperators
    GUICtrlCreateLabel("", 160, 40, 285, 2, $SS_SUNKEN)
    GUICtrlCreateGroup("", 160, 45, 285, 310)
    GUICtrlCreateLabel("", 2, 360, 446, 2, $SS_SUNKEN)

    $iClose_Button = GUICtrlCreateButton("Close", 5, 370, 70, 20)
    $iAddCtrl_Button = GUICtrlCreateButton("Add Control", 90, 370, 100, 20)
    $iDelTVItem_Button = GUICtrlCreateButton("Delete current TVTItem", 305, 370, 140, 20)

    GUISetState(@SW_SHOW, $hSettings_GUI)

    GUICtrlSetState($iOther_TVTItem, BitOR($GUI_DEFBUTTON, $GUI_FOCUS)) ; Paint in bold "Other" item
    GUICtrlSetState($iGeneral_TVTItem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON, $GUI_FOCUS)) ; Expand the "General" item and paint in bold

    While 1
        $iMsg = GUIGetMsg()

        Switch $iMsg
            Case $iClose_Button, $GUI_EVENT_CLOSE
                _GUICtrlTreeViewTab_DestroyTab($iTreeViewTab)

                GUISetState(@SW_ENABLE, $hParent)
                GUIDelete($hSettings_GUI)

                ExitLoop
            Case $iAddCtrl_Button
                GUISetState(@SW_DISABLE, $hSettings_GUI)
                $hAddCtrl_GUI = GUICreate("Add New Element", 500, 150, -1, -1, 0, BitOR($WS_EX_STATICEDGE, $WS_EX_CLIENTEDGE, $WS_EX_TOOLWINDOW), $hSettings_GUI)

                GUICtrlCreateLabel("GUICtrlCreate", 20, 42, 80, 15)
                GUICtrlSetFont(-1, 9, 800)
                $iCtrlName_Input = GUICtrlCreateInput("Label('New Label', 180, 330, -1, 15)", 100, 40, 380, 20)
                GUICtrlSetFont(-1, 8.3, 800)
                GUICtrlSetColor(-1, 0xFF0000)

                $iOK_Button = GUICtrlCreateButton("Add", 20, 100, 60, 20)
                GUICtrlSetState(-1, $GUI_DEFBUTTON)
                $iCancel_Button = GUICtrlCreateButton("Cancel", 90, 100, 60, 20)

                GUISetState(@SW_SHOW, $hAddCtrl_GUI)

                While 1
                    Switch GUIGetMsg()
                        Case $GUI_EVENT_CLOSE, $iCancel_Button
                            ExitLoop
                        Case $iOK_Button
                            GUISwitch($hSettings_GUI)

                            _GUICtrlTreeViewTab_OpenTab($iTreeViewTab, GUICtrlRead($iTreeViewTab))
                            $iNewCtrlID = Execute("GUICtrlCreate" & GUICtrlRead($iCtrlName_Input))
                            _GUICtrlTreeViewTab_CloseTab($iTreeViewTab)

                            ExitLoop
                    EndSwitch
                WEnd

                GUISetState(@SW_ENABLE, $hSettings_GUI)
                GUIDelete($hAddCtrl_GUI)
            Case $iDelTVItem_Button
                $iTVTItemID = GUICtrlRead($iTreeViewTab)
                $iDelCtrls = Int(MsgBox(52, 'Attention', 'Delete all controls of that TVTItem (' & GUICtrlRead($iTVTItemID, 1) & ')?', 0, $hSettings_GUI) = 6)

                $aChild_CtrlIDs = _GUICtrlTreeViewTab_DeleteItem($iTreeViewTab, $iTVTItemID, $iDelCtrls)

                For $iIndx = 0 To $iTotal_Indxs-1
                    For $iID = 1 To UBound($aChild_CtrlIDs)-1
                        If GUICtrlRead($aChild_CtrlIDs[$iID], 1) == $aImage_Indxs[$iIndx][0] Then
                            GUICtrlSetImage($aChild_CtrlIDs[$iID], "shell32.dll", $aImage_Indxs[$iIndx][1])
                        EndIf
                    Next
                Next
        EndSwitch
    WEnd
EndFunc

Download:

TreeViewTab_1.2.zip

TreeViewTab_1.1.zip

Changelog:

1.2

* WM_NOTIFY window message replaced with Callback windows procedure (thanks to BugFix).

* Fixed issue with adding new control, if it's added after TreeViewTabItem deleted, the control added outside TabItems.

* Removed TreeViewTab_Adlib.au3 due to replacement of WM_NOTIFY window message.

1.1

+ Added _GUICtrlTreeViewTab_DestroyTab function, must be called after parent GUI of the created TreeViewTab control is deleted.

* Fixed issue with deleting items. The script should not end with fatal error anymore.

* Example Improved.

1.0

* First release

Edited by MrCreatoR
4 people like this

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites



Nice, i like this. Good work.

One point:

I think it may be better to hook WM_NOTIFY with an own Callback windows procedure. So it's not required to use the special function __GUICtrlTreeViewTab_WM_NOTIFY for this. And so the usage of GUIRegisterMsg is like known.


Best Regards BugFix  

Share this post


Link to post
Share on other sites

I think it may be better to hook WM_NOTIFY with an own Callback windows procedure.

Yes, that's what i saw in your MenuEx UDF, i definitely will use this idea, thanks.

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

It's a little bit tricky to use this method, i have to set window hook for every gui that treeviewtab is created in, and then release each one of them after the control is destroyed...


Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

A great idea, similar to some programs I've ever seen!

Very good indeed, thanks for sharing your UDF.

***** from me!

Regards,

João Carlos.


http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

Update...

1.2

* WM_NOTIFY window message replaced with Callback windows procedure (thanks to BugFix).

* Fixed issue with adding new control, if it's added after TreeViewTabItem deleted, the control added outside TabItems.

* Removed TreeViewTab_Adlib.au3 due to replacement of WM_NOTIFY window message.


Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hello @MrCreatoR,

I often use this UDF, it works great.

Since I use it not only for installations, but also as a management surface for tools, I was missing the possibility to switch inside functions by the current focussed TreeviewTab-ID.

Here is my solution for this:

; #Region Global Variables:
; added
Global $g_iFocussedTVTID = 0 ; the current focussed TreeviewTab-ID

; __GUICtrlTreeViewTab_SelChanged:
Func __GUICtrlTreeViewTab_SelChanged()
    AdlibUnRegister('__GUICtrlTreeViewTab_SelChanged')

    Local $hWndFrom = $a_TVT_hWndID[0]
    Local $iIDFrom = $a_TVT_hWndID[1]
    
    ; added:
    ;======================================== the focussed TreeviewTab-ID
    $g_iFocussedTVTID = $iIDFrom
    ;====================================================================
    
    ;...
    
; new function:
Func _GUICtrlTreeViewTab_GetCurrentItemID()
    Return $g_iFocussedTVTID
EndFunc

Now I can get the current ID with _GUICtrlTreeViewTab_GetCurrentItemID()

 

Edited by BugFix

Best Regards BugFix  

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Why you can not use $a_TVT_hWndID[1]?

Func _GUICtrlTreeViewTab_GetCurrentItemID()
    Return $a_TVT_hWndID[1]
EndFunc

Edit: oh sorry, but then you need to comment/remove the line:

Dim $a_TVT_hWndID[2]

 

Edited by MrCreatoR

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

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

  • Similar Content

    • Skeletor
      By Skeletor
      Hi Developers,
       
      While trying to find a way to actually style/skin the GUICtrlCreateTabItem, I read the help file and stated:
      My question to you guys is will this be updated? or am I hoping for something that will never come to pass?
      I've seen scripts between 2007 to 2009 allowing the tabs to be modified
      Reason for my question is I'm trying to make my GUI Tabs look more modern.
      Thanks in advance for reading my post.
       
    • corgano
      By corgano
      I can't explain easily what i want to do, so i made a picture:

      What i want to do is to specify a treeview item, and then be able to move it right to be a child of the previous item, or left to do the opposite (make a child into a sibling). I also want to move and child items of the target with it, like in the bottom half of the above image depicts. However I didn't see any functions in the help file to move items around. All i want is a button that when pressed, makes the selected item and any of selected item's children move one layer to the right / left. Does anyone know how?

      Edit: something along the lines of _GUICtrlTreeView_Level but SET level
    • antonioj84
      By antonioj84
      #include <GUIConstantsEx.au3> #include "GUIExtender.au3" $hGUI = GUICreate("Move Example", 250, 230) GUICtrlCreateGroup(" Choose Orientation ", 10, 10, 230, 80) $cRadio_Horz = GUICtrlCreateRadio(" Horizontal ", 20, 30, 100, 20) GUICtrlSetState(-1, $GUI_CHECKED) $cRadio_Vert = GUICtrlCreateRadio(" Vertical ", 20, 60, 100, 20) GUICtrlCreateGroup(" Choose Move Style ", 10, 100, 230, 110) $cRadio_0 = GUICtrlCreateRadio(" Fix Left ", 20, 120, 100, 20) $cRadio_1 = GUICtrlCreateRadio(" Fix Centre ", 20, 150, 100, 20) $cRadio_2 = GUICtrlCreateRadio(" Fix Right ", 20, 180, 100, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cRadio_Horz GUICtrlSetData($cRadio_0, " Fix Left ") GUICtrlSetState($cRadio_0, $GUI_UNCHECKED) GUICtrlSetState($cRadio_1, $GUI_UNCHECKED) GUICtrlSetData($cRadio_2, " Fix Right ") GUICtrlSetState($cRadio_2, $GUI_UNCHECKED) Case $cRadio_Vert GUICtrlSetData($cRadio_0, " Fix Top ") GUICtrlSetState($cRadio_0, $GUI_UNCHECKED) GUICtrlSetState($cRadio_1, $GUI_UNCHECKED) GUICtrlSetData($cRadio_2, " Fix Bottom ") GUICtrlSetState($cRadio_2, $GUI_UNCHECKED) Case $cRadio_0 _Create_GUI(0) Case $cRadio_1 _Create_GUI(1) Case $cRadio_2 _Create_GUI(2) EndSwitch WEnd Func _Create_GUI($iMove) Local $sTitle Switch $iMove Case 0 If GUICtrlRead($cRadio_Horz) = 1 Then $sTitle = "Fixed Left" Else $sTitle = "Fixed Top" EndIf Case 1 $sTitle = "Fixed Centre" Case 2 If GUICtrlRead($cRadio_Horz) = 1 Then $sTitle = "Fixed Right" Else $sTitle = "Fixed Bottom" EndIf EndSwitch GUISetState(@SW_HIDE, $hGUI) $hGUI_Ex = GUICreate($sTitle, 500, 500) If GUICtrlRead($cRadio_Horz) = 1 Then _GUIExtender_Init($hGUI_Ex, 1, $iMove) _GUIExtender_Section_Create($hGUI_Ex, 0, 250) _GUIExtender_Section_Activate($hGUI_Ex, 2, "", "", 220, 10, 20, 20) _GUIExtender_Section_Create($hGUI_Ex, 250, 250) GUICtrlCreateLabel("", 250, 0, 250, 500) GUICtrlSetBkColor(-1, 0xFFCCCC) _GUIExtender_Section_Create($hGUI_Ex, -99) Else _GUIExtender_Init($hGUI_Ex, 0, $iMove) _GUIExtender_Section_Create($hGUI_Ex, 250, 0) _GUIExtender_Section_Activate($hGUI_Ex, 2, "", "", 470, 220, 20, 20) _GUIExtender_Section_Create($hGUI_Ex, 250, 250) GUICtrlCreateLabel("", 0, 250, 500, 250) GUICtrlSetBkColor(-1, 0xFFCCCC) _GUIExtender_Section_Create($hGUI_Ex, -99) EndIf _GUIExtender_Section_Action($hGUI_Ex, 2, False) GUISetState() While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[0] Case $GUI_EVENT_CLOSE GUISetState(@SW_SHOW, $hGUI) GUIDelete($hGUI_Ex) _GUIExtender_Clear($hGUI_Ex) ExitLoop EndSwitch _GUIExtender_EventMonitor($aMsg[1], $aMsg[0]) ; Check for click on Action control WEnd EndFunc I am trying to implement 2 side window toggle hide and show with 2 different menu.  can someone give me some direction  thanks

    • Tarakesh
      By Tarakesh
      Hi,
      First of all I would like say infinite thanks to the team involved in designing this great tool.
      Here is my problem
      1. Press windows button
      2. ESC
      3. TAB
      4. It will take me to the first pinned icon in the taskbar
      5. If I I do SHIFT F10 which usually opens context menu like  right click of the mouse.
      6. For one of the application I am using it does not support  Shift + F10 context menu rather it listens to only mouse right click event.
      7. I do a search in a tree view of my application and the search item is selected or focused
      8. For eg

           User1

           User2
           User3
      Now if I search for User1 the tab or focus move to User 1 (Red)
           User1

           User2
           User3
      If I search for User3 the tab or focus moves to User 3
      Now my question is how can I move the mouse automatically go to the focused item on the window. Such that during automation I can issue MoveClick("{RIGHT}") as {SHIFT F10} is not working from the keyboard. It is a java app, unfortunately it is not honoring the right click events from keyboard to open the context

      WinMinimizeAll();
      Send("^{ESC}")
      Sleep(200)
      Send("{ESC}")
      Send("{TAB}")

      the above scripts take the tab to the first pinned icon in the taskbar. Now i want
      MouseMove( "move to tab" selection")

      Regards,
      Tarakesh
    • Tjalve
      By Tjalve
      Hi everyone. Im creating a GUI for an application. Im usinga  treeview item and i want to add some information to the side of the treeview based on what cilditem you are pressing. For the moment i have a "get info" button that works. But that means that you have to select your child in the treeview, and then press a button to gte the info. I want the info to be visable as soon as you select it.
      With uther controls you can just add it to the loop but it doesnt seem to work with tyhe UDF version of the treeview control. Is there anything I can do?
      #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> ;~ Create GUI dim $guilabel[7] local $currentlevel = 1 Local $hGui = GUICreate( "Grejs", 1000, 500, 600, 300, BitOR( $GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX ) ) Local $iBorderWidth = 4, $aPos = WinGetClientSize( $hGui ) $idTV = _GUICtrlTreeView_Create($hGui, $iBorderWidth, $iBorderWidth, $aPos[0]-2*$iBorderWidth-400, $aPos[1]-2*$iBorderWidth-30 ) $root_level = _GUICtrlTreeView_Add($idTV,0,"Root") $item1 = _GUICtrlTreeView_AddChild($idTV, $root_level, "child1") $item2 = _GUICtrlTreeView_AddChild($idTV, $root_level, "child2") $item3 = _GUICtrlTreeView_AddChild($idTV, $root_level, "child3") ;~ Start Gui GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idTV MsgBox(0,"","") EndSwitch WEnd GUIDelete($hGui) Exit In this example, i want the msgbox to appear whenevr i select something in the treeview. It ios not my full code, but its an example of the problam i have. Help is much appritiated
      /G