Sign in to follow this  
Followers 0
alawoona

Weird UpDown Control Behavior

3 posts in this topic

#1 ·  Posted (edited)

I am writing a script with a complicated GUI. I have created some updown controls which the script disables and hides. Subsequently the script enables and shows the updown controls. When the latter happens the width of the updown control changes. See the simplified script below and the screencapture images.

#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$TEST = GUICreate("TEST", 255, 91, 197, 115)
$Input1 = GUICtrlCreateInput("0", 26, 28, 36, 21)
$Updown1 = GUICtrlCreateUpdown($Input1, BitOR($UDS_WRAP,$UDS_ALIGNRIGHT))
GUICtrlSetLimit($Updown1, 59, 0)
$Hide = GUICtrlCreateButton("Hide", 87, 27, 53, 21, 0)
$Show = GUICtrlCreateButton("Show", 162, 27, 53, 21, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    Case $Hide
            GUICtrlSetState ($Input1, $GUI_HIDE)
            GUICtrlSetState ($Input1, $GUI_DISABLE)
            GUICtrlSetState ($Updown1, $GUI_HIDE)
            GUICtrlSetState ($Updown1, $GUI_DISABLE)
    Case $Show
            GUICtrlSetState ($Input1, $GUI_ENABLE)
            GUICtrlSetState ($Input1, $GUI_SHOW)
            GUICtrlSetState ($Updown1, $GUI_ENABLE)
            GUICtrlSetState ($Updown1, $GUI_SHOW)
    EndSwitch
WEnd

Run the script:

Posted Image

Click Hide:

Posted Image

Click Show and this is what happens to the Updown Control:

Posted Image

Now click Show again: ?????

Posted Image

Edited by alawoona

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

It appears to work ok as long as you do not use the disable and enable functions.

Edit - Another way that works

#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$TEST = GUICreate("TEST", 255, 91, 197, 115)
$Input1 = GUICtrlCreateInput("0", 26, 28, 36, 21)
$Updown1 = GUICtrlCreateUpdown($Input1, BitOR($UDS_WRAP,$UDS_ALIGNRIGHT))
GUICtrlSetLimit($Updown1, 59, 0)
$Hide = GUICtrlCreateButton("Hide", 87, 27, 53, 21, 0)
$Show = GUICtrlCreateButton("Show", 162, 27, 53, 21, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    Case $Hide
            GUICtrlSetState ($Input1, $GUI_DISABLE + $GUI_HIDE)
            GUICtrlSetState ($Updown1, $GUI_DISABLE + $GUI_HIDE)
    Case $Show
            GUICtrlSetState ($Input1, $GUI_ENABLE + $GUI_SHOW)
            GUICtrlSetState ($Updown1, $GUI_ENABLE + $GUI_SHOW)
    EndSwitch
WEnd
Edited by BigDod


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanx BigDod - that does work so I will be pragmatic and use what works. :P

Edited by alawoona

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