DigDeep

GUI Button on top of Lable

2 posts in this topic

#1 ·  Posted

Not sure what is wrong here. If I keep the Button after Lable, I can see the button but cannot click. If I keep it before Lable I can only see it if I click on it.

I even tried with GUICtrlSetState($Button1, $gui_ontop) but it's still the same.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Form2", 405, 293, 333, 307)

$Button1 = GUICtrlCreateButton("Button1", 168, 120, 75, 25)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000080)

$Label1 = GUICtrlCreateLabel("Label1", 64, 64, 268, 161)
GUICtrlSetBkColor(-1, 0x008000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            MsgBox(0, '', 'Button 1')

    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites



#2 ·  Posted

OK, I found it.

Just added GUICtrlSetStyle(-1, $SS_CENTER) after the lable and it worked. :)

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