Jump to content

Recommended Posts

Posted

Hello,

I've been using winmove to resize a gui when a button is pressed and noticed a slight delay when it trys to redraw all the controls.

Opt("GuiNotifyMode",1)

GuiCreate ("MyGUI")

$nOk    = GUISetControl ("button", "OK", 20,70)

GuiShow()
GuiMsg()

While GuiMsg() > 0
    if $nOK= GuiRead () then
  $position = WinGetPos("MyGUI")
  WinMove("MyGUI", "", $position[0], $position[1], $position[2], $position[3]+ 2)
    endif
Wend

Is this the correct way to resize a gui?

Posted (edited)

1) You want to set Opt("WinWaitDelay", 10)

Alters how long a script should briefly pause after a successful window-related operation. Default is 250 milliseconds

2) You can give the GUI a WS_THICKFRAME style which allows the user to resize the window with the mouse.

Here's an example showing both:

$WS_THICKFRAME = 0x40000;resizability
$title = "Example Resizable GUI"

Opt("GuiNotifyMode",1)
Opt("GUIResizeMode", 0); no control resizing.... see also GuiSetControlEx
Opt("WinWaitDelay", 10)

GuiCreate($title, 300, 300, 100, 100, $WS_THICKFRAME)
$button = GuiSetControl("button", "button", 10, 100, 100, 100)
GuiShow()
WinActivate($title)

While 1
   $msg = GuiMsg(0)
   sleep(100)
   If $msg = -3 Then
      Exit
   ElseIf $msg = $button Then
      $pos = WinGetPos($title)
      WinMove($title,"", $pos[0], $pos[1], $pos[2]+10, $pos[3]+10)
   EndIf
WEnd
Edited 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!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...