Jump to content

Starting 2 GUIs Simultaneously?


S1M1S
 Share

Recommended Posts

This may seem like a post on something somebody has already solved, but my half extensive search on the forums have yielded no results.

What I want to happen is two GUI windows opening at the same time - one at the top right of the screen and the other at the bottom right. One will ask you to enter a folder, press okay, then ask you to enter another folder. The other window should be displaying these folders, but should have no buttons on. This is my code (Just the GUI bits):

Func Settings()
    Local $add, $disp, $remove, $msg, $mGUI, $mGUIn

    If IniRead ( $sIni, $iniRun, "Fin", 0 ) = 1 Then
        $mGUIn = "Back"
    Else
        $mGUIn = "Continue"
    EndIf

    GUICreate ( "Settings", 160, 136 )
    $add = GUICtrlCreateButton ( "Add", 5, 5, 150, 30 )
    $disp = GUICtrlCreateButton ( "Display", 5, 37, 150, 30 )
    $remove = GUICtrlCreateButton ( "Remove", 5, 69, 150, 30 )
    $mGUI = GUICtrlCreateButton ( $mGUIn, 5, 101, 150, 30 )
    GUISetState()

    If IniRead ( $sIni, $iniRun, "Settings", 0 ) = 0 Then
        MsgBox ( 0, "First Run", "This is the settings menu. This program creates profiles for Garry's Mod by moving the addons you choose out of the Addon folder and into AddonStore, inside your Garry's Mod install." )
        MsgBox ( 0, "First Run", "Close this window and press 'Add' to choose the addons you would like to remove from the game while playing in the performance profile." )
        IniWrite ( $sIni, $iniRun, "Settings", 1 )
    EndIf

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                GUIDelete()
                ExitLoop
            Case $msg = $add
                If IniRead ( $sIni, $iniRun, "Add", 0 ) = 0 Then
                MsgBox ( 0, "First Run", "Pressing 'Add' allows you to customize your profiles. Navigate to 'garrysmod/garrysmod/addons' and drag and drop the addon folders you would like to remove while using the performance profile onto the window." & @CRLF & @CRLF & "You can change these at any time." )
                IniWrite ( $sIni, $iniRun, "Add", 1 )
                EndIf
                $array = IniReadSection ( $sIni, $file )
                If @error = 0 Then
                    $i = $array[0][0] + 1
                    GUIDelete()
                    Input()
                    Addisplay()
                    ExitLoop
                Else
                    $i = 1
                    GUIDelete()
                    Input()
                    Addisplay()
                    ExitLoop
                EndIf
            Case $msg = $disp
                If IniRead ( $sIni, $iniRun, "Display", 0 ) = 0 Then
                    MsgBox ( 0, "First Run", "Pressing 'Display' shows you what addons the program will move. Note that you will not be able to do this until you have an addon named." )
                    IniWrite ( $sIni, $iniRun, "Display", 1 )
                EndIf
                $nmarr = IniReadSection ( $sIni, $name )
                If @error = 0 Then
                    _ArrayDisplay ( $nmarr, $sIni )
                    GUIDelete()
                    Settings()
                    ExitLoop
                Else
                    MsgBox ( 0, "WARNING", "No addons have been stated!" )
                    GUIDelete()
                    Settings()
                    ExitLoop
                EndIf
            Case $msg = $remove
                If IniRead ( $sIni, $iniRun, "Remove", 0 ) = 0 Then
                    MsgBox ( 0, "First Run", "Pressing 'Remove' allows you to make this program stop moving the last addon you entered. Note that you will not be able to do this until you have an addon named." )
                    IniWrite ( $sIni, $iniRun, "Remove", 1 )
                EndIf
                $array = IniReadSection ( $sIni, $file )
                If @error = 0 Then
                    GUIDelete()
                    RemoveSettings()
                    ExitLoop
                Else
                    MsgBox ( 0, "WARNING", "No addons have been stated!" )
                    GUIDelete()
                    Settings()
                    ExitLoop
                EndIf
            Case $msg = $mGUI
                GUIDelete()
                Runcheck()
                ExitLoop
        EndSelect
    WEnd
EndFunc

