Sign in to follow this  
Followers 0
neity

how to do this gui???

9 posts in this topic

how to do The GUI of the collapse / expand??

post-37856-1280107943928_thumb.png ===> post-37856-12801079550523_thumb.png ===>post-37856-1280107943928_thumb.png

Share this post


Link to post
Share on other sites



neity,

Perhaps by coding something like this? :blink:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("GUIResizeMode", $GUI_DOCKALL)

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

$aPos = WinGetPos($hGUI)
$iWin_W = $aPos[2]
$iWin_H = $aPos[3]

; Group 1

GUICtrlCreateGroup("GUI", 10, 10, 480, 80)
$hInput_1 = GUICtrlCreateInput("Main Board", 20, 30, 100, 20)
$hButton_1 = GUICtrlCreateButton("Contract", 400, 30, 80, 30)

; Group 2

$hStart_2 = GUICtrlCreateDummy() + 1

GUICtrlCreateGroup("HDD Temps", 10, 110, 480, 80)
GUICtrlCreatePic("C:\Program Files\AutoIt3\Examples\GUI\Advanced\Images\Blue.bmp", 20, 130, 460, 50)

$hEnd_2 = GUICtrlCreateDummy() - 1

; Group 3

$hStart_3 = GUICtrlCreateDummy() + 1

GUICtrlCreateGroup("Cooling Fans", 10, 210, 480, 80)
$hInput_1 = GUICtrlCreateInput("HDD Temps", 20, 230, 100, 20)

$hEnd_3 = GUICtrlCreateDummy() - 1

; Group 4

$hStart_4 = GUICtrlCreateDummy() + 1

GUICtrlCreateGroup("Voltages", 10, 310, 480, 80)
GUICtrlCreatePic("C:\Program Files\AutoIt3\Examples\GUI\Advanced\Images\Green.bmp", 20, 330, 460, 50)

$hEnd_4 = GUICtrlCreateDummy() - 1

; Group 5

$hStart_5 = GUICtrlCreateDummy() + 1

GUICtrlCreateGroup("Graphics Adapters", 10, 410, 480, 80)
$hInput_5 = GUICtrlCreateInput("Voltages", 20, 430, 100, 20)

$hEnd_5 = GUICtrlCreateDummy() - 1

GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton_1
            Switch GUICtrlRead($hButton_1)
                Case "Contract"
                    ; Shrink GUI
                    WinMove($hGUI, "", Default, Default, $iWin_W, $iWin_H - 200)
                    ; Change button text
                    GUICtrlSetData($hButton_1, "Expand")
                    ; Hide Group 2
                    For $i = $hStart_2 To $hEnd_2
                        GUICtrlSetState($i, $GUI_HIDE)
                    Next
                    ; Hide Group 4
                    For $i = $hStart_4 To $hEnd_4
                        GUICtrlSetState($i, $GUI_HIDE)
                    Next
                    ; Move Group 3
                    For $i = $hStart_3 To $hEnd_3
                        $aPos = ControlGetPos($hGUI, "", $i)
                        ControlMove($hGUI, "", $i, $aPos[0], $aPos[1] - 100)
                    Next
                    ; Move Group 5
                    For $i = $hStart_5 To $hEnd_5
                        $aPos = ControlGetPos($hGUI, "", $i)
                        ControlMove($hGUI, "", $i, $aPos[0], $aPos[1] - 200)
                    Next
                Case Else
                    ; Expand GUI
                    WinMove($hGUI, "", Default, Default, $iWin_W, $iWin_H)
                    ; Change button text
                    GUICtrlSetData($hButton_1, "Contract")
                    ; Show Group 2
                    For $i = $hStart_2 To $hEnd_2
                        GUICtrlSetState($i, $GUI_SHOW)
                    Next
                    ; Show Group 4
                    For $i = $hStart_4 To $hEnd_4
                        GUICtrlSetState($i, $GUI_SHOW)
                    Next
            EndSwitch
    EndSwitch

WEnd

Be careful to include ALL the controls on the GUI when you create it - you need the controls created in immediate succession for the looping trick to work. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

The answer very well, thank you!

But how I run this script?

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIResizeMode", $GUI_DOCKALL)
Global $Labels[13],    $Progress[13] ,$hStart_3 ,$hEnd_3,   $gH ,$ei=12,$iWin_W,$iWin_H,$aPos
#Region ### START Koda GUI section ### Form=
$hGUI = GUICreate("Form1", 288, 443, 192, 124)
$aPos = WinGetPos($hGUI)
$iWin_W = $aPos[2]
$iWin_H = $aPos[3]

