Jump to content

GUIExtender - Original version


Melba23
 Share

Recommended Posts

Ok, here it is.

$Form1 = GUICreate("Form1", 643, 604, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP))
_guiextender_init($Form1)
;_GUIExtender_Section_Start(0,453)
$ListView1 = GUICtrlCreateListView("Name|Description|Path", 0, 0, 642, 430, BitOR($GUI_SS_DEFAULT_LISTVIEW,$WS_HSCROLL,$WS_VSCROLL))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 300)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 200)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
$ListView1context = GUICtrlCreateContextMenu($ListView1)
$cntxtmnu_Run = GUICtrlCreateMenuItem("Run", $ListView1context)
$cntxtmnu_RunParam = GUICtrlCreateMenuItem("Run with parameters...", $ListView1context)
$cntxtmnu_RunCon = GUICtrlCreateMenuItem("Run in console", $ListView1context)
$cntxtmnu_RunHlp = GUICtrlCreateMenuItem("Help file", $ListView1context)
$cntxtmnu_RunWeb = GUICtrlCreateMenuItem("Website", $ListView1context)
$cntxtmnu_Del = GUICtrlCreateMenuItem("Delete Item", $ListView1context)
$cntxtmnu_Add = GUICtrlCreateMenuItem("Add Items...", $ListView1context)
$Label_1 = GUICtrlCreateLabel("Edit details", 8, 432, 55, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Label_2 = GUICtrlCreateLabel("Label_2", 64, 440, 492, 2, $SS_ETCHEDHORZ)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT)
$Button_1 = GUICtrlCreateButton("66", 568, 432, 68, 14, BitOR($BS_NOTIFY,$BS_FLAT))
GUICtrlSetFont(-1, 8, 400, 0, "Webdings")
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
;_GUIExtender_Section_End()
$extendablesection = _GUIExtender_Section_Start(455,149 )
_GUIExtender_Section_Action($extendablesection)
Opt("GUIResizeMode", $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT)
$Label_3 = GUICtrlCreateLabel("Name", 104, 456, 32, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Label_4 = GUICtrlCreateLabel("Description", 79, 480, 57, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Label_5 = GUICtrlCreateLabel("Command Line Parameters", 6, 504, 130, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Label_6 = GUICtrlCreateLabel("Help File", 91, 528, 45, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Label_7 = GUICtrlCreateLabel("Icon", 111, 552, 25, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Label_8 = GUICtrlCreateLabel("Website", 93, 576, 43, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Checkbox_RWC = GUICtrlCreateCheckbox("Run with console", 528, 504, 105, 17)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Icon1 = GUICtrlCreateIcon("E:Utilitiesdefault.ico", -1, 8, 456, 32, 32)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Input_Name = GUICtrlCreateInput("", 144, 456, 489, 21)
$Input_Description = GUICtrlCreateInput("", 144, 480, 489, 21)
$Input_CmdParam = GUICtrlCreateInput("", 144, 504, 377, 21)
$Input_HelpFile = GUICtrlCreateInput("", 144, 528, 457, 21)
$Input_Icon = GUICtrlCreateInput("", 144, 552, 457, 21)
$Input_Website = GUICtrlCreateInput("", 144, 576, 489, 21)
$Button_HelpBrowse = GUICtrlCreateButton("...", 608, 528, 28, 22, BitOR($BS_NOTIFY,$BS_FLAT))
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Button_IconBrowse = GUICtrlCreateButton("...", 608, 552, 28, 22, BitOR($BS_NOTIFY,$BS_FLAT))
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
_GUIExtender_Section_End()

What I am trying now is changing the x/y/width/height after the section is closed so my gui looks right & my resizing works.

Edit: that didn't work, but changing the resizing to hold the control position, extending/retracting, and then setting the resizing back to normal seems to work.

Edited by ChrisN
Link to comment
Share on other sites

FWIW, here's my solution:

Case $Button_1
   $state = _guiextender_section_state($extendablesection)
   If $state = 1 Then
    GUICtrlSetResizing($ListView1, $GUI_DOCKHEIGHT)
    GUICtrlSetResizing($Label_1, BitOR($GUI_DOCKTOP,$GUI_DOCKHEIGHT))
    GUICtrlSetResizing($Label_2, BitOR($GUI_DOCKTOP,$GUI_DOCKHEIGHT))
    GUICtrlSetResizing($Button_1, BitOR($GUI_DOCKTOP,$GUI_DOCKHEIGHT))
    _GUIExtender_Section_Extend($extendablesection, False) ;retract
    GUICtrlSetData($Button_1, "66")
    GUICtrlSetResizing($ListView1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
    GUICtrlSetResizing($Label_1,$GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
    GUICtrlSetResizing($Label_2,$GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKRIGHT + $GUI_DOCKHEIGHT)
    GUICtrlSetResizing($Button_1,$GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
   ElseIf $state = 0 Then
    GUICtrlSetResizing($ListView1, $GUI_DOCKHEIGHT)
    GUICtrlSetResizing($Label_1, BitOR($GUI_DOCKTOP,$GUI_DOCKHEIGHT))
    GUICtrlSetResizing($Label_2, BitOR($GUI_DOCKTOP,$GUI_DOCKHEIGHT))
    GUICtrlSetResizing($Button_1, BitOR($GUI_DOCKTOP,$GUI_DOCKHEIGHT))

    _GUIExtender_Section_Extend($extendablesection, True) ;extend
    GUICtrlSetData($Button_1, "55")
    GUICtrlSetResizing($ListView1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
    GUICtrlSetResizing($Label_1,$GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
    GUICtrlSetResizing($Label_2,$GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKRIGHT + $GUI_DOCKHEIGHT)
    GUICtrlSetResizing($Button_1,$GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
   EndIf

Before extending/retracting I change the resizing flags to prevent the controls from moving, extend/retract, and then change the resizing back to what it should be. :)

edit: Causes problems when the window is maximized, though ;)

Edited by ChrisN
Link to comment
Share on other sites

  • Moderators

ChrisN,

Nice try but it does not work completely. If I retract/extend multiple times after resizing the ListView shrinks horizontally as does the action button. ;)

Give me a few days and I will see what I can come up with - but keep experimenting yourself. :)

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

Hmmm... maybe a problem with my resizing options...

Edit: Ok, mustn't have locked them in enough before extending/retracting. Locking width + height + 1 vertical + 1 horizontal seems to work.

Edited by ChrisN
Link to comment
Share on other sites

  • 1 month later...

Is there a way to force the window to extend left/up as opposed to right/down?

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

  • Moderators

mechaflash213,

Not unless you want to write the code to do it! ;)

But you could aways use WinMove to get the GUI in the position you want it once you have extended/retracted a section. :)

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

I've been messing with it the last 2 hours trying to make it =D. I know that WinMove() will have to be called to shift it left when an item expands. Trying to perfect it however.

EDIT: ZOMG speak of the devil... i got it to work lol.

I used your example from GUIExtender_Example_Loop_Horz.au3. I made section 1 the extendable and section 2 the static. Then created an additional switch...case to fire WinMove() based on the output from _GUIExtender_Section_State() of the section in question:

$1Ext = _GUIExtender_Section_State(1)
    Switch $1Ext
        Case 1
            WinMove("Test", "",$GUI_x - 100,Default)
        Case 0,2
            WinMove("Test","",$GUI_x,Default)
    EndSwitch

I set the x and y coords for the window, and perform a subtraction based on the width of a section.

Edited by mechaflash213
Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

  • Moderators

New version 21 Feb 12

New: You can now choose the manner in which the GUI extends/retracts by adding a parameter to _GUIExtender_Init. This parameter sets the fixed point of the GUI: Left/Top (default and current behaviour), Centre, Right/Bottom. This fixed point can be overridden for a specific section by using a similar parameter in a _GUIExtender_Section_Extend call. See the new examples for more details.

Thanks to mechaflash213 for the idea. :)

This is a non-scriptbreaking change - all current scripts will perform as before. ;)

New UDF, examples and zip in first post. ;)

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

Awesome! Me likes :)

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

  • 3 weeks later...

Hello Melba23,

I want to thank you for sharing such a useful UDF and providing such great examples in the .zip file.

I haven't taken the time to look into the code yet, but going by your examples, I can see how I could use this in the future.

Very cool.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

Hello Melba23,

I tried to customize your UDF for my use by adding 3 properties for the extender button:

GUICtrlSetBkColor

GUICtrlSetColor

GUICtrlSetTip

Unfortunetly, I only had limited success.

I may try again tomorrow when I'm more rested. But if you have any plans for including these features in a future release, I would be happy to wait.

Thanks again for a great UDF.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

  • Moderators

taurus905,

Because of a bug deep in the AutoIt core code that will not be fixed any time soon, colouring button controls is fraught with danger and so I have absolutely no intention of amending the UDF to introduce it. :oops:

However, do you realise the you can create your own buttons to action the sections? That way you can do whatever you want to the buttons without having to amend the UDF itself. :bye:

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

  • 2 months later...

I've read through the posts with BlueLord several times, but I'm new to the whole GUI business and I'm afraid it is all over my head. Here is what I am trying to do: If the user selects "Citrix HDX" from the "Product" ComboBox, have the section expand to reveal a "Component" ComboBox. If they change their mind, have the section collapse. I've figured out how to get the 1st section to draw when the proper value is selected, but that is as far as I have gotten. Can someone give me a hand? I've attached the script. The script requires an ini file (which I can't attach), so that is embedded below.

INI FIle

[Config]
Branch=Barrayar|Caprica|Trunk
Product=C3 Communicator|Citrix HDX|Unified
Component=RTME|RTC
Type=Debug|Release
Options=Install the latest build|Install a specific version|Browse for an installer

Build_Auto_Installer.au3

Link to comment
Share on other sites

  • Moderators

robinsiebler,

Can someone give me a hand?

Of course! ;)

