Sign in to follow this  
Followers 0
John117

How do I stop WinMove from resizing my labels?

7 posts in this topic

#1 ·  Posted (edited)

I have the followig code I have build. I have included a generic picture for testing. I would like for the labels to not move. They are bunching up and messing things up. I am just looking to hide the lower portion of the GUI, not really to move stuff.

Any Help?

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
HotKeySet("{ESC}", "_Custom_Exit")
Opt("GuiResizeMode", $GUI_DOCKALL) ; $GUI_DOCKALL = 802
Global $ParentWin_Width = 450, $ParentWin_Expand = 700, $ParentWin_Collapse = 100, $Top = 25, $Expanded = True
Global $ParentWin = GUICreate("Example", $ParentWin_Width, $ParentWin_Expand, Default, $Top, $WS_POPUPWINDOW)
GUICtrlCreatePic(@Systemdir & "\oobe\images\wpakey.jpg",0,0, 450,677)
GuiCtrlSetState(-1,$GUI_DISABLE)

$file_menu = GUICtrlCreateMenu("Start")
Global $Expand_Button = GUICtrlCreateButton("Expand", 350, 0, 100, 24)
GUICtrlSetOnEvent(-1, "_Expand")
$Example_Label_1 = GUICtrlCreateLabel("Example1:", 10, 131, 50, 20)
$Example_Label_2 = GUICtrlCreateLabel("Example2:", 10, 352, 50, 20)




GUISetState(@SW_SHOW, $ParentWin)

While 1
    Sleep(1000)
    Global $size = WinGetPos($ParentWin)
    Global $pos = MouseGetPos()
    ;MouseLeft > GuiLeft      MouseRight < GuiRight               MouseTop > GuiTop      MouseBottom < GuiBottom
    If $pos[0] > $size[0] And $pos[0] < ($size[0] + $size[2]) And $pos[1] > $size[1] And $pos[1] < $size[3] Then
        ;Do Nothing
    Else
        If $Expanded Then _Colapse()
    EndIf
WEnd

Func _Colapse()
    $Expanded = False
    WinMove($ParentWin, "", $size[0], $size[1], $size[2], $ParentWin_Collapse)
    Global $Expanded = False
EndFunc   ;==>_Colapse

Func _Expand()
    WinMove($ParentWin, "", $size[0], $size[1], $size[2], $ParentWin_Expand)
    Global $Expanded = True
EndFunc   ;==>_Expand

Func _Custom_Exit()
    Exit
EndFunc   ;==>_Custom_Exit
Edited by Hatcheda

Share this post


Link to post
Share on other sites



Add this to the top:

Opt("GuiResizeMode", $GUI_DOCKALL) ; $GUI_DOCKALL = 802

Alternatively, you could leave the default alone and just set the mode on particular controls with GUICtrlSetResizing($CtrlID, $GUI_DOCKALL).

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

You're Ridiculous! :) -Thank you P

Share this post


Link to post
Share on other sites

GUICtrlSetResizing -Good function to read up on!

Share this post


Link to post
Share on other sites

"Ridiculous" is not such a cosmetic word for somebody who have helped you. Open up your dictionary before your help file.

Share this post


Link to post
Share on other sites

"Ridiculous" is not such a cosmetic word for somebody who have helped you. Open up your dictionary before your help file.

"...not such a cosmetic word..." ^_^

Talk about needing to break out the thesaurus...

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

@erebus -If you only knew how many times P has helped me with challenging stuff you would know that his *skilz* are "Ridiculous" as stated *implied

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