Sign in to follow this  
Followers 0
furrycow

Resizing with WinMove()

6 posts in this topic

Ok, so all i am trying to do is resize a GUI, however when i use this code, (just an example i made, i know only one control actually works)..

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)

$Form1 = GUICreate("Form1", 218, 306, 193, 125)
$Group1 = GUICtrlCreateGroup("Group1", 8, 8, 201, 129)
$Buttonresize = GUICtrlCreateButton("Hide", 120, 32, 81, 25, 0)
GUICtrlSetOnEvent($Buttonresize,"_Resize")
$Label1 = GUICtrlCreateLabel("Label1", 24, 40, 36, 17)
$Button2 = GUICtrlCreateButton("Button2", 120, 64, 81, 25, 0)
$Button3 = GUICtrlCreateButton("Button3", 120, 96, 81, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$List1 = GUICtrlCreateList("", 8, 144, 201, 149)
GUISetState(@SW_SHOW)

While 1
Sleep(1000)
WEnd

Func _Resize()

    $ExpandREAD=GUICtrlRead($Buttonresize)
    If $ExpandREAD="Hide" Then
    
    $WindowPOS=WinGetPos("Form1")
    WinMove ( "Form1", "", Default, Default, $WindowPOS[2], 140)
    GUICtrlSetData($Buttonresize,"Show")
    Else
    $WindowPOS=WinGetPos("Form1")
    WinMove ( "Form1", "", Default, Default, $WindowPOS[2],306)
    GUICtrlSetData($Buttonresize,"Hide")
    EndIf

EndFunc

Everything just shifts up/changes size and the rest of it, whereas all i want is for the LIST control to "disappear" if you know what i mean; for it to be hidden rather than deleted!

I am vaguely aware of some Opt() function, but having a little play around with it, i was unable to get the result i wanted...any help would be GREATLY APPRICIATED!! thanks in advance!


Instant Lockerz Invite - www.instantlockerzinvite.co.uk

Share this post


Link to post
Share on other sites



#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)

$Form1 = GUICreate("Form1", 218, 306, 193, 125)
$Group1 = GUICtrlCreateGroup("Group1", 8, 8, 201, 129)
$Buttonresize = GUICtrlCreateButton("Hide", 120, 32, 81, 25, 0)
GUICtrlSetOnEvent($Buttonresize, "_Resize")

$Label1 = GUICtrlCreateLabel("Label1", 24, 40, 36, 17)
$Button2 = GUICtrlCreateButton("Button2", 120, 64, 81, 25, 0)
$Button3 = GUICtrlCreateButton("Button3", 120, 96, 81, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$List1 = GUICtrlCreateList("", 8, 144, 201, 149)
GUISetState(@SW_SHOW)

While 1
    Sleep(1000)
WEnd

Func _Resize()

    $ExpandREAD = GUICtrlRead($Buttonresize)
    If $ExpandREAD = "Hide" Then
        GUICtrlSetState($List1, $GUI_HIDE)
        GUICtrlSetData($Buttonresize, "Show")
    Else
        GUICtrlSetState($List1, $GUI_SHOW)
        GUICtrlSetData($Buttonresize, "Hide")
    EndIf

EndFunc   ;==>_Resize

Share this post


Link to post
Share on other sites

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)

$Form1 = GUICreate("Form1", 218, 306, 193, 125)
$Group1 = GUICtrlCreateGroup("Group1", 8, 8, 201, 129)
$Buttonresize = GUICtrlCreateButton("Hide", 120, 32, 81, 25, 0)
GUICtrlSetOnEvent($Buttonresize, "_Resize")

$Label1 = GUICtrlCreateLabel("Label1", 24, 40, 36, 17)
$Button2 = GUICtrlCreateButton("Button2", 120, 64, 81, 25, 0)
$Button3 = GUICtrlCreateButton("Button3", 120, 96, 81, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$List1 = GUICtrlCreateList("", 8, 144, 201, 149)
GUISetState(@SW_SHOW)

While 1
    Sleep(1000)
WEnd

Func _Resize()

    $ExpandREAD = GUICtrlRead($Buttonresize)
    If $ExpandREAD = "Hide" Then
        GUICtrlSetState($List1, $GUI_HIDE)
        GUICtrlSetData($Buttonresize, "Show")
    Else
        GUICtrlSetState($List1, $GUI_SHOW)
        GUICtrlSetData($Buttonresize, "Hide")
    EndIf

EndFunc   ;==>_Resize

Thanks for the quick reply kafu! but sorry i mustnt have phrased myself properly i want the window to get smaller, so the actual GUI goes from a height of 306 to 140, without the button/label/etc controls moving/changing size. thanks.

Instant Lockerz Invite - www.instantlockerzinvite.co.uk

Share this post


Link to post
Share on other sites

...whereas all i want is for the LIST control to "disappear" if you know what i mean; for it to be hidden rather than deleted!

... and you're looking for GUICtrlSetResizing().

Share this post


Link to post
Share on other sites

What i want is shown in the following image:

http://www.atcy68.dsl.pipex.com/untitled.bmp

Cheers


Instant Lockerz Invite - www.instantlockerzinvite.co.uk

Share this post


Link to post
Share on other sites

Sooo.... that's a combo of my first and my second post :). Or just resize the GUI that the list is offscreen and fix the buttons and the group with GUICtrlSetResizing().

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