argumentum

GUICtrlCreateUpdown & $GUI_DOCKRIGHT misbehaved

7 posts in this topic

#1 ·  Posted (edited)

GUICtrlCreateUpdown & $GUI_DOCKRIGHT dont play along with GUICtrlSetState( CtrlCreateUpdown ,  $GUI_HIDE ).
Here is an example to shows it's misbehaviour:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=G:\au3s\SMS_lite\TestUpdownHidei.kxf
Global $idGui = GUICreate("GUI_DOCKRIGHT oops", 389, 180, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
Global $idLabel = GUICtrlCreateLabel("try OnTop and resize, the UpDown does not behave as expacted, play around, you'll see", 16, 52, 356, 100)
GUICtrlSetFont(-1, 26, 400, 0, "Lucida Console")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
Global $idCk_KeepOnTop = GUICtrlCreateCheckbox("OnTop", 280, 12, 97, 25, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE))
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Global $idSetTrans = GUICtrlCreateInput("0", 200, 12, 69, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console")
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Global $StatusBar1 = _GUICtrlStatusBar_Create($idGui)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $idSetTransUpdown = GUICtrlCreateUpdown($idSetTrans)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetLimit($idSetTransUpdown, 9)
GUICtrlSetState($idSetTrans, $GUI_HIDE)
GUICtrlSetState($idSetTransUpdown, $GUI_HIDE)
GUICtrlSetState($idLabel, $GUI_FOCUS)

GUISetState(@SW_SHOW)


; this is to better show what I mean
WinMove($idGui,"",50,50,389+100,180)
_GUICtrlStatusBar_Resize($StatusBar1)
; this is to better show what I mean


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            Exit 0

        Case $GUI_EVENT_RESIZED
            _GUICtrlStatusBar_Resize($StatusBar1)

        Case $idSetTransUpdown
            GUICtrlSetState($idLabel, $GUI_FOCUS)

        Case $idSetTrans
            GUICtrlSetState($idLabel, $GUI_FOCUS)
            If Int(GUICtrlRead($idSetTrans)) Then
                WinSetTrans($idGui, "", 255 - (Int(GUICtrlRead($idSetTrans)) * 25))
            Else
                WinSetTrans($idGui, "", 255)
            EndIf

        Case $idCk_KeepOnTop
            GUICtrlSetState($idLabel, $GUI_FOCUS)
            If GUICtrlRead($idCk_KeepOnTop) = 1 Then
                GUICtrlSetState($idSetTransUpdown, $GUI_SHOW)
                GUICtrlSetState($idSetTrans, $GUI_SHOW)
                WinSetOnTop($idGui, "", 1)
                WinSetTrans($idGui, "", 255 - (Int(GUICtrlRead($idSetTrans)) * 20))
            Else
                WinSetOnTop($idGui, "", 0)
                WinSetTrans($idGui, "", 255)
                GUICtrlSetState($idSetTrans, $GUI_HIDE)
                GUICtrlSetState($idSetTransUpdown, $GUI_HIDE)
            EndIf

    EndSwitch
WEnd

I believe not to be doing anything wrong, therefore I posted here.

If there is a workaround for this, please let me know.

And if you can open a ticket for it better, I've never done it before. I took the plunge and open a ticket for it

Thanks.

Edited by argumentum
tweak the code to better show what I would like you to observe

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

if I do something like:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=G:\au3s\SMS_lite\TestUpdownHidei.kxf
Global $idGui = GUICreate("GUI_DOCKRIGHT oops", 389, 180, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
Global $idLabel = GUICtrlCreateLabel("try OnTop and resize, the UpDown does not behave as expacted, play around, you'll see", 16, 52, 356, 100)
GUICtrlSetFont(-1, 26, 400, 0, "Lucida Console")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
Global $idCk_KeepOnTop = GUICtrlCreateCheckbox("OnTop", 280, 12, 97, 25, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE))
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Global $idSetTrans = GUICtrlCreateInput("0", 200, 12, 69, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console")
GUICtrlSetResizing($idSetTrans, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Global $StatusBar1 = _GUICtrlStatusBar_Create($idGui)
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###

Global $idSetTransUpdown = GUICtrlCreateUpdown($idSetTrans)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetLimit($idSetTransUpdown, 9)
GUICtrlSetState($idSetTrans, $GUI_HIDE)
GUICtrlSetState($idSetTransUpdown, $GUI_HIDE)
GUICtrlSetState($idLabel, $GUI_FOCUS)

GUISetState(@SW_SHOW)


; this is to better show what I mean
WinMove($idGui,"",50,50,389+100,180)
_GUICtrlStatusBar_Resize($StatusBar1)
; this is to better show what I mean

Local $i = 1
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            Exit 0

        Case $GUI_EVENT_RESIZED
            _GUICtrlStatusBar_Resize($StatusBar1)

        Case $idSetTransUpdown
            GUICtrlSetState($idLabel, $GUI_FOCUS)

        Case $idSetTrans
            GUICtrlSetState($idLabel, $GUI_FOCUS)
            If Int(GUICtrlRead($idSetTrans)) Then
                WinSetTrans($idGui, "", 255 - (Int(GUICtrlRead($idSetTrans)) * 25))
            Else
                WinSetTrans($idGui, "", 255)
            EndIf

        Case $idCk_KeepOnTop
            GUICtrlSetState($idLabel, $GUI_FOCUS)
            If GUICtrlRead($idCk_KeepOnTop) = 1 Then
                GUICtrlSetState($idSetTrans, $GUI_SHOW)
                GUICtrlSetState($idSetTransUpdown, $GUI_SHOW)

                f_TriggerGuiResize($idGui) ; ---- dirty fix

                WinSetOnTop($idGui, "", 1)
                WinSetTrans($idGui, "", 255 - (Int(GUICtrlRead($idSetTrans)) * 20))
            Else
                WinSetOnTop($idGui, "", 0)
                WinSetTrans($idGui, "", 255)
                GUICtrlSetState($idSetTrans, $GUI_HIDE)
                GUICtrlSetState($idSetTransUpdown, $GUI_HIDE)
            EndIf
    EndSwitch
WEnd

Func f_TriggerGuiResize($idGui)
    Local $a = WinGetPos( $idGui )
    If UBound($a) = 4 Then
        WinMove($idGui,"",$a[0],$a[1],$a[2],$a[3]+1)
        WinMove($idGui,"",$a[0],$a[1],$a[2],$a[3])
    EndIf
EndFunc

f_TriggerGuiResize($idGui) triggers the $GUI_EVENT_RESIZED. Is there a DLL call to fake it, as if it actually resized ?. That would fix my problem for now until a new version comes out. 

Edited by argumentum
clarify

Share this post


Link to post
Share on other sites

@trancexx , could you help me ?, my trick does not work when the window is maximized and you are the only one I know of, can figure it out.

Thanks.

Share this post


Link to post
Share on other sites

My grandmother has asked if you cannot place two hidden labels below the input and up-down controls, and use these labels to position the controls:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=G:\au3s\SMS_lite\TestUpdownHidei.kxf
Global $idGui = GUICreate("GUI_DOCKRIGHT oops", 389, 180, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
Global $idLabel = GUICtrlCreateLabel("try OnTop and resize, the UpDown does not behave as expacted, play around, you'll see", 16, 52, 356, 100)
GUICtrlSetFont(-1, 26, 400, 0, "Lucida Console")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
Global $idCk_KeepOnTop = GUICtrlCreateCheckbox("OnTop", 280, 12, 97, 25, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE))
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Global $idSetTrans = GUICtrlCreateInput("0", 200, 12, 69, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console")
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Global $StatusBar1 = _GUICtrlStatusBar_Create($idGui)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $idSetTransUpdown = GUICtrlCreateUpdown($idSetTrans)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetLimit($idSetTransUpdown, 9)
GUICtrlSetState($idSetTrans, $GUI_HIDE)
GUICtrlSetState($idSetTransUpdown, $GUI_HIDE)
GUICtrlSetState($idLabel, $GUI_FOCUS)

$idSetTransLabel1 = GUICtrlCreateLabel( "", 200, 12, 69, 24 )
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetState(-1, $GUI_HIDE)

$a = ControlGetPos( $idGui, "", $idSetTransUpdown )
$idSetTransLabel2 = GUICtrlCreateLabel( "", $a[0], $a[1], $a[2], $a[3] )
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetState(-1, $GUI_HIDE)

GUISetState(@SW_SHOW)


; this is to better show what I mean
WinMove($idGui,"",50,50,389+100,180)
_GUICtrlStatusBar_Resize($StatusBar1)
; this is to better show what I mean


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            Exit 0

        Case $GUI_EVENT_RESIZED
            _GUICtrlStatusBar_Resize($StatusBar1)

        Case $idSetTransUpdown
            GUICtrlSetState($idLabel, $GUI_FOCUS)

        Case $idSetTrans
            GUICtrlSetState($idLabel, $GUI_FOCUS)
            If Int(GUICtrlRead($idSetTrans)) Then
                WinSetTrans($idGui, "", 255 - (Int(GUICtrlRead($idSetTrans)) * 25))
            Else
                WinSetTrans($idGui, "", 255)
            EndIf

        Case $idCk_KeepOnTop
            GUICtrlSetState($idLabel, $GUI_FOCUS)
            If GUICtrlRead($idCk_KeepOnTop) = 1 Then
                $a = ControlGetPos( $idGui, "", $idSetTransLabel2 )
                GUICtrlSetPos( $idSetTransUpdown, $a[0], $a[1], $a[2], $a[3] )
                GUICtrlSetState($idSetTransUpdown, $GUI_SHOW)
                $a = ControlGetPos( $idGui, "", $idSetTransLabel1 )
                GUICtrlSetPos( $idSetTrans, $a[0], $a[1], $a[2], $a[3] )
                GUICtrlSetState($idSetTrans, $GUI_SHOW)
                WinSetOnTop($idGui, "", 1)
                WinSetTrans($idGui, "", 255 - (Int(GUICtrlRead($idSetTrans)) * 20))
            Else
                WinSetOnTop($idGui, "", 0)
                WinSetTrans($idGui, "", 255)
                GUICtrlSetState($idSetTrans, $GUI_HIDE)
                GUICtrlSetState($idSetTransUpdown, $GUI_HIDE)
            EndIf

    EndSwitch
WEnd

It's also my grandmother's opinion that the 3215-bug, could well be one of the bugs that are never solved (and it's not a big deal since there are so easy workarounds).

1 person likes this

Share this post


Link to post
Share on other sites
7 hours ago, LarsJ said:

My grandmother has asked if you cannot place two hidden labels below the input and up-down controls, and use these labels to position the controls:

Thanks for the answer. In that same route, I decided, might as well delete the controls and recreate 'em when needed. Again, thanks, this workaround did not come to my mind, at all.

Share this post


Link to post
Share on other sites

Try it this way:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=G:\au3s\SMS_lite\TestUpdownHidei.kxf
Global $idGui = GUICreate("GUI_DOCKRIGHT oops", 389, 180, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
Global $idLabel = GUICtrlCreateLabel("try OnTop and resize, the UpDown does not behave as expacted, play around, you'll see", 16, 52, 356, 100)
GUICtrlSetFont(-1, 26, 400, 0, "Lucida Console")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
Global $idCk_KeepOnTop = GUICtrlCreateCheckbox("OnTop", 280, 12, 97, 25, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE))
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Global $idSetTrans = GUICtrlCreateInput("0", 200, 12, 69, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console")
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Global $StatusBar1 = _GUICtrlStatusBar_Create($idGui)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $idSetTransUpdown = GUICtrlCreateUpdown($idSetTrans)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetLimit($idSetTransUpdown, 9)
GUICtrlSetState($idSetTrans, $GUI_HIDE)
GUICtrlSetState($idSetTransUpdown, $GUI_HIDE)
GUICtrlSetState($idLabel, $GUI_FOCUS)

GUISetState(@SW_SHOW)


; this is to better show what I mean
WinMove($idGui, "", 50, 50, 389 + 100, 180)
_GUICtrlStatusBar_Resize($StatusBar1)
; this is to better show what I mean

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            Exit 0

        Case $GUI_EVENT_RESIZED
            _GUICtrlStatusBar_Resize($StatusBar1)
            _MoveIdTrans()
        Case $idSetTransUpdown
            GUICtrlSetState($idLabel, $GUI_FOCUS)

        Case $idSetTrans
            GUICtrlSetState($idLabel, $GUI_FOCUS)
            If Int(GUICtrlRead($idSetTrans)) Then
                WinSetTrans($idGui, "", 255 - (Int(GUICtrlRead($idSetTrans)) * 25))
            Else
                WinSetTrans($idGui, "", 255)
            EndIf

        Case $idCk_KeepOnTop
            GUICtrlSetState($idLabel, $GUI_FOCUS)
            If GUICtrlRead($idCk_KeepOnTop) = 1 Then
                _MoveIdTrans()
                GUICtrlSetState($idSetTransUpdown, $GUI_SHOW)
                GUICtrlSetState($idSetTrans, $GUI_SHOW)
                WinSetOnTop($idGui, "", 1)
                WinSetTrans($idGui, "", 255 - (Int(GUICtrlRead($idSetTrans)) * 20))
            Else
                WinSetOnTop($idGui, "", 0)
                WinSetTrans($idGui, "", 255)
                GUICtrlSetState($idSetTrans, $GUI_HIDE)
                GUICtrlSetState($idSetTransUpdown, $GUI_HIDE)
            EndIf

    EndSwitch
WEnd

Func _MoveIdTrans()
    Local $aButton = ControlGetPos($idGui, '', $idCk_KeepOnTop)
    Local $aTrans = ControlGetPos($idGui, '', $idSetTrans)
    ControlMove($idGui, '', $idSetTrans, $aButton[0] - 80, $aButton[1])
    ControlMove($idGui, '', $idSetTransUpdown, $aButton[0] - 80+$aTrans[2] , $aButton[1])
EndFunc   ;==>_MoveIdTrans

 

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