Func Input()
    Local $input, $btn, $ext, $disp, $msg, $read, $explode, $readex, $readfull, $j, $err
    Global $q, $string

    GUICreate ( "File Dropper", 340, 130, @DesktopWidth - 360, @DesktopHeight - 170, -1, 0x00000018 )
    $input = GUICtrlCreateInput ( "", 10, 60, 320, 20 )
    GUICtrlSetState ( -1, $GUI_DROPACCEPTED )
    $btn = GUICtrlCreateButton ( "Ok", 10, 90, 100, 30 )
    $disp = GUICtrlCreateButton ( "Show added", 120, 90, 100, 30 )
    $ext = GUICtrlCreateButton ( "Finish", 230, 90, 100, 30 )
    GUICtrlCreateLabel ( "  Drag and drop the addon files that you would like to REMOVE while" & @CRLF & "              using  the  'MIN'  profile.", 5, 5 )

    $msg = 0
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                GUIDelete()
                Settings()
                ExitLoop
            Case $msg = $btn
                $read = GUICtrlRead ( $input )
                For $j = 1 To $i - 1
                    $array = IniReadSection ( $sIni, $file )
                    If StringCompare ( $read, $array[$j][1] ) = 0 Then
                        $err = $err + 1
                    EndIf
                Next
                If FileExists ( $read ) Then
                    If StringInStr ( $read, "\garrysmod\garrysmod\addons\" ) = 0 Then
                        MsgBox ( 0, "ERROR", "This folder doesn't seem to be a valid Garry's Mod addon folder." )
                        GUIDelete()
                        Input()
                        ExitLoop
                    ElseIf $err = 0 Then
                        IniWrite ( $sIni, $file, $i, $read )
                        $explode = _StringExplode ( $read, "\" )
                        $readex = $explode[8]
                        IniWrite ( $sIni, $name, $i, $readex )
                        If IniRead ( $sIni, $file, "Dir", "" ) = "" Then
                            $readfull = $explode[0] & "\" & $explode[1] & "\" & $explode[2] & "\" & $explode[3] & "\" & $explode[4] & "\" & $explode[5]
                            IniWrite ( $sIni, "Dir", "Dir", $readfull )
                        EndIf
                        $i = $i + 1
                        GUIDelete()
                        Input()
                        ExitLoop
                    Else
                        MsgBox ( 0, "ERROR", "You have already entered that file." )
                        $j = $j - 1
                        GUIDelete()
                        Input()
                        ExitLoop
                    EndIf
                Else
                    MsgBox ( 0, "ERROR", "That is not a valid folder." )
                    GUIDelete()
                    Input()
                    ExitLoop
                EndIf
            Case $msg = $ext
                GUIDelete()
                Settings()
                ExitLoop
        EndSelect
    WEnd
EndFunc

Func Addisplay()
    Global $q, $string

    $nmarr = IniReadSection ( $sIni, $name )
        If @error = 0 Then
            For $q = 1 To $nmarr[0][0]
                $string = $string & $q & ").    " & $nmarr[$q][1] & @CRLF
            Next
            $string = ""
        Else
            $string = ""
        EndIf

Can anybody help me out?

Link to comment
Share on other sites

Check out the examples in the Wiki provided by Melba23, this should give some idea. Remember you can't mix GUIMsg() & EventMode, so choose which best suits your needs.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Unfortunately, I actually started my search there. While it did make sense to me, it is all based around pushing a button to open another GUI. I don't want to have to make the user of my program push a button to open something that should already be there. I tried to adapt that information to my needs, but I had no luck.

Is it possible for you to provide a more specific solution?

Link to comment
Share on other sites

Unfortunately, I actually started my search there. While it did make sense to me, it is all based around pushing a button to open another GUI. I don't want to have to make the user of my program push a button to open something that should already be there. I tried to adapt that information to my needs, but I had no luck.

Is it possible for you to provide a more specific solution?

You need to combine your two functions and have one message loop for both guis. You can't duplicate variable names in this case so I have renamed one $disp to $disp1.

If you need to know which window the message was from, eg which close button was pressed, then look up GuiGetMsg and use the advanced version.

If you keep the creation of each gui in a separate function then either you need to make sure that the controls have variable names which are global or you need to use event mode.

; *** Start added by AutoIt3Wrapper ***
#include <GUIConstantsEx.au3>
; *** End added by AutoIt3Wrapper ***
#AutoIt3Wrapper_Add_Constants=n
settings()
Func Settings()
    Local $add, $disp1, $remove, $msg, $mGUI, $mGUIn


    $mGUIn = "Continue"


    GUICreate("Settings", 160, 136)
    $add = GUICtrlCreateButton("Add", 5, 5, 150, 30)
    $disp1 = GUICtrlCreateButton("Display", 5, 37, 150, 30)
    $remove = GUICtrlCreateButton("Remove", 5, 69, 150, 30)
    $mGUI = GUICtrlCreateButton($mGUIn, 5, 101, 150, 30)
    GUISetState()

    Local $input, $btn, $ext, $disp, $msg, $read, $explode, $readex, $readfull, $j, $err
    Global $q, $string

    GUICreate("File Dropper", 340, 130, @DesktopWidth - 360, @DesktopHeight - 170, -1, 0x00000018)
    $input = GUICtrlCreateInput("", 10, 60, 320, 20)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    $btn = GUICtrlCreateButton("Ok", 10, 90, 100, 30)
    $disp = GUICtrlCreateButton("Show added", 120, 90, 100, 30)
    $ext = GUICtrlCreateButton("Finish", 230, 90, 100, 30)
    GUICtrlCreateLabel(" Drag and drop the addon files that you would like to REMOVE while" & @CRLF & "     using the 'MIN' profile.", 5, 5)

    GUISetState()


    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    GUIDelete()
    ExitLoop
    Case $msg = $add
    ConsoleWrite("$add press" & @CRLF)

    Case $msg = $disp1
    ConsoleWrite("$disp1 press" & @CRLF)

    Case $msg = $disp

    MsgBox(262144, "WARNING", "No addons have been stated!")


    Case $msg = $remove

    ConsoleWrite("$remove press" & @CRLF)

    Case $msg = $mGUI
    ConsoleWrite("$mGUI press" & @CRLF)
    Case $msg = $GUI_EVENT_CLOSE

    ExitLoop
    Case $msg = $btn
    ConsoleWrite("$btn press" & @CRLF)
    Case $msg = $ext

    ExitLoop
    EndSelect
    WEnd
EndFunc ;==>Settings
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanks! You actually interpreted my code wrong ;) But you certainly gave me the answer!

My next (and hopefully final :)) question is: can you make a GUI static, so you can't move it?