Take a look here:

#comments-start
-------------------------------------------------------------------------------
Name:       Build Auto Installer
Purpose:    This script will install the Avistar product the user selects
Author:      Robin Siebler
Created:     6/1/2012
Version:     0.2
-------------------------------------------------------------------------------
#comments-end

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=avistar.ico
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

; Includes
#include<file.au3>
#include<array.au3>
#include<date.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIExtender.au3>

Opt("GUIOnEventMode", 1)
TraySetIcon("F:scriptsAutoItBuild Auto Installeravistar.ico", -1)

; Variables
Global $Branch, $Product, $Type, $Options, $Component, $BuildFolder
Local $IniFile = @ScriptDir & "Build_Auto_Installer.ini"
Local $ConfigData = IniReadSection($IniFile, "Config")

$BuildFolder = "hqfile04Buildreleases"

;----------------------- Build Selection Dialog ----------------------------------------

$Form1 = GUICreate("Build Auto Installer", 297, 261)  ; <<<<<<<<<<<<<<<<<<<<<<< Automatically centres the GUI - and why make it resizable?
GUISetIcon("F:scriptsAutoItBuild Auto Installeravistar.ico", -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "ProcessCancel")

_GUIExtender_Init($Form1) ; Initialise the GUI

GUICtrlCreateLabel("Please choose from the below options to install a build:", 16, 32, 261, 17, 0) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<< Why save the ControlID  - you never use it
GUICtrlCreateLabel("Branch:", 40, 56, 41, 17, 0)
$CB_Branch = GUICtrlCreateCombo("", 88, 56, 145, 25) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Those styles are default so no need to add them
GUICtrlSetData(-1, $ConfigData[1][1])
$Label3 = GUICtrlCreateLabel("Product:", 40, 88, 44, 17, 0)
$CB_Product = GUICtrlCreateCombo("", 88, 88, 145, 25)
GUICtrlSetOnEvent($CB_Product, "CB_ProductChange")
GUICtrlSetData(-1, $ConfigData[2][1])

