Jump to content

Recommended Posts

This might be easy an easy question but pls bear with me.

Why does the group and button i make scales with the GUI when resized ?

Global $hGUI = GUICreate("Test", 300,300)


GUICtrlCreateGroup(" Sample Group ", 10, 10, 280, 50)
GUICtrlCreateGroup(" Sample group ", 10, 70, 280, 100)
$Button1 = GUICtrlCreateButton("Browse", 40, 100, 65, 17)
GUICtrlCreateGroup(" Sample group ", 10, 190, 280, 100)



GUICtrlCreateGroup("", -99, -99, 1, 1)


GUISetState(@SW_SHOW)

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


        Case $Button1
    ;      MsgBox(4096, "File:", "Button Clicked")
           ExpandGUI()


    EndSwitch
 WEnd

Func ExpandGUI()

  Local $GuiPosition = WinGetPos($hGUI) ; Get the GUI coördinates
   WinMove($hGUI, "", $GuiPosition[0], $GuiPosition[1], $GuiPosition[2], $GuiPosition[3] + 50)

EndFunc

This is a sample i created to understand the Winmove more

Share this post


Link to post
Share on other sites

It would be nice even if the Gui followed the scales of the resolution or when using winmove but unfortunately it is not so, to minimize the problem I created a script that automatically resizes according to the resolution but the size of the font is not proportional sometimes but in most times works well.

; =========================================
; Autoit3 3.3.9.4
; Date: 10/12/17
; Autor: Belini
; Function: Resize Gui to other resolutions
; =========================================

; Use "W" for horizontal coordinate or length
; Use "H" for vertical coordinate or height
; Use "F" for font size

$Res_W_Original = 1440; Informs here the horizontal resolution in which the gui was made
$Res_H_Original = 900; Informs here the vertical resolution in which the gui was made
$Res_W_Current = @DesktopWidth; Desktop Horizontal Resolution
$Res_H_Current = @DesktopHeight; Desktop Vertical Resolution


#region ### START Koda GUI section ### Form
$Form1 = GUICreate("Example Auto Size", Auto_size(446, "W"), Auto_size(476, "H"), -1, -1)

$Edit1 = GUICtrlCreateEdit("", Auto_size(8, "W"), Auto_size(8, "H"), Auto_size(433, "W"), Auto_size(385, "H"))
GUICtrlSetBkColor(-1, 0x000000)

$Group1 = GUICtrlCreateGroup("Command", Auto_size(8, "W"), Auto_size(400, "H"), Auto_size(433, "W"), Auto_size(67, "H"))
GUICtrlSetFont(-1, Auto_size(10, "F"), 400, 0, "MS Sans Serif")

$Input1 = GUICtrlCreateInput("", Auto_size(16, "W"), Auto_size(423, "H"), Auto_size(337, "W"), Auto_size(29, "H"))

$Button1 = GUICtrlCreateButton("Send", Auto_size(356, "W"), Auto_size(424, "H"), Auto_size(75, "W"), Auto_size(30, "H"))
GUICtrlSetFont(-1, Auto_size(12, "F"), 400, 0, "MS Sans Serif")

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

While 1
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
WEnd

Func Auto_size($value = 0, $opt = "W")
    Local $result
    Switch $opt
        Case "W"
            If $value = -1 Then
                $result = -1
            Else
                $result = $Res_W_Original / $value
                $result = $Res_W_Current / $result
            EndIf
        Case "H"
            If $value = -1 Then
                $result = -1
            Else
                $result = $Res_H_Original / $value
                $result = $Res_H_Current / $result
            EndIf
        Case "F"
            If $value = -1 Then
                $result = -1
            Else
                $result = $Res_H_Current / $Res_H_Original
                $result = $value * $result
            EndIf
    EndSwitch
    Return $result
EndFunc   ;==>Auto_size

 

Share this post


Link to post
Share on other sites
Posted (edited)

There are all kinds of docking settings you can use as well

GUICtrlSetResizing

Maybe you want the left position static despite a resizing the horizontal aspect of the GUI...set the control to include 

 

$GUI_DOCKLEFT

Or you have a control at the bottom of the gui, that you always want to be at the bottom of the gui when you do a vertical resize...

 

$GUI_DOCKBOTTOM
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
Posted (edited)

try koda if you have scite installed, press alt+m there you can create buttons, labels etc. and lock them to the  top left or where ever you want, or even resize with the gui, then you can run the form with f10, test , close adjust, F10 and test again, until you have the flags that work for you, then copy the flags to your button, label or any other control

Edited by jvds

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

×
×
  • Create New...