Sign in to follow this  
Followers 0
johnmcloud

[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



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.

MY PROJECTS


Active: IRC UDF
Discontinued: GithubBubbleSort UDF

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

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

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

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!

Selection of finest graphical examples at Codepen.io

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

$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!

Selection of finest graphical examples at Codepen.io

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

  • Similar Content

    • algiuxas
      GUI Show/Hide Cursor [SOLVED]
      By algiuxas
      Hello,
      I want that when mouse cursor is in GUI, cursor would hide, and when cursor is outside GUI it would appear again.

      (Sorry for my bad English)
    • Tirk
      How can I move a GUI wiindow
      By Tirk
      How can I move a GUI window? How can I adjust the gui's position (coordinates) ?
      ... When I click to the green four-way arrow and move the mouse --> move the gui window.

    • PINTO1927
      png with background transparent into gui without border
      By PINTO1927
      Hi guys, I would like to make a gui borderless viewing a png image with transparent background.
       
      pretty much has to be visible only the png image with no background..you have any simple example?
      Thank's
      GUICtrlCreatePic  
      still it provides the image with the background...
    • OldGuyWalking
      Identifying Button in Toolbar When There is no ControID
      By OldGuyWalking
      I want to click on a button that is inside a custom ToolBar on a nonAutoIT created form.  I've been using MouseClick but that fails if the toolbar is detached or if the form is resized.
      There is no ID associated with the toolbar but there is a handle.  I'm thinking that to get the handle I need a ControlID but that only gets me to the toolbar and I'd then need to have a way to identify the position of a button in order to click on it.  
      I'd found a discussion about identifying the position of a noname button by, I believe, it's Tip text back in December but I can't find it now.  Memory is a bit fuzzy on how I even got to the topic because at the time I was searching for something else.   I'll continue to search but if anyone has seen the topic, or knows of another solution could you please point me in that direction. 
      Thank you.
    • rootx
      Best way to play little video inside a Gui
      By rootx
      I would like to insert a video player inside the gui Autoit, preferably one with a free license such as Media Player Classic or VLC, I saw in the forum but I found examples of many years ago.
      Some examples links or advice would be much help