$1stSection = _GUIExtender_Section_Start(105, 25) ; Create section

_GUIExtender_Section_Action($1stSection) ; Make it dynamic

GUICtrlCreateLabel("Type:", 40, 120, 31, 17, 0)
$CB_Type = GUICtrlCreateCombo("", 88, 120, 145, 25)
GUICtrlSetData(-1, $ConfigData[4][1])

_GUIExtender_Section_End() ; Close section

$2ndSection = _GUIExtender_Section_Start(130, 135) ; Everything else goes in another section

$Label5 = GUICtrlCreateLabel("Options:", 40, 152, 43, 17, 0)
$CB_Options = GUICtrlCreateCombo("", 88, 152, 145, 25)
GUICtrlSetData(-1, $ConfigData[5][1])
$Btn_OK = GUICtrlCreateButton("OK", 72, 208, 49, 25, $BS_NOTIFY)
GUICtrlSetOnEvent($Btn_OK, "SetBuildOptions")
$Btn_Cancel = GUICtrlCreateButton("Cancel", 144, 208, 49, 25, $BS_NOTIFY)
GUICtrlSetOnEvent($Btn_Cancel, "ProcessCancel")

_GUIExtender_Section_End() ; Close section 

_GUIExtender_Section_Extend($1stSection, False) ; Close the dynamic section

