Jump to content

Hide TAB on a TAB Control


B3tt3R
 Share

Recommended Posts

Hi,

I was looking for a way to hide one or more Tab/s from a TAB Control by checking a checkbox item.

This in order to use the same GUI and same controls for 'Normal' and 'Advanced' setting of my script.

I found this solution:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <Constants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
_AdvancedSetup(1)

Func _AdvancedSetup($PrevSetting = 0)
    Global $Tab, $SubSectTab, $MasterTab, $Group1, $Label1, $Combo1, $Label11, $Combo11
    Global $Group2, $Checkbox2, $Checkbox22, $Group3, $Label3, $Input3, $Updown3
    Global $Group4, $Label4, $Input4, $Updown4
    Local $AdvancedDivSettings, $Save_bnt, $Default_btn, $Reset_btn, $Close_btn, $Checkbox1
    $AdvancedDivSettings = GUICreate("Advanced Dividers Settings", 350, 180, -1, -1)
    GUISetBkColor(0xF5FCFF)
    $Save_bnt = GUICtrlCreateButton("Save", 265, 28, 80, 25)
    GUICtrlSetCursor ($Save_bnt, 0)
    $Default_btn = GUICtrlCreateButton("Default", 265, 62, 80, 25)
    GUICtrlSetCursor ($Default_btn, 0)
    $Reset_btn = GUICtrlCreateButton("Reset", 265, 96, 80, 25)
    GUICtrlSetCursor ($Reset_btn, 0)
    $Close_btn = GUICtrlCreateButton("Close", 265, 130, 80, 25)
    GUICtrlSetCursor ($Close_btn, 0)
    $Checkbox1 = GUICtrlCreateCheckbox("Multiple-Selection", 8, 158, 200, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_LEFT))
    GUICtrlSetFont($Checkbox1, 8, 400, 4+3, "Arial")
    If $PrevSetting = 1 Then
        GUICtrlSetState($Checkbox1, $GUI_CHECKED)
    Else
        GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
    EndIf
    If GUICtrlRead($Checkbox1) = 4 Then
        _Normal()
    ElseIf GUICtrlRead($Checkbox1) = 1 Then
        _Advanced()
    EndIf
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE, $Close_btn
                Exit
            Case $Checkbox1
                If _IsCheckedEx($Checkbox1) Then
                    GUICtrlDeleteAll($AdvancedDivSettings)
                    _AdvancedSetup(1)
                ElseIf _IsUnCheckedEx($Checkbox1) Then
                    GUICtrlDeleteAll($AdvancedDivSettings)
                    _AdvancedSetup(0)
                EndIf
        EndSwitch
    WEnd
