Sign in to follow this  
Followers 0
Pasukun

Question: How to make the window resizable.

8 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
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 :(

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Add this yo your optinal style paremeter or it might be exstyle paremeter

$WS_SIZEBOX

I think thats it

Edited by layer

FootbaG

Share this post


Link to post
Share on other sites

Perfect! Thanks alot guys. :(

Share this post


Link to post
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. :(

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

Great! Much thanks. :(

Share this post


Link to post
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
Sign in to follow this  
Followers 0