GUISetState(@SW_SHOW, $Form1)
#EndRegion ### END Koda GUI section ###

;----------------------- Component Selection Dialog ----------------------------------------
#Region ### START Koda GUI section ### Form=F:scriptsAutoItBuild Auto InstallerComponentSelectionDialog.kxf
$Form2 = GUICreate("Select Component", 228, 145, -1, -1 , BitXOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MINIMIZEBOX))
GUISetIcon("F:scriptsAutoItBuild Auto Installeravistar.ico", -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "ProcessCancel")
$Label1 = GUICtrlCreateLabel("Select the component to install:", 24, 16, 152, 17)
$CB_Component = GUICtrlCreateCombo("", 40, 40, 113, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($CB_Component, "RTME|RTC")
$Btn_OK_2 = GUICtrlCreateButton("OK", 40, 88, 49, 25)
GUICtrlSetOnEvent($Btn_OK_2, "GetComponent")
$Btn_Cancel_2 = GUICtrlCreateButton("Cancel", 112, 88, 49, 25)
GUICtrlSetOnEvent($Btn_Cancel_2, "ProcessCancel")
Local $move = CenterWindow($Form2, "Select Component")
#EndRegion ### END Koda GUI section ###

$Loop = 1
While $Loop     ; Wait for Build Selection Dialog to close
    Sleep(100)
WEnd

If $Product = "Citrix HDX" Then
    GUISetState(@SW_SHOW, $Form2)
    $Loop = 1
    While $Loop = 1     ; Wait for Component Selection Dialog to close
        Sleep(100)
    WEnd
EndIf

$NewestDir = NewestFolder($BuildFolder)
If @error Then  ; If NewestFolder() didn't error out, report the newest directory, otherwise, report the error.
    MsgBox(8240, 'Error', 'No folders in  this directory!')
    Exit
Else
    $BuildFolder = $BuildFolder & "" & $NewestDir
EndIf

Exit

; ----------------------------- Functions ---------------------------
; Center Window on Screen
Func CenterWindow($win, $txt)
    Local $size = WinGetClientSize($win, $txt)
    Local $y = (@DesktopHeight / 2) - ($size[1] / 2)
    Local $x = (@DesktopWidth / 2) - ($size[0] / 2)
    Return WinMove($win, $txt, $x, $y)
EndFunc

;Install RTME or RTC?
Func GetComponent()
    $Component = GUICtrlRead($CB_Component)
    If $Component == "" Then
        MsgBox(8208, "Missing Component!", "Please select a component!")
        Return
    EndIf
    GUISetState(@SW_HIDE, $Form2)
    $Loop = 0   ; If all of the options have been selected, exit the loop
EndFunc

; Get OS Version
; Win 7 = 6.1
Func GetOSVersion()
    Return RegRead("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersion", "CurrentVersion")
EndFunc

; Find the newest folder in the build directory
Func NewestFolder($Directory)
    $aFolders = _FileListToArray($Directory, '*', 2); Get a list of all the single level sub-folders in a specific folder
    If Not IsArray($aFolders) Then  ; Check if we didn't find any folders, and return 0 with @error = 1 if we do not
        SetError(1)
        Return 0
    EndIf
    _ArrayDelete($aFolders, 0)  ; Remove the first entry containing the total number of entries
    Dim $aEPOCH[UBound($aFolders)][2]   ; Create a 2d array to hold epoch time and the folder names
    For $a = 0 To UBound($aFolders) - 1
        $aTime = FileGetTime($Directory & '' & $aFolders[$a], 1, 0) ; Get time folder was created in an array ($aTime)
        $aEPOCH[$a][0] = _DateDiff('s', "1970/01/01 00:00:00", $aTime[0] & '/' & $aTime[1] & '/' & $aTime[2] & ' ' & $aTime[3] & ':' & $aTime[4] & ':' & $aTime[5]) ; Convert to Epoch time
        $aEPOCH[$a][1] = $aFolders[$a]  ; Store directory name
    Next
    _ArraySort($aEPOCH, 1)  ; Sort the $aEPOCH array by EPOCH time, so index 0 contains the newest item
    Return $aEPOCH[0][1]    ; Return the newest items directory name
EndFunc

; The user clicked the Cancel button
Func ProcessCancel()
    $RtnVal = MsgBox(8228, "Cancel Installation?", "Are you sure you want to cancel the installation?")
    If $RtnVal = 6 Then Exit    ; Yes was clicked
EndFunc

Func CB_ProductChange()
    If GUICtrlRead($CB_Product) = "Citrix HDX" Then
        _GUIExtender_Section_Extend($1stSection) ; Open dynamic section
    Else
        _GUIExtender_Section_Extend($1stSection, False) ; Close dynamic section
    EndIf
EndFunc

; Get the build options provided by the user
Func SetBuildOptions()
    $Branch = GUICtrlRead($CB_Branch)
    $Product = GUICtrlRead($CB_Product)
    $Type = GUICtrlRead($CB_Type)
    $Options = GUICtrlRead($CB_Options)
    ; Check to see if the user failed to select any options
    If $Branch == "" Or $Product = "" Or $Type = "" Or $Options = "" Then
        MsgBox(8208, "Missing Selection!", "Please choose an option from each ComboBox!")
        Return
    EndIf
    GUIDelete($Form1)
    $Loop = 0   ; If all of the options have been selected, exit the loop
EndFunc

I have added comments to the GUIExtender lines to explain what is going on. I have also made a few other comments - look for the <<<<<<<<<<<< lines. :)

All clear? ;)

M23

P.S. You might want to read your PMs, I sent you one the other day and you have not yet read it. :)

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

  • Moderators

robinsiebler,

so I wasn't aware of what all of the parameters meant

The Help file is very good at explaining them - time taken to check out the parameters of any function you do not use regularly is always well spent. ;)

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

  • Moderators

robinsiebler,

Hardly surprising, you cannot use the UDF on more than a single GUI per script. ;)

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

  • Moderators

robinsiebler,

As #including a file just adds the code of that file to the main script it is hardly surprising. :)

What exactly are you trying to do? There might be a solution - can you not rearrange the code so that you only need one extendable GUI at any time? The UDF can certainly cope with that - it is just having more than one extendable GUI at the same time which poses a problem. ;)

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

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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