EndFunc ;==> _AdvancedSetup
;===============================================================================================
Func _IsCheckedEx($iControlID)
    Return BitAND(GUICtrlRead($iControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc ;==> _IsChecked
;===============================================================================================
Func _IsUnCheckedEx($iControlID)
    Return BitAND(GUICtrlRead($iControlID), $GUI_UNCHECKED) = $GUI_UNCHECKED
EndFunc ;==> _IsUnChecked
;===============================================================================================
Func _Advanced()
    $Tab = GUICtrlCreateTab(8, 8, 255, 148, BitOR($TCS_FIXEDWIDTH, $TCS_TOOLTIPS),$WS_EX_LAYERED)
    $MasterTab = GUICtrlCreateTabItem("Master Sections")
    $Group1 = GUICtrlCreateGroup("", 13, 28, 242, 65)
    $Label1 = GUICtrlCreateLabel("Fonts", 20, 40, 100, 17, $SS_CENTER)
    GUICtrlSetFont($Label1, 9, 400, 0, "Arial")
    $Combo1 = GUICtrlCreateCombo("", 17, 61, 105, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData($Combo1, "Arial|ArialNarrow|Calibri|Courier|Helvetica|Tahoma|TimesNewRoman","Helvetica")
    $Label11 = GUICtrlCreateLabel("Size", 123, 40, 35, 17, $SS_CENTER)
    GUICtrlSetFont($Label11, 9, 400, 0, "Arial")
    $Combo11 = GUICtrlCreateCombo("", 124, 61, 35, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData($Combo11, "8|9|10|11|12|14|16|18|20|22|24|26|28|36|48","28")
    $Label111 = GUICtrlCreateLabel("Align", 164, 40, 95, 17, $SS_CENTER)
    GUICtrlSetFont($Label111, 9, 400, 0, "Arial")
    $Combo111 = GUICtrlCreateCombo("", 161, 61, 88, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData($Combo111, "Top Left|Top Right|Top Middle|Middle Left|Middle Right|Middle Middle|Button Left|Button Right|Button Middle","Middle Middle")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group2 = GUICtrlCreateGroup("", 13, 85, 84, 65)
    $Checkbox2 = GUICtrlCreateCheckbox("Bold", 30, 98, 57, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_LEFT))
    GUICtrlSetFont($Checkbox2, 9, 800, 0, "Verdana")
    $Checkbox22 = GUICtrlCreateCheckbox("Italic", 30, 122, 57, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_LEFT))
    GUICtrlSetFont($Checkbox22, 9, 400, 2, "Verdana")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group3 = GUICtrlCreateGroup("", 96, 85, 80, 65)
    $Label3 = GUICtrlCreateLabel("X Edge", 108, 97, 50, 20, $SS_CENTER)
    GUICtrlSetFont($Label3, 9, 400, 0, "Arial")
    $Input3 = GUICtrlCreateInput("", 110, 118, 51, 21)
    $Updown3 = GUICtrlCreateUpdown($Input3)
    GUICtrlSetLimit($Updown3, 100, -100)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group4 = GUICtrlCreateGroup("", 175, 85, 80, 65)
    $Label4 = GUICtrlCreateLabel("Y Edge", 188, 97, 50, 20, $SS_CENTER)
    GUICtrlSetFont($Label4, 9, 400, 0, "Arial")
    $Input4 = GUICtrlCreateInput("", 187, 118, 54, 20)
    $Updown4 = GUICtrlCreateUpdown($Input4)
    GUICtrlSetLimit($Updown4, 100, -100)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $SubSectTab = GUICtrlCreateTabItem("Sub Sections")

    GUICtrlCreateGroup("", -99, -99, 1, 1)
EndFunc ;==> _Advanced
;===============================================================================================
Func _Normal()
    $Tab = GUICtrlCreateTab(8, 8, 255, 148, BitOR($TCS_FIXEDWIDTH, $TCS_TOOLTIPS),$WS_EX_LAYERED)
    $GeneralTab = GUICtrlCreateTabItem("General")
    $Group1 = GUICtrlCreateGroup("", 13, 28, 242, 65)
    $Label1 = GUICtrlCreateLabel("Fonts", 20, 40, 100, 17, $SS_CENTER)
    GUICtrlSetFont($Label1, 9, 400, 0, "Arial")
    $Combo1 = GUICtrlCreateCombo("", 17, 61, 105, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData($Combo1, "Arial|ArialNarrow|Calibri|Courier|Helvetica|Tahoma|TimesNewRoman","Helvetica")
    $Label11 = GUICtrlCreateLabel("Size", 123, 40, 35, 17, $SS_CENTER)
    GUICtrlSetFont($Label11, 9, 400, 0, "Arial")
    $Combo11 = GUICtrlCreateCombo("", 124, 61, 35, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData($Combo11, "8|9|10|11|12|14|16|18|20|22|24|26|28|36|48","28")
    $Label111 = GUICtrlCreateLabel("Align", 164, 40, 95, 17, $SS_CENTER)
    GUICtrlSetFont($Label111, 9, 400, 0, "Arial")
    $Combo111 = GUICtrlCreateCombo("", 161, 61, 88, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData($Combo111, "Top Left|Top Right|Top Middle|Middle Left|Middle Right|Middle Middle|Button Left|Button Right|Button Middle","Middle Middle")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group2 = GUICtrlCreateGroup("", 13, 85, 84, 65)
    $Checkbox2 = GUICtrlCreateCheckbox("Bold", 30, 98, 57, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_LEFT))
    GUICtrlSetFont($Checkbox2, 9, 800, 0, "Verdana")
    $Checkbox22 = GUICtrlCreateCheckbox("Italic", 30, 122, 57, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_LEFT))
    GUICtrlSetFont($Checkbox22, 9, 400, 2, "Verdana")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group3 = GUICtrlCreateGroup("", 96, 85, 80, 65)
    $Label3 = GUICtrlCreateLabel("X Edge", 108, 97, 50, 20, $SS_CENTER)
    GUICtrlSetFont($Label3, 9, 400, 0, "Arial")
    $Input3 = GUICtrlCreateInput("", 110, 118, 51, 21)
    $Updown3 = GUICtrlCreateUpdown($Input3)
    GUICtrlSetLimit($Updown3, 100, -100)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group4 = GUICtrlCreateGroup("", 175, 85, 80, 65)
    $Label4 = GUICtrlCreateLabel("Y Edge", 188, 97, 50, 20, $SS_CENTER)
    GUICtrlSetFont($Label4, 9, 400, 0, "Arial")
    $Input4 = GUICtrlCreateInput("", 187, 118, 54, 20)
    $Updown4 = GUICtrlCreateUpdown($Input4)
    GUICtrlSetLimit($Updown4, 100, -100)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
EndFunc ;==> _Normal

Func GUICtrlDeleteAll($hWin)
    If Not IsHWnd($hWin) Then Return SetError(-1,0,0)
    Local $aCtrlHandles
    WinListChildren($hWin, $aCtrlHandles)
    For $x = 0 To UBound($aCtrlHandles) - 1
        If UBound($aCtrlHandles,2) > 1 Then
            GUICtrlDelete($aCtrlHandles[$x][0])
        Else
            GUICtrlDelete($aCtrlHandles[$x])
        EndIf
    Next
    GUIDelete($hWin)
EndFunc ;==> GUICtrlDeleteAll

Func WinListChildren($hWnd, ByRef $avArr)
    If UBound($avArr, 0) <> 2 Then
        Local $avTmp[10][2] = [[0]]
        $avArr = $avTmp
    EndIf

    Local $hChild = _WinAPI_GetWindow($hWnd, $GW_CHILD)

    While $hChild
        If $avArr[0][0]+1 > UBound($avArr, 1)-1 Then ReDim $avArr[$avArr[0][0]+10][2]
        $avArr[$avArr[0][0]+1][0] = $hChild
        $avArr[$avArr[0][0]+1][1] = _WinAPI_GetWindowText($hChild)
        $avArr[0][0] += 1
        WinListChildren($hChild, $avArr)
        $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT)
    WEnd

    ReDim $avArr[$avArr[0][0]+1][2]
EndFunc ;==> WinListChildren

It works, anyway, could be improved by some of you (surely with more code experience than me) or eventually it could be helpful to someone.

Bye :bye:

Link to comment
Share on other sites

  • Moderators

B3tt3R,

The best I have ever come up with to disable a TabItem is this:

#include <GUIConstantsEx.au3>

Global $aTabs[5]

$hGUI = GUICreate("Test", 500, 500)

$cTab = GUICtrlCreateTab(10, 10, 480, 200)

For $i = 0 To 4
    $aTabs[$i] = GUICtrlCreateTabItem("Tab " & $i)
Next
GUICtrlCreateTabItem("")

GUICtrlCreateLabel("Select tab to disable", 10, 230, 200, 20)
$cCombo = GUICtrlCreateCombo("", 10, 250, 200, 20)
GUICtrlSetData($cCombo, "0|1|2|3|4")

GUISetState()

$iCurrDisabledTab = -1
$iCurrTab = 0

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cCombo
            $iDisableTab = GUICtrlRead($cCombo)
            If $iDisableTab <> $iCurrDisabledTab Then
                If $iCurrDisabledTab <> -1 Then
                    GUICtrlSetData($aTabs[$iCurrDisabledTab], "Tab " & $iCurrDisabledTab)
                EndIf
                GUICtrlSetData($aTabs[$iDisableTab], "Disabled")
                $iCurrDisabledTab = $iDisableTab
            EndIf
        Case $cTab
            $iSelTab = GUICtrlRead($cTab)
            If $iSelTab = $iCurrDisabledTab Then
                GUICtrlSetState($aTabs[$iCurrTab], $GUI_SHOW)
            Else
                $iCurrTab = $iSelTab
            EndIf

    EndSwitch

WEnd
A little less drastic than deleting and recreating the whole thing! :D

Have you looked at my GUIExtender UDF? That might be an easier overall solution for you as it allows you to expand/retract the GUI to show/hide whole sections when needed. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks M23,
it's a nice and elegant solution ;)

I think to know the answer to my next question but I'll try to ask anyway. :D

Since all the GUI's of my script have a colored background, is it possible to apply some kind of background color or graphic style to a TAB control?

PS. Yes, I saw all your releases and used some of them as example and other as they are. Many thanks for this!! ;)

Edited by B3tt3R
Link to comment
Share on other sites

  • Moderators

B3tt3R,

The "Search facility is at top-right - I am surprised you have not noticed it over the past 3 years! :D

But you might find >this code useful. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

M23,
You know, I'm just a proud self-taught who try and re-try till reach the goal :D
I'm used to search through google filtering by site just when i'm stuck... but this is an other story ... :P

I was not so clear asking, sorry... I'm not looking for internal colors, I'm trying to color just the grey nut where tab labels are or should be placed on.
There is some different way from placing a disabled label over the unused space?

Link to comment
Share on other sites

  • Moderators

B3tt3R,

One way to remove the unused space is expand the tabs themselves to fill the space - we discussed how you might do it in this thread. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

M23,

I really thank you for your feeds.

I know that it's a drastic solution but I made some adjustments and now I like as this way looks like for the advanced setup of my script (actually it's a multifunction program to work with PDF and excel files for automated creation of complex hyperlinked PDF collections of thousands of pages for Final Documentation, like manuals, engineering docs and quality docs).

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <Constants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
_AdvancedDividersSetup(1)

Func _AdvancedDividersSetup($PrevSetting = 0, $hMainWin = 0)
    Global $Tab, $SubSectTab, $MasterTab, $Group1, $Label1, $Combo1, $Label11, $Combo11
    Global $Group2, $Checkbox2, $Checkbox22, $Group3, $Label3, $Input3, $Updown3
    Global $Group4, $Label4, $Input4, $Updown4, $hChildWin, $AdvancedDivSettings
    Local $Save_bnt, $Default_btn, $Reset_btn, $Close_btn, $Checkbox1, $cLabel
    $AdvancedDivSettings = GUICreate("Advanced Settings", 350, 180, -1, -1, BitOR(0x80880000, 0x00C00000), -1, $hMainWin)
    GUISetBkColor(0xF5FCFF)
    $Save_bnt = GUICtrlCreateButton("Save", 265, 28, 80, 25)
    GUICtrlSetCursor ($Save_bnt, 0)
    $Default_btn = GUICtrlCreateButton("Default", 265, 62, 80, 25)
    GUICtrlSetCursor ($Default_btn, 0)
    $Reset_btn = GUICtrlCreateButton("Reset", 265, 96, 80, 25)
    GUICtrlSetCursor ($Reset_btn, 0)
    $Close_btn = GUICtrlCreateButton("Close", 265, 130, 80, 25)
    GUICtrlSetCursor ($Close_btn, 0)
    $Checkbox1 = GUICtrlCreateCheckbox("Multiple-Selection", 8, 158, 200, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_LEFT))
    GUICtrlSetFont($Checkbox1, 8, 400, 4+3, "Arial")
    If $PrevSetting = 1 Then
        GUICtrlSetState($Checkbox1, $GUI_CHECKED)
    Else
        GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
    EndIf
    If GUICtrlRead($Checkbox1) = 4 Then
        _Normal()
    ElseIf GUICtrlRead($Checkbox1) = 1 Then
        _Advanced()
    EndIf
    GUICtrlCreateTabItem("")

    GUISetState(@SW_SHOW, $AdvancedDivSettings)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE, $Close_btn
                Exit
            Case $Checkbox1
                If _IsCheckedEx($Checkbox1) Then
                    GUICtrlDeleteAll($hChildWin)
                    _Advanced()
                ElseIf _IsUnCheckedEx($Checkbox1) Then
                    GUICtrlDeleteAll($hChildWin)
                    _Normal()
                EndIf
        EndSwitch
    WEnd
