Re: Text color in wxEuphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message
jiri said...

It does not work, Matt. All three lines remain ... beautifully BLACK! XP Pro, Eu 4.0a2

Sorry, I had only tested on Linux. Windows requires the wxTE_RICH style to allow color:

include wxeud.e  
  
constant main = create( wxFrame, {0, -1, "Client", -1, -1, 700, 400, wxDEFAULT_FRAME_STYLE} )  
constant textbox = create( wxTextCtrl , {main, -1, "", -1, -1, -1, -1, wxTE_MULTILINE + wxTE_READONLY + wxTE_RICH } )  
  
constant ATTRS= {  
	create( wxTextAttr, {} ),  
	create( wxTextAttr, {} ),  
	create( wxTextAttr, {} ) }  
  
set_text_attr_color( ATTRS[1], create( wxColour, {"Black"}) )  
set_text_attr_color( ATTRS[2], create( wxColour, {"Red"}) )  
set_text_attr_color( ATTRS[3], create( wxColour, {"Blue"}) )  
  
constant lines = {  
	"This text in BLACK\n",  
	"This text in RED\n",  
	"This text in BLUE\n" }  
  
integer start, finish  
start = 0  
finish = 0  
for i = 1 to length(lines) do  
	finish += length( lines[i] )  
	append_text(textbox, lines[i])  
	set_text_style( textbox, start, finish, ATTRS[i] )  
	start += length( lines[i] )  
end for  
  
wxMain( main )  

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu