Jump to content

Question: How to make the window resizable.


Recommended Posts

Before I ask.. I want you to know that I am very new to AutoIt3. :">

Q: I am trying to make a resizable GUI window. How do I do that?

For example. Your internet browser, you can use the mouse pointer to shrink or expand the size of it by clicking either the corner or the edge and drag.

Here is my noob script. What can I add to make that possible?

#include <GUIConstants.au3>

$Title_01 = "My Project"
$Width_01 = "500"
$Height_01 = "250"
$Xcoord_01 = "150"
$YCoord_01 = "150"

GuiCreate( $Title_01, $Width_01, $Height_01, $Xcoord_01, $Ycoord_01)
GUISetState ()

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Thanks in advance.

Link to comment
Share on other sites

Well this is a little strange and told me to be changed BUT you has to do a default minemized window and move/resize it like this...

$Form = GuiCreate('Form Window',180, 60,-1,....

WinMove($Form,-1,... // to the actually diaplay size but told me to be changed...

I think that this is one thing an automated language should take care of for you...

kjactive :(

Edited by kjactive
Link to comment
Share on other sites

Before I ask.. I want you to know that I am very new to AutoIt3.  :">

Q: I am trying to make a resizable GUI window. How do I do that?

For example. Your internet browser, you can use the mouse pointer to shrink or expand the size of it by clicking either the corner or the edge and drag.

Here is my noob script. What can I add to make that possible?

#include <GUIConstants.au3>

$Title_01 = "My Project"
$Width_01 = "500"
$Height_01 = "250"
$Xcoord_01 = "150"
$YCoord_01 = "150"

GuiCreate( $Title_01, $Width_01, $Height_01, $Xcoord_01, $Ycoord_01)
GUISetState ()

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Thanks in advance.

<{POST_SNAPBACK}>

look at the GUICreate doc

By default the dialog box is non sizable and non maximizable. So WS_SIZEBOX or WS_MAXIMIZEBOX can be used in the style parameter.

remember the first defined size is the minimum size :(
Link to comment
Share on other sites

Didn't want to create another noob thread, so I decide to ask here instead. :">

Here is my updated script. (still practicing)

#include <GUIConstants.au3>

$Title_01 = "My Project"

$Title_02 = "My Project2"

$Width_01 = "500"

$Height_01 = "250"

$Xcoord_01 = "150"

$YCoord_01 = "150"

$Create_01 = GuiCreate( $Title_01, $Width_01, $Height_01, $Xcoord_01, $Ycoord_01, $WS_MINIMIZEBOX+$WS_SIZEBOX)

GUISetState ()

$Create_02 = GuiCreate( $Title_02, $Width_01, $Height_01, $Xcoord_01, $Ycoord_01, $WS_MINIMIZEBOX+$WS_SIZEBOX)

GUISetState ()

While 1

    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

As you can see. It will generate two GUI windows.

Now here is my question..

If I click on the either window's "X" box(located at the top right corner) to close the window.. it closes both..

How can I make them independently close?

Thanks in advance. :(

Link to comment
Share on other sites

Here's one way using GuiGetMsg(1) ; advanced option

The first gui is the parent and if closed, both windows will close.

#include <GUIConstants.au3>

$Title_01 = "My Project"
$Title_02 = "My Project2"
$Width_01 = "500"
$Height_01 = "250"
$Xcoord_01 = "150"
$YCoord_01 = "150"

$Create_01 = GuiCreate( $Title_01, $Width_01, $Height_01, $Xcoord_01, $Ycoord_01, $WS_MINIMIZEBOX+$WS_SIZEBOX)
GUISetState ()

$Create_02 = GuiCreate( $Title_02, $Width_01, $Height_01, $Xcoord_01 + 50, $Ycoord_01 + 50, $WS_MINIMIZEBOX+$WS_SIZEBOX)
GUISetState ()

While 1
    $msg = GUIGetMsg(1) 
    If $msg[0] = $GUI_EVENT_CLOSE and $msg[1] = $Create_01 Then exit
    If $msg[0] = $GUI_EVENT_CLOSE and $msg[1] = $Create_02 Then GUIDelete($Create_02)
WEnd

If you want them independant, then just check to see if both not exists:

#include <GUIConstants.au3>

$Title_01 = "My Project"
$Title_02 = "My Project2"
$Width_01 = "500"
$Height_01 = "250"
$Xcoord_01 = "150"
$YCoord_01 = "150"

$Create_01 = GuiCreate( $Title_01, $Width_01, $Height_01, $Xcoord_01, $Ycoord_01, $WS_MINIMIZEBOX+$WS_SIZEBOX)
GUISetState ()

$Create_02 = GuiCreate( $Title_02, $Width_01, $Height_01, $Xcoord_01 + 50, $Ycoord_01 + 50, $WS_MINIMIZEBOX+$WS_SIZEBOX)
GUISetState ()

While 1
    $msg = GUIGetMsg(1) 
    If $msg[0] = $GUI_EVENT_CLOSE and $msg[1] = $Create_01 Then GUIDelete($Create_01)
    If $msg[0] = $GUI_EVENT_CLOSE and $msg[1] = $Create_02 Then GUIDelete($Create_02)
    
    if (not WinExists("My Project")) and (not WinExists("My Project2")) then Exit
WEnd

edit:typos

Edited by steveR
AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Link to comment
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
 Share

  • Recently Browsing   0 members

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