I will continue appreciating any help you guys give me.

You deserve a cookie, martin!

Link to comment
Share on other sites

  • Moderators

S1M1S,

can you make a GUI static, so you can't move it?

Just intercept SC_MOVE like this: ;)

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

Const $SC_MOVE = 0xF010

$hGUI_Move  = GUICreate("Movable GUI", 500, 500, 100, 100)
GUISetState()

$hGUI_Static = GUICreate("Immovable GUI", 500, 500, 200, 200)
GUISetState()

GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND")

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam)
    If $hWnd = $hGUI_Static Then
        If BitAND($wParam, 0x0000FFF0) = $SC_MOVE Then Return False
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc

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 Melba23! Cookies for everybody!

Here is part of my working script, showing how these things work, for all of you curious minds out there.

Global $i, $GUI1, $GUI2
#include <GUIConstantsEx.au3>
#include <Array.au3>
#include <String.au3>
#Include <File.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Const $SC_MOVE = 0xF010

Func Settings()
    Local $add, $disp, $remove, $msg, $mGUI, $mGUIn

    If IniRead ( $sIni, $iniRun, "Fin", 0 ) = 1 Then
        $mGUIn = "Back"
    Else
        $mGUIn = "Continue"
    EndIf

    GUICreate ( "Settings", 160, 136 )
    $add = GUICtrlCreateButton ( "Add", 5, 5, 150, 30 )
    $disp = GUICtrlCreateButton ( "Display", 5, 37, 150, 30 )
    $remove = GUICtrlCreateButton ( "Remove", 5, 69, 150, 30 )
    $mGUI = GUICtrlCreateButton ( $mGUIn, 5, 101, 150, 30 )
    GUISetState()

    If IniRead ( $sIni, $iniRun, "Settings", 0 ) = 0 Then
        MsgBox ( 0, "First Run", "This is the settings menu. This program creates profiles for Garry's Mod by moving the addons you choose out of the Addon folder and into AddonStore, inside your Garry's Mod install." )
        MsgBox ( 0, "First Run", "Close this window and press 'Add' to choose the addons you would like to remove from the game while playing in the performance profile." )
        IniWrite ( $sIni, $iniRun, "Settings", 1 )
    EndIf

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                If IniRead ( $sIni, $iniRun, "Fin", 0 ) = 1 Then
                    GUIDelete()
                    MGUI()
                Else
                    GUIDelete()
                EndIf
                ExitLoop
            Case $msg = $add
                If IniRead ( $sIni, $iniRun, "Add", 0 ) = 0 Then
                MsgBox ( 0, "First Run", "Pressing 'Add' allows you to customize your profiles. Navigate to 'garrysmod/garrysmod/addons' and drag and drop the addon folders you would like to remove while using the performance profile onto the window." & @CRLF & @CRLF & "You can change these at any time." )
                IniWrite ( $sIni, $iniRun, "Add", 1 )
                EndIf
                $array = IniReadSection ( $sIni, $file )
                If @error = 0 Then
                    $i = $array[0][0] + 1
                    GUIDelete()
                    Input()
                    ExitLoop
                Else
                    $i = 1
                    GUIDelete()
                    Input()
                    ExitLoop
                EndIf
            Case $msg = $disp
                If IniRead ( $sIni, $iniRun, "Display", 0 ) = 0 Then
                    MsgBox ( 0, "First Run", "Pressing 'Display' shows you what addons the program will move. Note that you will not be able to do this until you have an addon named." )
                    IniWrite ( $sIni, $iniRun, "Display", 1 )
                EndIf
                $nmarr = IniReadSection ( $sIni, $name )
                If @error = 0 Then
                    _ArrayDisplay ( $nmarr, $sIni )
                    GUIDelete()
                    Settings()
                    ExitLoop
                Else
                    MsgBox ( 0, "WARNING", "No addons have been stated!" )
                    GUIDelete()
                    Settings()
                    ExitLoop
                EndIf
            Case $msg = $remove
                If IniRead ( $sIni, $iniRun, "Remove", 0 ) = 0 Then
                    MsgBox ( 0, "First Run", "Pressing 'Remove' allows you to make this program stop moving the last addon you entered. Note that you will not be able to do this until you have an addon named." )
                    IniWrite ( $sIni, $iniRun, "Remove", 1 )
                EndIf
                $array = IniReadSection ( $sIni, $file )
                If @error = 0 Then
                    GUIDelete()
                    RemoveSettings()
                    ExitLoop
                Else
                    MsgBox ( 0, "WARNING", "No addons have been stated!" )
                    GUIDelete()
                    Settings()
                    ExitLoop
                EndIf
            Case $msg = $mGUI
                GUIDelete()
                Runcheck()
                ExitLoop
        EndSelect
    WEnd