GUICtrlCreateGroup("Group1", 8, 8, 273, 121)
$hButton_1 = GUICtrlCreateButton("︾",16, 30, 80, 30);
$hStart_2 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("Group2", 8, 136, 273, 177)

$hEnd_2 = GUICtrlCreateDummy() - 1         

$hStart_3 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("Group3", 8, 320, 273, 113)
$Button1 = GUICtrlCreateButton("Button1", 40, 344, 75, 25)
$Button2 = GUICtrlCreateButton("Button2", 40, 376, 75, 25)
$hEnd_3 = GUICtrlCreateDummy() - 1
GUICtrlCreateGroup("", -99, -99, 1, 1)
guimove()
$aPos1 = WinGetPos($hGUI)
$iWin_W1 = $aPos[2]
$iWin_H1 = $aPos[3]
GUISetState()
#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
                Case $hButton_1
            Switch GUICtrlRead($hButton_1)
                Case "︾"
                    ; Shrink GUI
                    WinMove($hGUI, "", Default, Default, $iWin_W, $iWin_H1 - (177+($iWin_H1-$iWin_H)))
                    ; Change button text
                    GUICtrlSetData($hButton_1, "︽")
                    ; Hide Group 2
                    For $i = $hStart_2 To $hEnd_2
                        GUICtrlSetState($i, $GUI_HIDE)
                    Next
                    ; Move Group 3
                    For $i = $hStart_3 To $hEnd_3
                        $aPos = ControlGetPos($hGUI, "", $i)
                        ControlMove($hGUI, "", $i, $aPos[0], $aPos[1] - (177+($iWin_H1-$iWin_H)))
                    Next
                Case Else
                    ; Expand GUI
                    WinMove($hGUI, "", Default, Default, $iWin_W, $iWin_H1)
                    ; Change button text
                    GUICtrlSetData($hButton_1, "︾")
                    ; Show Group 2
                    For $i = $hStart_2 To $hEnd_2
                        GUICtrlSetState($i, $GUI_SHOW)
                    Next
            EndSwitch
    EndSwitch
WEnd


Func guimove()
     If $ei*20 >177 Then
         $h = $ei*20 - 177+20
         WinMove($hGUI, "", Default, Default, $iWin_W, $iWin_H + $h)
    For $i = $hStart_3 To $hEnd_3
        $aPos = ControlGetPos($hGUI, "", $i)
        ControlMove($hGUI, "", $i, $aPos[0], $aPos[1] +$h)
    Next  
        ControlMove($hGUI, "", "Group2", 8, 136, 273,177+$h)
     EndIf   
    
     For $i = 1 To $ei
        $Labels[$i] = GUICtrlCreateLabel("test", 16, ($i * 20) + 136, 40, 17)
        $Progress[$i] = GUICtrlCreateProgress(72, ($i * 20) + 136, 150, 17, 1)
    Next 
EndFunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

neity,

You need to do all the calculations at the start - it makes it much easier later on! ;)

I think this shows the way to do it:

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIResizeMode", $GUI_DOCKALL)
Global $Labels[13], $Progress[13], $hStart_3, $hEnd_3, $gH, $ei = 12, $iWin_W, $iWin_H, $aPos

; Set heights for the various groups
$iGroup_1_Ht = 120
$iGroup_2_Ht = ($ei * 20) + 30
$iGroup_3_Ht = 120

; Set Y coords for the various groups we need to move - assume borders of 10 between
$iGroup_2_Y = $iGroup_1_Ht + 20
$iGroup_3_Y = $iGroup_2_Y + $iGroup_2_Ht + 10

; Now determine expanded GUI height
$iGUI_Y_Expand = $iGroup_3_Y + $iGroup_3_Ht + 10

; greate the GUI expanded
$hGUI = GUICreate("Form1", 290, $iGUI_Y_Expand)
; Get the full size of the GUI including borders, title bar, etc
$aPos = WinGetPos($hGUI)
$iWin_W = $aPos[2]
$iWin_H = $aPos[3]

; And determine GUI shrunken height - allowing for the borders, etc
$iGUI_Y_Shrink = $iGroup_2_Y + $iGroup_3_Ht + 10 + ($iWin_H - $iGUI_Y_Expand)

