Sign in to follow this  
Followers 0
ppat

Increas height of GUI without altering controls in it.

6 posts in this topic

I would like to increase the height of a GUI without touching the controls in the GUI. Here is my code:

#include <GuiConstants.au3>


GuiCreate("Countdown", 400, 89)
GuiSetIcon("C:\WINDOWS\system32\cmd.exe", 0)

; GROUP WITH RADIO BUTTONS
GuiCtrlCreateGroup("Shutdown ", 10, 9,100,70)
$shutdown_yes = GuiCtrlCreateRadio("Yes", 30, 29,  40)
GuiCtrlSetState($shutdown_yes, $GUI_CHECKED)
$shutdown_no = GuiCtrlCreateRadio("No", 30, 49,  40)
; Progress bar
$progress = GuiCtrlCreateProgress(120, 29, 270, 20)
GuiCtrlSetData($progress, 100)
GUISetState(@SW_SHOW) 

MsgBox(0,"Start", "Look at the GUI!")
increase_GUI_height("Countdown",100)
MsgBox(0,"The end", "Did you see how awful the GUI now looks?")

Func increase_GUI_height($current_GUI_title, $delta_height)
    
    $nb_steps = 70
    $resize_time_ms = 200
    $micro_delta_height = $delta_height/$nb_steps 
    $size = WinGetPos($current_GUI_title)   
    $new_height = $size[3]
    $sleep_ms = $resize_time_ms / $nb_steps
    
; Increase the height of the GUI Window by small steps
    For $i = $nb_steps to 1 Step -1
        $new_height += $micro_delta_height
        WinMove($current_GUI_title, "", Default, Default, Default,  $new_height)
        Sleep($sleep_ms)    
    Next
        
EndFunc

I would like the result to be the same as if I had declared GuiCreate("Countdown", 400, 189) (189 = initial 89 + added 100) in the first place. However the result shows distorted controls in the GUI. How can I avoid this?

Share this post


Link to post
Share on other sites



ppat,

Look at GUICtrlSetResizing in the Help file.

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

#3 ·  Posted (edited)

Hi,

the default value of the AutoIt option GUIResizeMode is 0.

If you place this in your code controls will not move and not resize:

Opt("GUIResizeMode", $GUI_DOCKALL)

$GUI_DOCKALL = 802

but is also defined in

#include <GUIConstantsEx.au3>

or ( not sure )

#include <WindowsConstants.au3>

Edited by Manadar

Share this post


Link to post
Share on other sites

Manadar,

Thank you for that. Always happy to learn something new everyday! That wonderful Help file is TOO big sometimes....

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

Manadar, thanks,

#include <GuiConstants.au3>

Opt("GUIResizeMode", $GUI_DOCKALL)

does the trick.

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