EndFunc

Func Input()

    Local $string, $q

    $nmarr = IniReadSection ( $sIni, $name )
    If @error = 0 Then
        For $q = 1 To $nmarr[0][0]
            $string = $string & $q & ").   " & $nmarr[$q][1] & @CRLF
        Next
    Else
        $string = ""
    EndIf


    $GUI2 = GUICreate ( "Addons", 340, $q * 13, @DesktopWidth - 360, @DesktopHeight - ( 200 + $q * 13 ), -1, 0x00000008 )
    GUICtrlCreateLabel ( $string, 5, 5 )

    GUISetState()

    Local $input, $btn, $ext, $disp, $msg, $read, $explode, $readex, $readfull, $j, $err

    $GUI1 = GUICreate ( "File Dropper", 340, 130, @DesktopWidth - 360, @DesktopHeight - 170, -1, 0x00000018 )
    $input = GUICtrlCreateInput ( "", 10, 60, 320, 20 )
    GUICtrlSetState ( -1, $GUI_DROPACCEPTED )
    $btn = GUICtrlCreateButton ( "Ok", 10, 90, 155, 30 )
    $ext = GUICtrlCreateButton ( "Finish", 175, 90, 155, 30 )
    GUICtrlCreateLabel ( "  Drag and drop the addon files that you would like to REMOVE while" & @CRLF & "              using  the  'MIN'  profile.", 5, 5 )

    GUISetState ()

    GUIRegisterMsg ( $WM_SYSCOMMAND, "WM_SYSCOMMAND" )

    $msg = 0
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                GUIDelete()
                GUIDelete()
                Settings()
                ExitLoop
            Case $msg = $btn
                $read = GUICtrlRead ( $input )
                For $j = 1 To $i - 1
                    $array = IniReadSection ( $sIni, $file )
                    If StringCompare ( $read, $array[$j][1] ) = 0 Then
                        $err = $err + 1
                    EndIf
                Next
                If FileExists ( $read ) Then
                    If StringInStr ( $read, "\garrysmod\garrysmod\addons\" ) = 0 Then
                        MsgBox ( 0, "ERROR", "This folder doesn't seem to be a valid Garry's Mod addon folder." )
                        GUIDelete()
                        GUIDelete()
                        Input()
                        ExitLoop
                    ElseIf $err = 0 Then
                        IniWrite ( $sIni, $file, $i, $read )
                        $explode = _StringExplode ( $read, "\" )
                        $readex = $explode[8]
                        IniWrite ( $sIni, $name, $i, $readex )
                        If IniRead ( $sIni, $file, "Dir", "" ) = "" Then
                            $readfull = $explode[0] & "\" & $explode[1] & "\" & $explode[2] & "\" & $explode[3] & "\" & $explode[4] & "\" & $explode[5]
                            IniWrite ( $sIni, "Dir", "Dir", $readfull )
                        EndIf
                        $i = $i + 1
                        GUIDelete()
                        GUIDelete()
                        Input()
                        ExitLoop
                    Else
                        MsgBox ( 0, "ERROR", "You have already entered that file." )
                        $j = $j - 1
                        GUIDelete()
                        GUIDelete()
                        Input()
                        ExitLoop
                    EndIf
                Else
                    MsgBox ( 0, "ERROR", "That is not a valid folder." )
                    GUIDelete()
                    GUIDelete()
                    Input()
                    ExitLoop
                EndIf
            Case $msg = $ext
                GUIDelete()
                GUIDelete()
                Settings()
                ExitLoop
        EndSelect
    WEnd
EndFunc

Func WM_SYSCOMMAND ( $hWnd, $Msg, $wParam, $lParam )
    If $hWnd = $GUI1 Then
        If BitAND($wParam, 0x0000FFF0) = $SC_MOVE Then Return False
    EndIf

    If $hWnd = $GUI2 Then
        If BitAND($wParam, 0x0000FFF0) = $SC_MOVE Then Return False
    EndIf

    Return $GUI_RUNDEFMSG
EndFunc
Link to comment
Share on other sites

Argh! Wait, I have one more question! Is it possible to have a dynamic number of GUI controls? Like, have a certain amount of checkboxes for each item in an array? If so, how would I get information from these dynamic controls?

Example: Say there are 15 items in an .ini file. There would then be 15 checkboxes for each item, and selecting a checkbox, then pressing 'ok' would delete those files out of the .ini (that's basically what I want to happen...)

Thanks in advance!

Link to comment
Share on other sites

  • Moderators

S1M1S,

Is it possible to have a dynamic number of GUI controls

Just use an array to hold the returned ControlIDs - size of array = number of controls. ;)

how would I get information from these dynamic controls?

Use a For...Next loop to run through the ControlIDs in the array. :)

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 can understand where you're coming from, but I don't quite get it...

The only thing I don't understand is how you would create these controls... Would you use a For-Next loop or something else? If it isn't too much trouble, could you please give me an example?

I realize I'm asking for a lot here ;)

Link to comment
Share on other sites

  • Moderators

S1M1S,

I realize I'm asking for a lot here

As Sir Percy Ware-Armitage said to Courtney: "Do not expect treats like this every day!". ;)

#include <GUIConstantsEx.au3>

Global $aButtons[5]

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

For $i = 0 To 4
    $aButtons[$i] = GUICtrlCreateButton("Button " & $i, 10, (40 * $i) + 10, 80, 30)
Next

GUISetState()

While 1

    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

    For $i = $aButtons[0] To $aButtons[4]
        If $i = $iMsg Then
            MsgBox(0, "Pressed", "You pressed Button " & $i - $aButtons[0])
            ExitLoop
        EndIf
    Next

WEnd

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

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...