Sign in to follow this  
Followers 0
sPeziFisH

Resizing GUI to infra-initial-size

2 posts in this topic

According to this thread it's seems to be a design decision that GUI-windows can't be resized to smaller sizes than given at point of creation.

Nearly all apps I am using are able to be resized to any size and I am quite happy about it as I use this possibilty to arrange the windows at the screen (example: Backside of CD-Cover in IrfanView, sized so that titles can be read, window resized and scrollt so that only the interesting part can be seen, IrfanView-window set always on top and typing in titles at EAC).

Whatever, creating a GUI with a smaller size (say 10 x 10) and using WinMove to resize it to the value it should be at the end (let's say say 580 x 280) I can't resize it back to 10 x 10 , I tried different window styles (standing alone & together).

Here's my testing-GUI

Posted Image

#include <GuiConstants.au3>
;AutoItSetOption ("GUIResizeMode",$GUI_DOCKAUTO)


$gui = GuiCreate("MyGUI", 10, 10,(@DesktopWidth-580)/2, (@DesktopHeight-399)/2 , $WS_SIZEBOX + $WS_SYSMENU  )
WinMove("MyGUI","",0,0,580,280)

$Edit_1 = GuiCtrlCreateEdit("", 10, 10, 560, 110)
$Button_2 = GuiCtrlCreateButton("Button2", 10, 130, 50, 20)
$Button_3 = GuiCtrlCreateButton("Button3", 60, 130, 50, 20)
$Button_4 = GuiCtrlCreateButton("Button4", 120, 130, 50, 20)
$Button_5 = GuiCtrlCreateButton("Button5", 520, 130, 50, 20)

$tab = GUICtrlCreateTab (10,160, 200,100)
$tab1=GUICtrlCreateTabitem ("Tab 1")
$tab2=GUICtrlCreateTabitem ("Tab 2")
    $Button_7 = GuiCtrlCreateButton("tracknumber", 91, 210, 80, 20)

GuiSetState()

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_5
        
        If (GUICtrlGetState ($Edit_1) = $GUI_SHOW + $GUI_ENABLE) Then 
            GUICtrlSetState ( $Edit_1, $GUI_HIDE )
            WinMove("","",0,0,200,300)
            
        Else 
            GUICtrlSetState ( $Edit_1, $GUI_SHOW )
        EndIf
        
    EndSelect
WEnd
Exit

What I want to have is that with pressing Button5 the edit gets hidden and the window resizes so that the edit-part gets removed (Window-top-border (with title etc.) is directly above the Buttons) - so a 'Hide Edit'-Button.

Any suggests?

BTW

The tab starts at 160 and has a height of 100, so 280 should be enough - as you will see, the window has to be 300 to let the tab fit into it.

In OuttaSpace\autoit are some screenshots I made at home with WinXP and Royal (EnergyBlue)-Theme.

At the point of creation I used GUICreate with a size of 580 x 280 and some window-styles (only used one style at once) - as you can see, the created GUIs have different sizes or borderthicknesses - quite strange (I add it here instead of creating a bug-thread).

AutoItBeta 3.1.1.74 Beta here.

BTW 2

Resizing windows to smaller size than initial size would be a fine thing ;)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Regarding Resizing:

GuiSetState(@SW_SHOW) must be set before WinMove ;)

$gui = GuiCreate("MyGUI", 10, 10,(@DesktopWidth-580)/2, (@DesktopHeight-399)/2 , $WS_MINIMIZEBOX + $WS_CAPTION + $WS_POPUP + $WS_SYSMENU + $WS_SIZEBOX  )
GuiSetState(@SW_SHOW)
WinMove("MyGUI","",default,default,580,280)

This also makes the hiding-edit-control to work of course :P

AutoItSetOption ("GUIResizeMode",$GUI_DOCKSTATEBAR)
Global $hidden = 0

....

While 1
    $msg = GuiGetMsg()
                
    Select
       
        ....

        Case $msg = $Button_5
                $pos = WinGetPos("")
                If $hidden = 0 Then 
                    GUICtrlSetState ( $Edit_1, $GUI_HIDE )
                    WinMove("","",$pos[0],$pos[1]+140,580,190)
                    $hidden = 1
            
                Else 
                    GUICtrlSetState ( $Edit_1, $GUI_SHOW )
                    WinMove("","",$pos[0],$pos[1]-140,550,280)
                    $hidden = 0
                EndIf
    
    EndSelect
Edited by sPeziFisH

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