Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

[SOLVED] GUI Resize method?

GUI Resize

  • Please log in to reply
9 replies to this topic

#1 johnmcloud

johnmcloud

    Not an AutoIt MVPs (MVP)

  • Active Members
  • PipPipPipPipPipPip
  • 667 posts

Posted 13 March 2012 - 09:39 AM

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, 13 March 2012 - 05:01 PM.








#2 rcmaehl

rcmaehl

    No where near a noob nor a pro coder.

  • Active Members
  • PipPipPipPipPipPip
  • 672 posts

Posted 13 March 2012 - 12:28 PM

Unless I misunderstood, try this:

GUICtrlSetResizing($Control,136)

Making dumb decisions and posting without thinking since August 7, 2011. Jury-rigging AutoIt to work how I want successfully since a while.

 

Current Projects:

IRC UDF, for IRC activities

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


#3 johnmcloud

johnmcloud

    Not an AutoIt MVPs (MVP)

  • Active Members
  • PipPipPipPipPipPip
  • 667 posts

Posted 13 March 2012 - 01:53 PM

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, 13 March 2012 - 01:54 PM.


#4 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,037 posts

Posted 13 March 2012 - 02:12 PM

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 an XP machine, 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!

 

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 editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

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.


#5 johnmcloud

johnmcloud

    Not an AutoIt MVPs (MVP)

  • Active Members
  • PipPipPipPipPipPip
  • 667 posts

Posted 13 March 2012 - 02:21 PM

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?

#6 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,037 posts

Posted 13 March 2012 - 02:30 PM

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 an XP machine, 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!

 

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 editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

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.


#7 UEZ

UEZ

    Never say never

  • MVPs
  • 4,817 posts

Posted 13 March 2012 - 02:33 PM

Try this:

AutoIt         
;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, 13 March 2012 - 02:50 PM.

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


#8 johnmcloud

johnmcloud

    Not an AutoIt MVPs (MVP)

  • Active Members
  • PipPipPipPipPipPip
  • 667 posts

Posted 13 March 2012 - 02:42 PM

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, 13 March 2012 - 02:44 PM.


#9 UEZ

UEZ

    Never say never

  • MVPs
  • 4,817 posts

Posted 13 March 2012 - 02:53 PM

$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

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


#10 johnmcloud

johnmcloud

    Not an AutoIt MVPs (MVP)

  • Active Members
  • PipPipPipPipPipPip
  • 667 posts

Posted 13 March 2012 - 03:00 PM

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, 13 March 2012 - 05:01 PM.






Also tagged with one or more of these keywords: GUI, Resize

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users