1. setTextColor problems
- Posted by blueb at shaw.ca Jan 06, 2002
- 369 views
This is a multi-part message in MIME format. --Boundary_(ID_isJ2wcMs4zAC4Ly9FObwqQ) Hi, I've been using Euphoria for less than a week, so bear with me. I'm having trouble setting a static label's colour with Win32Lib... e.g. setTextColor (Window , color) I've used Judith's **fine** IDE to flesh out a basic form. I've placed an LText label on the form, went to the font property box and brought up the **Font Dialog Box**... and selected my font color, etc. and the IDE didn't respond. No problem, I thought, I'll just edit the source code that Judith's IDE produced. this is the snippet.... -------------------------- global constant LText4 = create( LText, "Blueberry Pies", Window1, 168, 12, 364, 80, 0 ) setWindowBackColor( LText4,16771818) setFont( LText4,"Arial", 26, Bold) setTextColor( LText4, Blue ) -------------------------- I can set the above settings, **except** the colour. I've tried various sample programs to see if I could get some response, but nothing. Is setTextColor broken in Win32Lib? or is it something else? Windows Me, P-III 800, 576megs ram. Regards, --Bob blueb at shaw.ca --Boundary_(ID_isJ2wcMs4zAC4Ly9FObwqQ) Content-type: text/html; charset=iso-8859-1 Content-transfer-encoding: 7BIT <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 5.50.4616.200" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>Hi,<BR> <BR>I've been using Euphoria for less than a week, so bear with me.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>I'm having trouble setting a static label's colour with Win32Lib...</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>e.g. setTextColor (Window , color)</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>I've used Judith's **fine** IDE to flesh out a basic form.<BR>I've placed an LText label on the form, went to the font property box<BR>and brought up the **Font Dialog Box**... and selected my font color, etc. and<BR>the IDE didn't respond.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>No problem, I thought, I'll just edit the source code that Judith's IDE produced.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>this is the snippet....<BR>--------------------------<BR>global constant LText4 = create( LText, "Blueberry Pies", Window1, 168, 12, 364, 80, 0 )<BR>setWindowBackColor( LText4,16771818)<BR>setFont( LText4,"Arial", 26, Bold)<BR>setTextColor( LText4, Blue )<BR>--------------------------</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>I can set the above settings, **except** the colour.<BR>I've tried various sample programs to see if I could get some response, but nothing. </FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>Is setTextColor broken in Win32Lib? or is it something else?</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>Windows Me, P-III 800, 576megs ram.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>Regards,<BR>--Bob<BR><A --Boundary_(ID_isJ2wcMs4zAC4Ly9FObwqQ)--
2. Re: setTextColor problems
- Posted by Irv Mullins <irvm at ellijay.com> Jan 06, 2002
- 358 views
On Sunday 06 January 2002 01:45 pm, you wrote: > > Hi, > > I've been using Euphoria for less than a week, so bear with me. > > I'm having trouble setting a static label's colour with Win32Lib... > > e.g. setTextColor (Window , color) > > I've used Judith's **fine** IDE to flesh out a basic form. > I've placed an LText label on the form, went to the font property box > and brought up the **Font Dialog Box**... and selected my font color, etc. > and the IDE didn't respond. > > No problem, I thought, I'll just edit the source code that Judith's IDE > produced. > > this is the snippet.... > -------------------------- > global constant LText4 = create( LText, "Blueberry Pies", Window1, 168, 12, > 364, 80, 0 ) setWindowBackColor( LText4,16771818) > setFont( LText4,"Arial", 26, Bold) > setTextColor( LText4, Blue ) > -------------------------- > > I can set the above settings, **except** the colour. > I've tried various sample programs to see if I could get some response, but > nothing. > > Is setTextColor broken in Win32Lib? or is it something else? Yes and no; here's Derek's answer to the same question back in August: > is it possible to set the color of the text for a label in Win32lib? > setTextColor doesn't seem to work for a label Hi, your are right in that normally setTextColor() doesn't work for LText, RText and CText controls. This is because the standard events for these built-in controls are trapped by the Windows DLL which of course ignore some of the settings that Win32lib makes. But, all is not lost. If you really want to do this sort of thing (and who doesn't) you can try the type of solution I've given an example for here... -------------------- include win32lib.ew without warning constant mainWin = create(Window, "Test Coloured Labels", 0, 0, 0, 400, 300, 0), labelArea = create(LText, "", mainWin, 5, 5, 200, 25, 0) procedure labelArea_Paint(integer left, integer top, integer width, integer height) -- Draw the background setPenColor(labelArea, Blue) drawRectangle(labelArea, 1, left, top, width, height) -- Draw a border setPenColor(labelArea, BrightCyan) drawRectangle(labelArea, 0, left, top, width, height) drawRectangle(labelArea, 0, left+1, top+1, width-1, height-1) -- Draw the text setPenPos(labelArea, 3, 3) wPuts(labelArea, "Hello, World!") end procedure onPaint[labelArea] = routine_id("labelArea_Paint") -- These need only to be done once, not every paint event. setFont(labelArea, "Courier New", 14, Normal) setTextColor(labelArea, BrightWhite) WinMain(mainWin, 0) --------------------- Hope this helps. Derek. Regards, Irv