; Now create the groups as if expanded
GUICtrlCreateGroup("Group1", 10, 10, 270, $iGroup_1_Ht)
$hButton_1 = GUICtrlCreateButton("Contract", 15, 30, 80, 30)

$hStart_2 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("Group2", 10, $iGroup_2_Y, 270, $iGroup_2_Ht )
For $i = 1 To $ei
    $Labels[$i] = GUICtrlCreateLabel("test", 20, ($i * 20) + $iGroup_2_Y, 40, 17)
    $Progress[$i] = GUICtrlCreateProgress(70, ($i * 20) + $iGroup_2_Y, 150, 17, 1)
Next
$hEnd_2 = GUICtrlCreateDummy() - 1

$hStart_3 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("Group3", 10, $iGroup_3_Y, 270, $iGroup_3_Ht)
$Button1 = GUICtrlCreateButton("Button1", 40, $iGroup_3_Y + 25, 75, 25)
$Button2 = GUICtrlCreateButton("Button2", 40, $iGroup_3_Y + 55, 75, 25)
$hEnd_3 = GUICtrlCreateDummy() - 1
GUICtrlCreateGroup("", -99, -99, 1, 1)

; Start in the contracted state
Contract()

GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton_1
            Switch GUICtrlRead($hButton_1)
                Case "Contract"
                    Contract()
                Case Else
                    Expand()
            EndSwitch
    EndSwitch
WEnd

Func Contract()

    ; Shrink GUI
    WinMove($hGUI, "", Default, Default, $iWin_W, $iGUI_Y_Shrink)
    ; Change button text
    GUICtrlSetData($hButton_1, "Expand")
    ; Hide Group 2
    For $i = $hStart_2 To $hEnd_2
        GUICtrlSetState($i, $GUI_HIDE)
    Next
    ; Move Group 3
    For $i = $hStart_3 To $hEnd_3
        $aPos = ControlGetPos($hGUI, "", $i)
        ControlMove($hGUI, "", $i, $aPos[0], $aPos[1] - ($iGroup_3_Y - $iGroup_2_Y))
    Next

EndFunc

Func Expand()

    ; Expand GUI
    WinMove($hGUI, "", Default, Default, $iWin_W, $iWin_H)
    ; Change button text
    GUICtrlSetData($hButton_1, "Contract")
    ; Show Group 2
    For $i = $hStart_2 To $hEnd_2
        GUICtrlSetState($i, $GUI_SHOW)
    Next

EndFunc

All clear? :blink:

M23

Edit: Typnig.

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Too perfect, thank you Melba23! Very....

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Melba23.

I needed to hide group2 group4 and group5.

The script does not know where the wrong:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

Opt("GUIResizeMode", $GUI_DOCKALL)

Global $hlLabel[13], $hProgress[13], $htLabel[13], $huLabel[13], $cProgress[5], $ctLabel[5], $cpLabel[5], $hStart_3, $hEnd_3, $gH, $ei = 12, $ci =4, $iWin_W, $iWin_H, $aPos

$iGroup_1_Ht = ($ci * 15) + 35
$iGroup_2_Ht = 65
$iGroup_3_Ht = 65
$iGroup_4_Ht = 65
$iGroup_5_Ht = ($ei * 15) + 25
$iGroup_6_Ht = 65
$iGroup_7_Ht = 65

$iGroup_2_Y = $iGroup_1_Ht + 20
$iGroup_3_Y = $iGroup_2_Y + $iGroup_2_Ht + 10
$iGroup_4_Y = $iGroup_3_Y + $iGroup_3_Ht + 10
$iGroup_5_Y = $iGroup_4_Y + $iGroup_4_Ht + 10
$iGroup_6_Y = $iGroup_5_Y + $iGroup_5_Ht + 10
$iGroup_7_Y = $iGroup_6_Y + $iGroup_6_Ht + 10


$iGUI_Y_Expand = $iGroup_7_Y + $iGroup_7_Ht + 10


$hGUI = GUICreate("Form1", 201, $iGUI_Y_Expand)

$aPos = WinGetPos($hGUI)
$iWin_W = $aPos[2]
$iWin_H = $aPos[3]


