Jump to content

Coloured buttons - how?


nikink
 Share

Recommended Posts

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!

Link to comment
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
Link to comment
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! :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...