EndFunc ;==> _AdvancedDividersSetup
;===============================================================================================
Func _IsCheckedEx($iControlID)
    Return BitAND(GUICtrlRead($iControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc ;==> _IsChecked
;===============================================================================================
Func _IsUnCheckedEx($iControlID)
    Return BitAND(GUICtrlRead($iControlID), $GUI_UNCHECKED) = $GUI_UNCHECKED
EndFunc ;==> _IsUnChecked
;===============================================================================================
Func _Advanced()
    $hChildWin = GUICreate("", 255, 148, 8, 8, BitOR($WS_CHILD,$DS_MODALFRAME), -1, $AdvancedDivSettings)
    GUISetBkColor(0xF5FCFF, $hChildWin)
    $Tab = GUICtrlCreateTab(0, 0, 255, 148, BitOR($TCS_FIXEDWIDTH, $TCS_TOOLTIPS),$WS_EX_LAYERED)
    $MasterTab = GUICtrlCreateTabItem("Master Sections")
    $Group1 = GUICtrlCreateGroup("", 5, 20, 242, 65)
    $Label1 = GUICtrlCreateLabel("Fonts", 12, 32, 100, 17, $SS_CENTER)
    GUICtrlSetFont($Label1, 9, 400, 0, "Arial")
    $Combo1 = GUICtrlCreateCombo("", 9, 53, 105, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData($Combo1, "Arial|ArialNarrow|Calibri|Courier|Helvetica|Tahoma|TimesNewRoman","Helvetica")
    $Label11 = GUICtrlCreateLabel("Size", 115, 32, 35, 17, $SS_CENTER)
    GUICtrlSetFont($Label11, 9, 400, 0, "Arial")
    $Combo11 = GUICtrlCreateCombo("", 116, 53, 35, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData($Combo11, "8|9|10|11|12|14|16|18|20|22|24|26|28|36|48","28")
    $Label111 = GUICtrlCreateLabel("Align", 156, 32, 95, 17, $SS_CENTER)
    GUICtrlSetFont($Label111, 9, 400, 0, "Arial")
    $Combo111 = GUICtrlCreateCombo("", 153, 53, 88, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData($Combo111, "Top Left|Top Right|Top Middle|Middle Left|Middle Right|Middle Middle|Button Left|Button Right|Button Middle","Middle Middle")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group2 = GUICtrlCreateGroup("", 5, 77, 84, 65)
    $Checkbox2 = GUICtrlCreateCheckbox("Bold", 22, 90, 57, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_LEFT))
    GUICtrlSetFont($Checkbox2, 9, 800, 0, "Verdana")
    $Checkbox22 = GUICtrlCreateCheckbox("Italic", 22, 116, 57, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_LEFT))
    GUICtrlSetFont($Checkbox22, 9, 400, 2, "Verdana")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group3 = GUICtrlCreateGroup("", 88, 77, 80, 65)
    $Label3 = GUICtrlCreateLabel("X Edge", 100, 89, 50, 20, $SS_CENTER)
    GUICtrlSetFont($Label3, 9, 400, 0, "Arial")
    $Input3 = GUICtrlCreateInput("", 102, 110, 51, 21)
    $Updown3 = GUICtrlCreateUpdown($Input3)
    GUICtrlSetLimit($Updown3, 100, -100)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group4 = GUICtrlCreateGroup("", 167, 77, 80, 65)
    $Label4 = GUICtrlCreateLabel("Y Edge", 180, 89, 50, 20, $SS_CENTER)
    GUICtrlSetFont($Label4, 9, 400, 0, "Arial")
    $Input4 = GUICtrlCreateInput("", 179, 110, 54, 20)
    $Updown4 = GUICtrlCreateUpdown($Input4)
    GUICtrlSetLimit($Updown4, 100, -100)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $SubSectTab = GUICtrlCreateTabItem("Sub Sections")

    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW, $hChildWin)
    $cLabel = GUICtrlCreateLabel("", 196,0, 100,20)
    GUICtrlSetBkColor(0xF5FCFF, $cLabel)
    GUICtrlSetState($cLabel, @SW_DISABLE)
EndFunc ;==> _Advanced
;===============================================================================================
Func _Normal()
    $hChildWin = GUICreate("", 255, 148, 8, 8, BitOR($WS_CHILD,$DS_MODALFRAME), -1, $AdvancedDivSettings)
    GUISetBkColor(0xF5FCFF, $hChildWin)
    $Tab = GUICtrlCreateTab(0, 0, 255, 148, BitOR($TCS_FIXEDWIDTH, $TCS_TOOLTIPS),$WS_EX_LAYERED)
    $GeneralTab = GUICtrlCreateTabItem("General")
    $Group1 = GUICtrlCreateGroup("", 5, 20, 242, 65)
    $Label1 = GUICtrlCreateLabel("Fonts", 12, 32, 100, 17, $SS_CENTER)
    GUICtrlSetFont($Label1, 9, 400, 0, "Arial")
    $Combo1 = GUICtrlCreateCombo("", 9, 53, 105, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData($Combo1, "Arial|ArialNarrow|Calibri|Courier|Helvetica|Tahoma|TimesNewRoman","Helvetica")
    $Label11 = GUICtrlCreateLabel("Size", 115, 32, 35, 17, $SS_CENTER)
    GUICtrlSetFont($Label11, 9, 400, 0, "Arial")
    $Combo11 = GUICtrlCreateCombo("", 116, 53, 35, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData($Combo11, "8|9|10|11|12|14|16|18|20|22|24|26|28|36|48","28")
    $Label111 = GUICtrlCreateLabel("Align", 156, 32, 95, 17, $SS_CENTER)
    GUICtrlSetFont($Label111, 9, 400, 0, "Arial")
    $Combo111 = GUICtrlCreateCombo("", 153, 53, 88, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData($Combo111, "Top Left|Top Right|Top Middle|Middle Left|Middle Right|Middle Middle|Button Left|Button Right|Button Middle","Middle Middle")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group2 = GUICtrlCreateGroup("", 5, 77, 84, 65)
    $Checkbox2 = GUICtrlCreateCheckbox("Bold", 22, 90, 57, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_LEFT))
    GUICtrlSetFont($Checkbox2, 9, 800, 0, "Verdana")
    $Checkbox22 = GUICtrlCreateCheckbox("Italic", 22, 116, 57, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_LEFT))
    GUICtrlSetFont($Checkbox22, 9, 400, 2, "Verdana")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group3 = GUICtrlCreateGroup("", 88, 77, 80, 65)
    $Label3 = GUICtrlCreateLabel("X Edge", 100, 89, 50, 20, $SS_CENTER)
    GUICtrlSetFont($Label3, 9, 400, 0, "Arial")
    $Input3 = GUICtrlCreateInput("", 102, 110, 51, 21)
    $Updown3 = GUICtrlCreateUpdown($Input3)
    GUICtrlSetLimit($Updown3, 100, -100)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group4 = GUICtrlCreateGroup("", 167, 77, 80, 65)
    $Label4 = GUICtrlCreateLabel("Y Edge", 180, 89, 50, 20, $SS_CENTER)
    GUICtrlSetFont($Label4, 9, 400, 0, "Arial")
    $Input4 = GUICtrlCreateInput("", 179, 110, 54, 20)
    $Updown4 = GUICtrlCreateUpdown($Input4)
    GUICtrlSetLimit($Updown4, 100, -100)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW, $hChildWin)
    $cLabel = GUICtrlCreateLabel("", 100,0, 160,20)
    GUICtrlSetBkColor(0xF5FCFF, $cLabel)
    GUICtrlSetState($cLabel, @SW_DISABLE)
EndFunc ;==> _Normal

Func GUICtrlDeleteAll($hWin)
    If Not IsHWnd($hWin) Then Return SetError(-1,0,0)
    Local $aCtrlHandles
    WinListChildren($hWin, $aCtrlHandles)
    For $x = 0 To UBound($aCtrlHandles) - 1
        If UBound($aCtrlHandles,2) > 1 Then
            GUICtrlDelete($aCtrlHandles[$x][0])
        Else
            GUICtrlDelete($aCtrlHandles[$x])
        EndIf
    Next
    GUIDelete($hWin)
EndFunc ;==> GUICtrlDeleteAll

Func WinListChildren($hWnd, ByRef $avArr)
    If UBound($avArr, 0) <> 2 Then
        Local $avTmp[10][2] = [[0]]
        $avArr = $avTmp
    EndIf

    Local $hChild = _WinAPI_GetWindow($hWnd, $GW_CHILD)

    While $hChild
        If $avArr[0][0]+1 > UBound($avArr, 1)-1 Then ReDim $avArr[$avArr[0][0]+10][2]
        $avArr[$avArr[0][0]+1][0] = $hChild
        $avArr[$avArr[0][0]+1][1] = _WinAPI_GetWindowText($hChild)
        $avArr[0][0] += 1
        WinListChildren($hChild, $avArr)
        $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT)
    WEnd

    ReDim $avArr[$avArr[0][0]+1][2]
EndFunc ;==> WinListChildren

This is not so elegant like your code, but the appearance is not bad :P

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...