$iGUI_Y_Shrink = $iGroup_2_Y + $iGroup_3_Ht + $iGroup_3_Ht + $iGroup_4_Ht + $iGroup_5_Ht + $iGroup_6_Ht + $iGroup_7_Ht + 10 + ($iWin_H - $iGUI_Y_Expand)

GUICtrlCreateGroup("CPU", 8, 8, 185, $iGroup_1_Ht)
$cButton = GUICtrlCreateButton("︾", 168, 8, 20, 12, BitOR($BS_CENTER , $BS_VCENTER, $BS_FLAT))
$Label1 = GUICtrlCreateLabel("CPU使用率:", 16, 24, 74, 17)
$ValueLabel = GUICtrlCreateLabel("1", 104, 24, 36, 17)
 GUICtrlSetColor(-1,0x00FF00)
 For $i =1 To $ci
       $cProgress[$i] = GUICtrlCreateProgress(16, ($i * 15) + 24, 94, 10)
       $ctLabel[$i] = GUICtrlCreateLabel("2", 120, ($i * 15) + 24, 28, 10)
       $cpLabel[$i] = GUICtrlCreateLabel("3", 152, ($i * 15) + 24, 28, 10)
Next

$hStart_2 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("", 8, $iGroup_2_Y, 185, $iGroup_2_Ht)
$hEnd_2 = GUICtrlCreateDummy() - 1

$hStart_3 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("显卡", 8, $iGroup_3_Y, 185, $iGroup_3_Ht)
$gButton = GUICtrlCreateButton("︾", 168, $iGroup_3_Y, 20, 12, BitOR($BS_CENTER, $BS_VCENTER , $BS_FLAT))
$hEnd_3 = GUICtrlCreateDummy() - 1

$hStart_4 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("", 8, $iGroup_4_Y, 185, $iGroup_4_Ht)
$hEnd_4 = GUICtrlCreateDummy() - 1

$hStart_5 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("硬盘", 8, $iGroup_5_Y, 185, $iGroup_5_Ht)
For $i = 1 To $ei
    $hlLabel[$i] = GUICtrlCreateLabel("1", 16,  ($i * 15) + $iGroup_5_Y, 18, 10)
    $hProgress[$i] = GUICtrlCreateProgress(44,  ($i * 15) + $iGroup_5_Y, 78, 10, 1)
    $htLabel[$i] = GUICtrlCreateLabel("2", 124, ($i * 15) + $iGroup_5_Y,32, 10)
    $huLabel[$i]= GUICtrlCreateLabel("3", 160, ($i * 15) + $iGroup_5_Y, 28, 10)
Next
$hEnd_5 = GUICtrlCreateDummy() - 1

$hStart_6 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("内存", 8, $iGroup_6_Y, 185, $iGroup_6_Ht)
$hEnd_6 = GUICtrlCreateDummy() - 1

$hStart_7 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("主板", 8, $iGroup_7_Y, 185, $iGroup_7_Ht)
$hEnd_7 = GUICtrlCreateDummy() - 1
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()
#EndRegion ### END Koda GUI section ###
Contract()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
               Case $cButton
                   Switch GUICtrlRead($cButton)
                         Case "︽"
                            Contract()
                        Case Else
                            Expand()
                    EndSwitch
    EndSwitch
WEnd

Func Contract()

    ; Shrink GUI
;    WinMove($hGUI, "", Default, Default, $iWin_W, $iGUI_Y_Shrink)
    WinMove($hGUI, "", Default, Default, $iWin_W, $iGUI_Y_Expand)
    ; Change button text
    GUICtrlSetData($cButton, "︾")
    ; Hide Group 2
    For $i = $hStart_2 To $hEnd_2
        GUICtrlSetState($i, $GUI_HIDE)
    Next
    ; Move Group 3
    For $i = $hStart_3 To $hEnd_3
        $aPos = ControlGetPos($hGUI, "", $i)
        ControlMove($hGUI, "", $i, $aPos[0], $aPos[1] - ($iGroup_3_Y - $iGroup_2_Y))

    Next
    ; Move Group 4
    For $i = $hStart_4 To $hEnd_4
        $aPos = ControlGetPos($hGUI, "", $i)
        ControlMove($hGUI, "", $i, $aPos[0], $aPos[1] - ($iGroup_4_Y - $iGroup_3_Y))
    Next
    ; Move Group 5  
    For $i = $hStart_5 To $hEnd_5
        $aPos = ControlGetPos($hGUI, "", $i)
        ControlMove($hGUI, "", $i, $aPos[0], $aPos[1] - ($iGroup_5_Y - $iGroup_4_Y))
    Next
    ; Move Group 6
    For $i = $hStart_6 To $hEnd_6
        $aPos = ControlGetPos($hGUI, "", $i)
        ControlMove($hGUI, "", $i, $aPos[0], $aPos[1] - ($iGroup_6_Y - $iGroup_5_Y))
    Next
    ; Move Group 7
    For $i = $hStart_7 To $hEnd_7
        $aPos = ControlGetPos($hGUI, "", $i)
        ControlMove($hGUI, "", $i, $aPos[0], $aPos[1] - ($iGroup_7_Y - $iGroup_6_Y))
    Next
