Sign in to follow this  
Followers 0

[SOLVED] GUI Resize method?


10 posts in this topic

#1 ·  Posted (edited)

Hi guys,

With GUICreate, when set H and W, it start from bottom-right for resize the GUI.

If i want to resize the four side starting from the center? So the four side it will be resize in the same way.

Hope i was clear, if i wasn't i'll do some screen :oops:

Thanks for support

Edited by johnmcloud

Share this post


Link to post
Share on other sites



#2 ·  Posted

Unless I misunderstood, try this:

GUICtrlSetResizing($Control,136)

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

Current Projects:

IRC UDF, for IRC activities

[u]SafeExecute[/u], for picking and choosing what commands you want Execute to be able to run.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

See equal to the normal version.

I'll do an example:

This is a gui with 243, 170, -1, -1:

Posted Image

Now is 150, 120, -1, -1:

Posted Image

As you can see, it resize from botton-right. I want a risize equal to every side, like a "Scale", not like the image.

I want a resize like this:

Posted Image

Not this:

Posted Image

I don't know how to explain better :oops:

Thanks

Edited by johnmcloud

Share this post


Link to post
Share on other sites

#4 ·  Posted

Try this to see if it's doing what you're asking:

#include <GUIConstants.au3>
#include <WindowsConstants.au3>

#region - GUI Create
$GUI = GUICreate('Test', 243, 170, -1, -1, BitOR($WS_THICKFRAME, $GUI_SS_DEFAULT_GUI))
GUICtrlCreateGroup("GROUP 1", 10, 10, 223, 150)
GUICtrlSetResizing(-1, 1)
GUICtrlCreateButton("TEST", 30, 30)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE)

GUISetState()
#endregion - GUI Create

#region - GUI SelectLoop
While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd
#endregion - GUI SelectLoop
Func _Exit()
    Exit
EndFunc

This demonstrates what rcmaehl was saying earlier.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#5 ·  Posted

mmm not :oops:

Posted Image

A side-question: My GUI is always "on top", also if another windows is on it. How to make the gui in a second place?

Share this post


Link to post
Share on other sites

#6 ·  Posted

That script will in no way, shape, or form ever give you what you're showing in your picture on a properly operating computer. If that's what you're getting then either you changed the script or your computer is working weirdly. I ran that script on Windows XP x86, and Windows 7 x64 and x86, I also tried it on AutoIt versions 3.3.6.1, 3.3.8.1, beta 3.3.9.1 and none of them showed that behavior.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Try this:

;coded by UEZ
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global Const $hGUI = GUICreate("Proportional Scale", 243, 170, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_THICKFRAME))
Global Const $idGroup = GUICtrlCreateGroup("Group1", 16, 8, 215, 150)
Global Const $idButton = GUICtrlCreateButton("Test", 50, 50, 50, 30)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP))
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

Global $aWS = WinGetPos($hGUI)
Global Const $ratio = $aWS[3] / $aWS[2]
Global Const $minSize = Int($aWS[2] * 0.75)
Global Const $maxSize = Int($aWS[2] * 2)

GUIRegisterMsg($WM_SIZING, "WM_SIZING")
GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

Global $nMsg

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIRegisterMsg($WM_SIZING, "")
            GUIRegisterMsg($WM_GETMINMAXINFO, "")
            GUIDelete($hGUI)
            Exit
    EndSwitch
WEnd

Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
    Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($minmaxinfo, 7, $minSize) ; min X
    DllStructSetData($minmaxinfo, 8, $minSize) ; min Y
    DllStructSetData($minmaxinfo, 9, $maxSize) ; max X
    DllStructSetData($minmaxinfo, 10, $maxSize) ; max Y
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_GETMINMAXINFO

Func WM_SIZING($hWnd, $iMsg, $wParam, $lParam)
    Local $sRect = DllStructCreate("Int[4]", $lParam)
    Local $left = DllStructGetData($sRect, 1, 1)
    Local $top = DllStructGetData($sRect, 1, 2)
    Local $right = DllStructGetData($sRect, 1, 3)
    Local $bottom = DllStructGetData($sRect, 1, 4)

    Switch $wParam ;drag side or corner
        Case 1, 2, 4, 7
            $iNewY = Int(($right - $left) * $ratio)
            DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 2) + $iNewY, 4)
        Case Else
            $iNewX = Int(($bottom - $top) / $ratio)
            DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 1) + $iNewX, 3)
    EndSwitch
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_SIZING

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I'm testing both and work. The BrewManNH's script not work before because i have manually edit the value of the GUI ( was my first intention, scale in base at the value of the GUI). I think its a better result your script. Thanks also to UEZ, it's a perfect scale :oops:

My last problem, why this GUI is "always at top"?:

$GUIHeight = 25
$GUIWidth = 50

$GUI_1 = GUICreate("", $GUIWidth, $GUIHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED, $WS_EX_TOOLWINDOW)
;~ GUISetBkColor(0xABCDEF)
$Area_GUI_1 = GUICtrlCreateLabel("", 0, 0, $GUIWidth, $GUIHeight)
_WinAPI_SetLayeredWindowAttributes($GUI_1, 0xABCDEF, 255)
GUISetState()

How to remove?

Edited by johnmcloud

Share this post


Link to post
Share on other sites

#9 ·  Posted

$GUI_1 = GUICreate("", $GUIWidth, $GUIHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED, $WS_EX_TOOLWINDOW)

is wrong because of the last parameter you set! $WS_EX_TOOLWINDOW is set as parent parameter!

Try instead:

$GUI_1 = GUICreate("", $GUIWidth, $GUIHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOOLWINDOW)

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

UEZ, same problem. I'll post all the script:

EDIT: Maybe better open a new thread for this. Thanks to all :oops:

Edited by johnmcloud

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