Sign in to follow this  
Followers 0
nikink

Coloured buttons - how?

4 posts in this topic

Hi folks. Yet again I have a gui problem.

Using v3.2.12.1 how can I apply styles and colours to my buttons? I can apply styles without colour. And I can apply colour without styles. But the two together makes a coloured without styles button.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
$guimain = GUICreate("test buttons")
$btn = GUICtrlCreateButton("Testing button wrap", 10, 10, 75, 50, BitOr($BS_MULTILINE,$BS_CENTER,$BS_VCENTER))
GUICtrlSetBkColor($btn, 0x0066ff) ; <-- Comment out this line to see the difference
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $btn
            ExitLoop
    EndSwitch
WEnd

Exit

Am I doing something wrong? Is this a bug? Is there a workaround?

Thanks for your patience and help!

Share this post


Link to post
Share on other sites



You need to draw button, see GUIRegisterMsg() example in the help file.

Share this post


Link to post
Share on other sites

Hi folks. Yet again I have a gui problem.

Using v3.2.12.1 how can I apply styles and colours to my buttons? I can apply styles without colour. And I can apply colour without styles. But the two together makes a coloured without styles button.

Am I doing something wrong? Is this a bug? Is there a workaround?

Thanks for your patience and help!

I thought of this. Not sure if it helps.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
$guimain = GUICreate("test buttons")
;$btn = GUICtrlCreateButton("Testing" & @CRLF& "button" & @CRLF& "wrap   ", 10, 10, 75, 50, BitOr($BS_MULTILINE,$BS_CENTER,$BS_VCENTER))
$btn = GUICtrlCreateButton("Testing" & @CRLF& "button" & @CRLF& "wrap   ", 10, 10, 75, 50, $BS_MULTILINE)
;$btn = GUICtrlCreateButton("Testing button wrap", 10, 10, 75, 50);, BitOr($BS_MULTILINE,$BS_CENTER,$BS_VCENTER))
GUICtrlSetBkColor($btn, 0x0066ff) ; <-- Comment out this line to see the difference
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $btn
            ExitLoop
    EndSwitch
WEnd
Exit

Share this post


Link to post
Share on other sites

Thanks Rasim, I will have a look at that. Why does it have to be done that way? *IS* it a bug?

Thanks Malkey, your example is pretty reasonable, and may be ok for what I need, even if it's not perfect. Certainly seems easier! :)

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