EndFunc

Func Expand()

    ; Expand GUI
    WinMove($hGUI, "", Default, Default, $iWin_W, $iGUI_Y_Expand)
    ; Change button text
    GUICtrlSetData($cButton, "︽")
    ; Show Group 2
    For $i = $hStart_2 To $hEnd_2
        GUICtrlSetState($i, $GUI_SHOW)
    Next

EndFunc
Edited by neity

Share this post


Link to post
Share on other sites

neity,

Here you go: ;)

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

Opt("GUIResizeMode", $GUI_DOCKALL)

Global $hlLabel[13], $hProgress[13], $htLabel[13], $huLabel[13], $cProgress[5], $ctLabel[5], $cpLabel[5], $hStart_3, $hEnd_3, $gH, $ei = 12, $ci =4, $iWin_W, $iWin_H, $aPos

$iGroup_1_Ht = ($ci * 15) + 35
$iGroup_2_Ht = 65
$iGroup_3_Ht = 65
$iGroup_4_Ht = 65
$iGroup_5_Ht = ($ei * 15) + 25
$iGroup_6_Ht = 65
$iGroup_7_Ht = 65

$iGroup_2_Y = $iGroup_1_Ht + 20
$iGroup_3_Y = $iGroup_2_Y + $iGroup_2_Ht + 10
$iGroup_4_Y = $iGroup_3_Y + $iGroup_3_Ht + 10
$iGroup_5_Y = $iGroup_4_Y + $iGroup_4_Ht + 10
$iGroup_6_Y = $iGroup_5_Y + $iGroup_5_Ht + 10
$iGroup_7_Y = $iGroup_6_Y + $iGroup_6_Ht + 10

; Determine initial GUI size
$iGUI_Y_Initial = $iGroup_7_Y + $iGroup_7_Ht + 10

$hGUI = GUICreate("Form1", 201, $iGUI_Y_Initial)
; Determine Expanded GUI sizes with borders etc
$aPos = WinGetPos($hGUI)
$iGUI_X = $aPos[2]
$iGUI_Y_Expand = $aPos[3]

; Determine shrunken size
$iGUI_Y_Shrink = $iGroup_2_Y + $iGroup_3_Ht + $iGroup_6_Ht + $iGroup_7_Ht + 20 + ($iGUI_Y_Expand - $iGUI_Y_Initial)

GUICtrlCreateGroup("CPU", 8, 8, 185, $iGroup_1_Ht)
$cButton = GUICtrlCreateButton("x", 168, 8, 20, 12, BitOR($BS_CENTER , $BS_VCENTER, $BS_FLAT))
$Label1 = GUICtrlCreateLabel("CPU???:", 16, 24, 74, 17)
$ValueLabel = GUICtrlCreateLabel("1", 104, 24, 36, 17)
 GUICtrlSetColor(-1,0x00FF00)
 For $i =1 To $ci
       $cProgress[$i] = GUICtrlCreateProgress(16, ($i * 15) + 24, 94, 10)
       $ctLabel[$i] = GUICtrlCreateLabel("2", 120, ($i * 15) + 24, 28, 10)
       $cpLabel[$i] = GUICtrlCreateLabel("3", 152, ($i * 15) + 24, 28, 10)
Next

$hStart_2 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("2", 8, $iGroup_2_Y, 185, $iGroup_2_Ht)
$hEnd_2 = GUICtrlCreateDummy() - 1

$hStart_3 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("3", 8, $iGroup_3_Y, 185, $iGroup_3_Ht)
$gButton = GUICtrlCreateButton("x", 168, $iGroup_3_Y, 20, 12, BitOR($BS_CENTER, $BS_VCENTER , $BS_FLAT))
$hEnd_3 = GUICtrlCreateDummy() - 1

