hlstriker Posted May 4, 2007 Share Posted May 4, 2007 Hi, when using WinMove() to resize the window it will stretch all objects to fit in the stretched window. How can I make it so the objects don't stretch when I make the window bigger? The best Honda forums!RuneScape High Alching for Profit! Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 4, 2007 Share Posted May 4, 2007 Hi, when using WinMove() to resize the window it will stretch all objects to fit in the stretched window. How can I make it so the objects don't stretch when I make the window bigger? Huh! It certainly does! I expected that to be only graphic controls and the others to stay put, but it's the exact opposite! Demo: #include <guiconstants.au3> ; Create GUI $hGui = GUICreate("Rubber GUI Test", 400, 230, 200, 200) GUICtrlCreateLabel("Some sample controls:", 10, 10, 200, 20) GUICtrlCreateInput("", 10, 40, 150, 20) GUICtrlCreateGraphic(10, 70, 380, 110) GUICtrlSetBkColor(-1, 0xffffff) GUICtrlSetColor(-1, 0) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff0000, 0xff0000) GUICtrlSetGraphic(-1, $GUI_GR_PIE, 50, 50, 40, 30, 270) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00ff00, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_PIE, 58, 50, 40, -60, 90) $Quit = GUICtrlCreateButton("QUIT", 175, 190, 50, 30) GUISetState() Global $WinPos = 0 Global $Time = TimerInit() While 1 If GUIGetMsg() = $Quit Then Exit If TimerDiff($Time) > 3000 Then _ToggleWinPos() Sleep(20) WEnd Func _ToggleWinPos() $Time = TimerInit() $WinPos = Not $WinPos If $WinPos Then WinMove("Rubber GUI Test", "", 200, 200, 600, 400) Else WinMove("Rubber GUI Test", "", 200, 200, 400, 230) EndIf EndFunc ;==>_ToggleWinPos Interesting... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
hlstriker Posted May 4, 2007 Author Share Posted May 4, 2007 Is this not possible to do then? Each time I try the resize the window grows larger, but the objects still expand to fit the window. I need the objects to stay the same size they were before the window was expanded The best Honda forums!RuneScape High Alching for Profit! Link to comment Share on other sites More sharing options...
daslick Posted May 4, 2007 Share Posted May 4, 2007 I had the same problem, I researched it and ended up giving up and making a separate gui ... I'll check back to see if you found a solution! GOOD LUCK Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 4, 2007 Share Posted May 4, 2007 It's not any better when you Maximize/Normalize the window: #include <guiconstants.au3> ; Create GUI $hGui = GUICreate("Rubber GUI Test", 400, 230, 200, 200) GUICtrlCreateLabel("Some sample controls:", 10, 10, 200, 20) GUICtrlCreateInput("", 10, 40, 150, 20) GUICtrlCreateGraphic(10, 70, 380, 110) GUICtrlSetBkColor(-1, 0xffffff) GUICtrlSetColor(-1, 0) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff0000, 0xff0000) GUICtrlSetGraphic(-1, $GUI_GR_PIE, 50, 50, 40, 30, 270) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00ff00, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_PIE, 58, 50, 40, -60, 90) $Quit = GUICtrlCreateButton("QUIT", 175, 190, 50, 30) GUISetState(@SW_SHOWNORMAL) Global $WinPos = 0 Global $Time = TimerInit() While 1 If GUIGetMsg() = $Quit Then Exit If TimerDiff($Time) > 3000 Then _ToggleWinPos() Sleep(20) WEnd Func _ToggleWinPos() $Time = TimerInit() $WinPos = Not $WinPos If $WinPos Then GUISetState(@SW_MAXIMIZE) Else GUISetState(@SW_SHOWNORMAL) EndIf EndFunc ;==>_ToggleWinPos Time for the brainy people to step in and tell us mere mortals what the heck is going on... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 4, 2007 Share Posted May 4, 2007 (edited) Aha!!! The answer is: GUICtrlSetResizing(controlID, resizing). Came across it while looking for Opt() settings that might be related. Fixed Demo:expandcollapse popup#include <guiconstants.au3> ; Create GUI Global $W = 400, $H = 230, $X = 200, $Y = 200 Global $hGui = GUICreate("Rubber GUI Test", $W, $H, $X, $Y) GUICtrlCreateLabel("Some sample controls:", 10, 10, 200, 20) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlCreateInput("", 10, 40, 150, 20) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlCreateGraphic(10, 70, 380, 110) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetBkColor(-1, 0xffffff) GUICtrlSetColor(-1, 0) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff0000, 0xff0000) GUICtrlSetGraphic(-1, $GUI_GR_PIE, 50, 50, 40, 30, 270) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00ff00, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_PIE, 58, 50, 40, -60, 90) $Quit = GUICtrlCreateButton("QUIT", 175, 190, 50, 30) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUISetState() Global $WinPos = 0 Global $Time = TimerInit() While 1 If GUIGetMsg() = $Quit Then Exit If TimerDiff($Time) > 3000 Then _ToggleWinPos() Sleep(20) WEnd Func _ToggleWinPos() $Time = TimerInit() $WinPos = Not $WinPos If $WinPos Then WinMove("Rubber GUI Test", "", $X, $Y, $W + 200, $H + 200) Else WinMove("Rubber GUI Test", "", $X, $Y, $W + 4, $H + 30) EndIf EndFunc ;==>_ToggleWinPosoÝ÷ Ú«·#ÒN§Ëhé`y.q©íjG¨ºÛaxe ÚåIëQzȳx¢·r(Ú輬zÛbay×jém~íì!¢WP®¶sc²7&VFRuT¤÷BgV÷C´wV&W6¦TÖöFRgV÷C²Âb33c´uTôDô4´Ä¤vÆö&Âb33cµrÒCÂb33c´Ò#3Âb33cµÒ#Âb33cµÒ#¤vÆö&Âb33c¶wVÒuT7&VFRgV÷Cµ'V&&W"uTFW7BgV÷C²Âb33cµrÂb33c´Âb33cµÂb33cµBut notice the offsets that have to be added to the Width and Height. When doing WinMove, the pixel width of the borders and menu bar are not automatically added as they are in GuiCreate(). Edited May 4, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Helge Posted May 4, 2007 Share Posted May 4, 2007 GUIResizeMode (Opt), GUICtrlSetResizing ... Link to comment Share on other sites More sharing options...
hlstriker Posted May 6, 2007 Author Share Posted May 6, 2007 But notice the offsets that have to be added to the Width and Height. When doing WinMove, the pixel width of the borders and menu bar are not automatically added as they are in GuiCreate().Thanks your reply works wonders. When creating offsets though I found out that it depends on the windows theme you are using (classic vs xp). I'm not sure if the other operating system offsets would be different too.Now I have another small question. Instead of using $GUI_DOCKALL, is there one to do just the opposite? I still want a few of my button to move when the resize happens. The best Honda forums!RuneScape High Alching for Profit! Link to comment Share on other sites More sharing options...
xcal Posted May 6, 2007 Share Posted May 6, 2007 $path = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir') Run($path & '\AutoIt3Help.exe GuiCtrlsetResizing') How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now