1. Set Text Color for wxStaticText

I'm struggling with what seems like it should be a simple enough task.  How
do I change the text color of a wxStaticText control?

include     wxEuphoria.e
include     wxText.e
include     wxSizer.e
include     wxButton.e

constant
MainFrame         = create( wxFrame, {0, -1, "Main", 10, 10, 300, 120}),
MainPanel         = create( wxPanel, {MainFrame, 1, "List"}),
Label             = create( wxStaticText, {MainPanel, -1, "Better off Red",
-1,-1,130,20}),
OKBtn                   = create( wxButton, {MainPanel, -1, "OK"}),
Red               = create( wxColour, "Red")

procedure init( )
      atom vs
      vs = create( wxBoxSizer, wxVERTICAL )
      add_window_to_sizer( vs, Label, 1, wxTOP, 10 )
      add_window_to_sizer( vs, OKBtn, 1, wxTOP + wxLEFT + wxRIGHT +
wxBOTTOM, 10 )
      set_sizer( MainPanel, vs )
end procedure

procedure button_ok( atom this, atom event_type, atom id, atom event )
      set_text_color(Label,Red)
      set_label(Label,"Better off Dead")
end procedure
set_event_handler(OKBtn, get_id(OKBtn), wxEVT_COMMAND_BUTTON_CLICKED,
routine_id( "button_ok" ))

init()

wxMain (MainFrame)


new topic     » topic index » view message » categorize

2. Re: Set Text Color for wxStaticText

Brian K. Clark wrote:
> 
> 
> I'm struggling with what seems like it should be a simple enough task.  How
> do I change the text color of a wxStaticText control?

It's not wrapped, but you need to use:
void = call_member( wxWindowBase_SetForegroundColour, Label, {Red})


Also, the color isn't being created properly.  You need to wrap "Red" in
curly braces:
Red               = create( wxColour, {"Red"})


Matt

new topic     » goto parent     » topic index » view message » categorize

3. Re: Set Text Color for wxStaticText

Thanks Matt

Matt Lewis wrote:
> 
> Brian K. Clark wrote:
> > 
> > 
> > I'm struggling with what seems like it should be a simple enough task.  How
> > do I change the text color of a wxStaticText control?
> 
> It's not wrapped, but you need to use:
> }}}
<eucode>
> void = call_member( wxWindowBase_SetForegroundColour, Label, {Red})
> </eucode>
{{{

> 
> Also, the color isn't being created properly.  You need to wrap "Red" in
> curly braces:
> }}}
<eucode>
> Red               = create( wxColour, {"Red"})
> </eucode>
{{{

> 
> Matt

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu