Sign in to follow this  
Followers 0
joedoe

Changing a Gui Size after is has been created

4 posts in this topic

#1 ·  Posted (edited)

I am working on a download manager and want to make the main GUI longer (Height) each time you download another file. How can I change the GUI size to be a variable that I can add or subtract from depening on how many downloads I have going? Is it even possible?

This is the code I have so far, right now a download opens a new GUI window, but then I can not start a new download until the first has finnished, I want to put the information from that gui into the extended portion of the new GUI.

Dim $Label_2, $FileSize, $Save, $FileType, $URL, $Button_4
$FileSize = 0

#region --- GuiBuilder code Start --- ; main window
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

;Gui I want to edit size of
$Gui = GuiCreate("Ultra Easy Downloader", 400, 105,-1, -1 );, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Group_1 = GuiCtrlCreateGroup("Download File", 10, 10, 380, 80)
$Input_2 = GuiCtrlCreateInput("Http://", 20, 30, 360, 20)
$Button_3 = GuiCtrlCreateButton("Download File", 20, 60, 80, 20)
;$Button_4 = GuiCtrlCreateButton("Exit", 110, 60, 80, 20)
$Label_5 = GuiCtrlCreateLabel($FileSize & " Bytes", 110, 65, 110, 20)
$Button_6 = GuiCtrlCreateButton("Check File Size", 260, 60, 120, 20)

GuiSetState()
MainGuiWindow()

Func MainGuiWindow()
While 1
    $msg3 = GuiGetMsg()
    Select
        ;Check File Size
        Case $msg3 = $Button_6
            $URL = GUICtrlRead($Input_2)
            $FileSize = InetGetSize($URL)
            GUICtrlSetData( $Label_5, $FileSize & " Bytes")
        ;Download File
        Case $msg3 = $Button_3
            $URL = GUICtrlRead($Input_2)
            ;Select Download Location
            $Save = FileSaveDialog("File Download Location", "::{450D8FBA-AD25-11D0-98A8-0800361B1103}", "View all Files(*.*)")
            ;Verify Download location was selected
            If @error <> 1 Then
                If $Save <> "" Then
                    ;Get File type from last 4 digits of URL
                $FileType = StringRight($URL, 4)
                ;Download File
                DownloadFunc()
            
                
                Else
                MsgBox(16, "Download Error", "No File Name!")
                EndIf
            Else
            ;;;
            EndIf
;       Case $msg3 = $Button_4
;           ExitLoop
        Case $msg3 = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
            ;;;
    EndSelect
WEnd

Exit

EndFunc
#endregion --- GuiBuilder generated code End ---

Func DownloadFunc()
    #region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>


$MoniterGui = GuiCreate("Download Status for:" & $Save & $FileType, 260, 100,-1, -1 );, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Group_1 = GuiCtrlCreateGroup("Download Status", 10, 10, 240, 80)
$Label_2 = GuiCtrlCreateLabel("Totals Bytes:" & $FileSize, 20, 30, 90, 20)
;$Progress_3 = GuiCtrlCreateProgress(20, 50, 230, 20)
$Label_7 = GUICtrlCreateLabel("Download Status Unkown", 20, 50, 220, 20);$FileDownloaded & "/" & $FileSize
;$Button_4 = GuiCtrlCreateButton("Cancel Download", 20, 80, 120, 20)
;$Button_5 = GuiCtrlCreateButton("Hide Window", 140, 80, 120, 20)

$FileSize = InetGetSize($URL)
InetGet($URL, $Save & $FileType, 1, 1)

GuiSetState()
While 1
    $msg2 = GuiGetMsg()
    Select
    Case $msg2 = $GUI_EVENT_CLOSE
        GUIDelete($MoniterGui)
        MainGuiWindow()
    Case Else
        ;;;
    EndSelect
    $FileDownloaded = FileGetSize($Save & $FileType)
    If $FileDownloaded = $FileSize Then
        GUICtrlSetData($Label_7, $FileDownloaded & "/" & $FileSize)
        MsgBox(0, "Download", "Download Complete")
        GUIDelete($MoniterGui)
        MainGuiWindow()
    Else
        GUICtrlSetData($Label_7, $FileDownloaded & "/" & $FileSize)
        Sleep(100)
    EndIf
;   ProgressSet($FilePrecent)
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

    
EndFunc

Code Copyright 2006 Blue Vulcan Programing

Edited to add copyright

Edited by joedoe

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

from help

WinMove Moves and/or resizes a window.

Thanks, that is just what I need, that was so obvios I missed it! I thought it would be some GUICTRLSETDATA like thing that I just couldn't find, this is much easier.

Thank you

Edited for Spelling

Edited by joedoe

Share this post


Link to post
Share on other sites

Welcome

8)


NEWHeader1.png

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