$hStart_4 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("4", 8, $iGroup_4_Y, 185, $iGroup_4_Ht)
$hEnd_4 = GUICtrlCreateDummy() - 1

$hStart_5 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("5", 8, $iGroup_5_Y, 185, $iGroup_5_Ht)
For $i = 1 To $ei
    $hlLabel[$i] = GUICtrlCreateLabel("1", 16,  ($i * 15) + $iGroup_5_Y, 18, 10)
    $hProgress[$i] = GUICtrlCreateProgress(44,  ($i * 15) + $iGroup_5_Y, 78, 10, 1)
    $htLabel[$i] = GUICtrlCreateLabel("2", 124, ($i * 15) + $iGroup_5_Y,32, 10)
    $huLabel[$i]= GUICtrlCreateLabel("3", 160, ($i * 15) + $iGroup_5_Y, 28, 10)
Next
$hEnd_5 = GUICtrlCreateDummy() - 1

$hStart_6 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("6", 8, $iGroup_6_Y, 185, $iGroup_6_Ht)
$hEnd_6 = GUICtrlCreateDummy() - 1

$hStart_7 = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("7", 8, $iGroup_7_Y, 185, $iGroup_7_Ht)
$hEnd_7 = GUICtrlCreateDummy() - 1
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()
#EndRegion ### END Koda GUI section ###
;Contract()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton, $gButton
            Switch GUICtrlRead($cButton)
                Case "x"
                    Contract()
                Case Else
                    Expand()
            EndSwitch
    EndSwitch
WEnd

Func Contract()

    ; Shrink GUI
    WinMove($hGUI, "", Default, Default, $iGUI_X, $iGUI_Y_Shrink)

    ; Change button text
    GUICtrlSetData($cButton, "?")
    GUICtrlSetData($gButton, "?")

    ; Hide Group 2
    For $i = $hStart_2 To $hEnd_2
        GUICtrlSetState($i, $GUI_HIDE)
    Next
    ; Hide Group 4
    For $i = $hStart_4 To $hEnd_4
        GUICtrlSetState($i, $GUI_HIDE)
    Next
    ; Hide Group 5
    For $i = $hStart_5 To $hEnd_5
        GUICtrlSetState($i, $GUI_HIDE)
    Next

    ; Move Group 3
    For $i = $hStart_3 To $hEnd_3
        $aPos = ControlGetPos($hGUI, "", $i)
        ControlMove($hGUI, "", $i, $aPos[0], $aPos[1] - ($iGroup_3_Y - $iGroup_2_Y))
    Next
    ; Move Group 6
    For $i = $hStart_6 To $hEnd_6
        $aPos = ControlGetPos($hGUI, "", $i)
        ControlMove($hGUI, "", $i, $aPos[0], $aPos[1] - ($iGroup_6_Y - ($iGroup_2_Y + $iGroup_3_Ht)))
    Next
    ; Move Group 7
    For $i = $hStart_7 To $hEnd_7
        $aPos = ControlGetPos($hGUI, "", $i)
        ControlMove($hGUI, "", $i, $aPos[0], $aPos[1] - ($iGroup_7_Y - ($iGroup_2_Y + $iGroup_3_Ht + $iGroup_6_Ht)))
    Next
EndFunc

Func Expand()

    ; Expand GUI
    WinMove($hGUI, "", Default, Default, $iGUI_X, $iGUI_Y_Expand)
    ; Change button text
    GUICtrlSetData($cButton, "x")
    GUICtrlSetData($cButton, "x")
    ; Show Group 2
    For $i = $hStart_2 To $hEnd_2
        GUICtrlSetState($i, $GUI_SHOW)
    Next
    ; Show Group 4
    For $i = $hStart_4 To $hEnd_4
        GUICtrlSetState($i, $GUI_SHOW)
    Next
    ; Show Group 5
    For $i = $hStart_5 To $hEnd_5
        GUICtrlSetState($i, $GUI_SHOW)
    Next

EndFunc

This is the last one I write for you. You have enough examples now. :blink:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Melba23, Excuse me, very grateful! :blink:

Share this post


Link to post
Share on other sites

neity,

You might want to look at my GUIExtender UDF. It should help you code any more GUIs of thsi type that you need in the future.

Thanks for the original question - I enjoyed coding the UDF! :blink:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

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