Sign in to follow this  
Followers 0
Ghost21

Resize GUI on the fly

4 posts in this topic

I'm trying to get my GUI to work correctley. When I move it from one screen size of 1280x1024 to a screen 1024x768 or smaller the gui doesn't fit.

I have a main image up front or the top layer then buttons hidden behind that then the form below that.

The problem is that I want to beable to resize the GUI with the picture and the buttons so they all scale at the same rate ? or have it auto resize to whatever screen its on ??

Share this post


Link to post
Share on other sites



Ghost21,

Welcome to the wonderful world of GUICtrlSetResizing. I will "leave the joy of discovery to you"*! ;)

M23

* {c} 2010 enaiman


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 the GUI with sizes relative to the desktop size and then do as M23 suggested.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Hi Ghost21 -- here is a small example (that I used for a different post yesterday) that resizes the way that you want:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIResizeMode", $GUI_DOCKAUTO)

#Region ### START Koda GUI section ### Form=
$Form1_ID = GUICreate("Win_Title", 1012, 200, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME))
GUISetFont(10, 400, 0, "MS Sans Serif")
$btn_Now_ID = GUICtrlCreateButton("Now", 16, 24, 57, 24)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$date_From_ID = GUICtrlCreateDate("2010/10/24 19:45:1", 152, 8, 185, 21)
GUICtrlSetFont(-1, 9, 400, 0, "Courier")
$date_To_ID = GUICtrlCreateDate("2010/10/24 19:45:1", 152, 40, 185, 21)
GUICtrlSetFont(-1, 9, 400, 0, "Courier")
$inp_SpanHHmm_ID = GUICtrlCreateInput("", 424, 8, 81, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
GUICtrlSetFont(-1, 12, 400, 0, "Courier")
$inp_SpanMinutes_ID = GUICtrlCreateInput("", 424, 40, 81, 24)
GUICtrlSetFont(-1, 12, 400, 0, "Courier")
$cbo_Channel_ID = GUICtrlCreateCombo("", 642, 8, 207, 25)
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 12, 400, 0, "Courier")
$btn_Clear_TVShow_Filename_ID = GUICtrlCreateButton("Clear", 17, 80, 57, 24)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$txt_TVShow_Filename_ID = GUICtrlCreateEdit("", 152, 72, 841, 48)
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 10, 400, 0, "Courier")

$lbl_Start_ID = GUICtrlCreateLabel("Start", 94, 8, 39, 23)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_Stop_ID = GUICtrlCreateLabel("Stop", 94, 40, 38, 23)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_HHmm_ID = GUICtrlCreateLabel("HH:mm", 352, 8, 63, 23)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_Minutes_ID = GUICtrlCreateLabel("Minutes", 351, 40, 63, 23)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_Channel_ID = GUICtrlCreateLabel("Channel", 560, 8, 71, 23)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_File_xxx_ID = GUICtrlCreateLabel("File -", 94, 72, 55, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_xxx_Name_ID = GUICtrlCreateLabel("Name", 94, 90, 55, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_Device = GUICtrlCreateLabel("Device", 560, 40, 71, 23)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")

; ????????????????????
; These Radio Buttons act as a "group" (only one selected at a time, etc.),
; even though there is no GUICtrlCreateGroup() or GUIStartGroup()...
; ????????????????????
;GUIStartGroup()
$rad_PVR = GUICtrlCreateRadio("PVR", 640, 40, 49, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$rad_VCR = GUICtrlCreateRadio("VCR", 704, 40, 49, 17)
$rad_DVR = GUICtrlCreateRadio("DVR", 768, 40, 49, 17)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
 Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    Case $Form1_ID
        Case $btn_Now_ID
        Case $date_From_ID
        Case $date_To_ID
        Case $inp_SpanHHmm_ID
        Case $inp_SpanMinutes_ID
        Case $cbo_Channel_ID
        Case $btn_Clear_TVShow_Filename_ID
 Case $txt_TVShow_Filename_ID

        Case $rad_PVR
        MsgBox( 0, "Event", "$rad_PVR", 1)
        Case $rad_VCR
        MsgBox( 0, "Event", "$rad_VCR", 1)
        Case $rad_DVR
        MsgBox( 0, "Event", "$rad_DVR", 1)
    EndSwitch
WEnd

The two main things are the:

Opt("GUIResizeMode", $GUI_DOCKAUTO)

... and the $WS_SIZEBOX and $WS_THICKFRAME properties on the GUICreate():

$Form1_ID = GUICreate("Win_Title", 1012, 200, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME))

HTH,

CBruce

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