CyberSlug Posted March 30, 2004 Share Posted March 30, 2004 (edited) I think I've figured out how control resizing works with autoit-gui.102.12 Perhaps this example will help others. Heh, try coding the same thing in VisualBasic with only 30 lines of code. $title = "Example of control resizing" $info = "Try resizing this window" Opt("TrayIconHide", 1) GUICreate($title, 600,300, 50, 50, 0x04CF0000, 0x00000110) $nw = GUISetControl ("button", "north-west", 0, 0, 200,100) $n = GUISetControl ("button", "north", 200, 0, 200,100) $ne = GUISetControl ("button", "north-east", 400, 0, 200,100) $w = GUISetControl ("button", "west", 0,100, 200,100) $co = GUISetControl ("edit", $info, 200,100, 200,100) $e = GUISetControl ("button", "east", 400,100, 200,100) $sw = GUISetControl ("button", "south-west", 0,200, 200,100) $s = GUISetControl ("button", "south", 200,200, 200,100) $se = GUISetControl ("button", "south-east", 400,200, 200,100) GUISetControlEx ($nw, 0, 2+32) GUISetControlEx ($n, 0, 32) GUISetControlEx ($ne, 0, 4+32) GUISetControlEx ($w, 0, 2) GUISetControlEx ($co, 256, 0) GUISetControlEx ($e, 0, 4) GUISetControlEx ($sw, 0, 2+64) GUISetControlEx ($s, 0, 64) GUISetControlEx ($se, 0, 4+64) WinActivate($title) GUIWaitClose() WinSetState($title,"", @SW_HIDE);speeds up appearance of closing Exit Edited April 9, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
jpm Posted March 30, 2004 Share Posted March 30, 2004 I think I've figured out how control resizing works with autoit-gui.102.12 Perhaps this example will help others. Heh, try coding the same thing in VisualBasic with only 30 lines of code. $title = "Example of control resizing" $info = "Try resizing this window" Opt("TrayIconHide", 1) GUICreate($title, 600,300, 50, 50, 0x04CF0000, 0x00000110) $nw = GUISetControl ("button", "north-west", 0, 0, 200,100) $n = GUISetControl ("button", "north", 200, 0, 200,100) $ne = GUISetControl ("button", "north-east", 400, 0, 200,100) $w = GUISetControl ("button", "west", 0,100, 200,100) $co = GUISetControl ("edit", $info, 200,100, 200,100) $e = GUISetControl ("button", "east", 400,100, 200,100) $se = GUISetControl ("button", "south-west", 0,200, 200,100) $s = GUISetControl ("button", "south", 200,200, 200,100) $sw = GUISetControl ("button", "south-east", 400,200, 200,100) GUISetControlEx ($nw, 0, 2+32) GUISetControlEx ($n, 0, 32) GUISetControlEx ($ne, 0, 4+32) GUISetControlEx ($w, 0, 2) GUISetControlEx ($co, 256, 0) GUISetControlEx ($e, 0, 4) GUISetControlEx ($se, 0, 2+64) GUISetControlEx ($s, 0, 64) GUISetControlEx ($sw, 0, 4+64) WinActivate($title) GUIWaitClose() WinSetState($title,"", @SW_HIDE);speeds up appearance of closing ExitVery good, I am working on what is wrong on resizing actually mainly the implicit definition of the size. So for the time being 102.12 use explicit size and it shouldf work. Thanks for the testing Link to comment Share on other sites More sharing options...
CyberSlug Posted May 15, 2004 Author Share Posted May 15, 2004 Maybe useful to someone. It should work.... expandcollapse popup;================================================ ; Fucntion to help create a GUI window that: ; 1) Is Active ; 2) Can be resized/maximized ; 3) Has no minimum size ;================================================ Opt("TrayIconHide", 1) ;0=show, 1=hide tray icon Opt("GUICoordMode", 1) ;1="absolute", 0=relative, 2=cell... Opt("GUINotifyMode", 1) ;0=buttons close, 1=all notify Opt("GUITaskbarEntry", 1) ;1=yes, 0=no; zero only works with some styles? $title = "MyGUI" $width = 300 $height = 200 $left = (@DesktopWidth-$width) / 2 ;center on screen $top = (@DesktopHeight-$height) / 2;center on screen $style = BitOR( 0x00040000 , 0x00010000 );resizible + maximize button $exStyle = 0x00040100 _CreateActiveGUI($title, $width, $height, $left, $top, $style, $exStyle) While GuiMsg(0) <> -3 ;loop until user closes the window sleep(100) WEnd Exit Func _CreateActiveGUI($title, $width, $height, $left, $top, $style, $exStyle) Local $WinWaitDelay = Opt("WinWaitDelay", 10) Local $WinTitleMatchMode = Opt("WinTitleMatchMode", 4) ; To create a window with no minimum size, GuiCreate a small window ; and then WindowMove it ; Caveat: The GuiCreate fails if the window height is < titlebar height.... ; Width can be 0, but Microsoft Windows will impose a minimum ~100 pixels SplashTextOn('testToGetTitleBarSize','', 50,50, -99,-99) Local $client = WinGetClientSize("testToGetTitleBarSize") Local $window = WinGetPos("testToGetTitleBarSize") Local $border = ($window[2] - $client[0]) / 2;width diff Local $titlebar = $window[3] - $border - $client[1];titlbar + 1 border... SplashOff() Local $handle = GuiCreate($title, 0, $titlebar, -99, -99, $style, $exStyle) GuiShow() ; Resize and active the GUI window WinMove("handle=" & $handle, '', $left, $top, $width, $height) WinActivate("handle=" & $handle) Opt("WinTitleMatchMode", $WinTitleMatchMode) Opt("WinWaitDelay", $WinWaitDelay) EndFunc #cs Default Style info: can Move, Minimize, Close; cannot Maxmize or Resize style - 94CA0000 WS_POPUPWINDOW WS_VISIBLE WS_CLIPSIBLINGS WS_DLGFRAME WS_OVERLAPPED WS_MINIMIZEBOX exStyle - 00040100 WS_EX_LEFT WS_EX_LTRREADING WS_EX_RIGHTSCROLLBAR WS_EX_WINDOWEDGE WS_EX_APPWINDOW #ce Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! 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