1. [WIN32LIB] Font Confusion
- Posted by Travis Beaty <travis_beaty at mcleodusa.net> Jul 07, 2002
- 377 views
This is a multi-part message in MIME format. ------=_NextPart_000_0001_01C22551.EE255D40 charset="us-ascii" Hello All! I've got an interesting problem that I'm hoping someone can help me out with. I have a group control on a tabItem. On this group control, I originally had five labels, each of which needed to be able to have its own font, font color, and background color. Unfortunately, after trying everything I could think of, as well as other folks' advice, I could not get the font color to change inside the label. (I could do everything else.) I tried setTextColor(), setPenColor(), even what API calls I knew, without success. So, I've decided to draw my own labels. I've done this by simply drawing a filled rectangle corresponding to the boundaries of my "control," then writing within that rectangle using wPuts(). This seemed simple enough, until it came to changing the font before writing to the control. When I do this, the font of the group box changes as well. Is there any way that I can change the font of the pen without changing the font of the control? This will be especially important, because, as I said, it is possible that each one of these five "labels" will have separate fonts. Any ideas about what to do would be greatly appreciated. Travis Beaty Evans, Colorado. ------=_NextPart_000_0001_01C22551.EE255D40 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <html xmlns:o=3D"urn:schemas-microsoft-com:office:office" = xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" = xmlns=3D"http://www.w3.org/TR/REC-html40"> <head> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Dus-ascii"> <meta name=3DProgId content=3DWord.Document> <meta name=3DGenerator content=3D"Microsoft Word 10"> <meta name=3DOriginator content=3D"Microsoft Word 10"> <link rel=3DFile-List href=3D"cid:filelist.xml at 01C22551.E662AB80"> <o:SmartTagType = namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"State"/> <o:SmartTagType = namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"City"/> <o:SmartTagType = namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"place"/> <!--[if gte mso 9]><xml> <o:OfficeDocumentSettings> <o:DoNotRelyOnCSS/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:GrammarState>Clean</w:GrammarState> <w:DocumentKind>DocumentEmail</w:DocumentKind> <w:EnvelopeVis/> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if !mso]> <style> st1\:*{behavior:url(#default#ieooui) } </style> <![endif]--> <style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} span.EmailStyle17 {mso-style-type:personal-compose; mso-style-noshow:yes; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt; font-family:Arial; mso-ascii-font-family:Arial; mso-hansi-font-family:Arial; mso-bidi-font-family:Arial; color:windowtext;} span.GramE {mso-style-name:""; mso-gram-e:yes;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */=20 table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> </head> <body lang=3DEN-US link=3Dblue vlink=3Dpurple = style=3D'tab-interval:.5in'> <div class=3DSection1> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Hello All!<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>I’ve got an interesting problem that I’m = hoping someone can help me out with.<span style=3D'mso-spacerun:yes'> = </span>I have a group control on a tabItem.<span = style=3D'mso-spacerun:yes'> </span>On this group control, I originally had five labels, each of = which needed to be able to have its own font, font color, and background = color.<span style=3D'mso-spacerun:yes'> </span>Unfortunately, after trying = everything I could think of, as well as other folks’ advice, I could not get = the font color to change inside the label. <span style=3D'mso-spacerun:yes'> </span>(I could do everything = else.)<span style=3D'mso-spacerun:yes'> </span>I tried <span = class=3DGramE>setTextColor(</span>), setPenColor(), even what API calls I knew, without = success.<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>So, I’ve decided to draw my own labels.<span style=3D'mso-spacerun:yes'> </span>I’ve done this by simply = drawing a filled rectangle corresponding to the boundaries of my = “control,” then writing within that rectangle using wPuts().<span style=3D'mso-spacerun:yes'> </span>This seemed simple enough, = until it came to changing the font before writing to the control. <span style=3D'mso-spacerun:yes'> </span><span class=3DGramE>When I do = this, the font of the group box changes as well.</span><span style=3D'mso-spacerun:yes'> </span>Is there any way that I can = change the font of the pen without changing the font of the control? <span style=3D'mso-spacerun:yes'> </span>This will be especially = important, because, as I said, it is possible that each one of these five = “labels” will have separate fonts.<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Any ideas about what to do would be greatly = appreciated.<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Travis Beaty<o:p></o:p></span></font></p> <p class=3DMsoNormal><st1:place><st1:City><font size=3D2 = face=3DArial><span = style=3D'font-size:10.0pt;font-family:Arial'>Evans</span></font></st1:Cit= y><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt;font-family:Arial'>, = </span></font><st1:State><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt;font-family:Arial'>Colorado</span></font></st1:= State></st1:place><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt;font-family:Arial'>.<o:p></o:p></span></font></= p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> </div> ------=_NextPart_000_0001_01C22551.EE255D40--
2. Re: [WIN32LIB] Font Confusion
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 07, 2002
- 387 views
This is a multi-part message in MIME format. ------=_NextPart_000_0022_01C225E7.CF593BC0 charset="iso-8859-1" Travis, make each "control" a child Window that has no border. I think this will = allow each to have its own font. I'll knock up an example for you. Also, = I think you can create Owner-Drawn labels that allow you to set the = fonts, so I'll research that too. --------------- Derek. ----- Original Message -----=20 From: Travis Beaty=20 To: EUforum=20 Sent: Sunday, July 07, 2002 5:02 PM Subject: [WIN32LIB] Font Confusion Hello All! =20 I've got an interesting problem that I'm hoping someone can help me = out with. I have a group control on a tabItem. On this group control, = I originally had five labels, each of which needed to be able to have = its own font, font color, and background color. Unfortunately, after = trying everything I could think of, as well as other folks' advice, I = could not get the font color to change inside the label. (I could do = everything else.) I tried setTextColor(), setPenColor(), even what API = calls I knew, without success. =20 So, I've decided to draw my own labels. I've done this by simply = drawing a filled rectangle corresponding to the boundaries of my = "control," then writing within that rectangle using wPuts(). This = seemed simple enough, until it came to changing the font before writing = to the control. When I do this, the font of the group box changes as = well. Is there any way that I can change the font of the pen without = changing the font of the control? This will be especially important, = because, as I said, it is possible that each one of these five "labels" = will have separate fonts. =20 Any ideas about what to do would be greatly appreciated. =20 Travis Beaty Evans, Colorado. =20 =20 ------=_NextPart_000_0022_01C225E7.CF593BC0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML xmlns=3D"http://www.w3.org/TR/REC-html40" xmlns:o =3D=20 "urn:schemas-microsoft-com:office:office" xmlns:w =3D=20 "urn:schemas-microsoft-com:office:word" xmlns:st1 =3D=20 "urn:schemas-microsoft-com:office:smarttags"><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3DWord.Document name=3DProgId> <META content=3D"MSHTML 6.00.2716.2200" name=3DGENERATOR> <META content=3D"Microsoft Word 10" name=3DOriginator><LINK=20 href=3D"cid:filelist.xml at 01C22551.E662AB80" = rel=3DFile-List><o:SmartTagType=20 name=3D"State"=20 namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"></o:SmartTagT= ype><o:SmartTagType=20 name=3D"City"=20 namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"></o:SmartTagT= ype><o:SmartTagType=20 name=3D"place"=20 namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"></o:SmartTagT= ype><!--[if gte mso 9]><xml> <o:OfficeDocumentSettings> <o:DoNotRelyOnCSS/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:GrammarState>Clean</w:GrammarState> <w:DocumentKind>DocumentEmail</w:DocumentKind> <w:EnvelopeVis/> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if !mso]> <STYLE>st1\:* { BEHAVIOR: url(#default#ieooui) } </STYLE> <![endif]--> <STYLE> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} span.EmailStyle17 {mso-style-type:personal-compose; mso-style-noshow:yes; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt; font-family:Arial; mso-ascii-font-family:Arial; mso-hansi-font-family:Arial; mso-bidi-font-family:Arial; color:windowtext;} span.GramE {mso-style-name:""; mso-gram-e:yes;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </STYLE> <!--[if gte mso 10]> <style> /* Style Definitions */=20 table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--></HEAD> <BODY lang=3DEN-US style=3D"tab-interval: .5in" vLink=3Dpurple = link=3Dblue=20 bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>Travis,</FONT></DIV> <DIV><FONT size=3D2>make each "control" a child Window that has no = border. I think=20 this will allow each to have its own font. I'll knock up an example for = you.=20 Also, I think you can create Owner-Drawn labels that allow you to set = the fonts,=20 so I'll research that too.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>---------------</FONT></DIV> <DIV><FONT size=3D2>Derek.</FONT></DIV> <BLOCKQUOTE dir=3Dltr=20 style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; = BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV> <DIV=20 style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20 <A title=3Dtravis_beaty at mcleodusa.net=20 href=3D"mailto:travis_beaty at mcleodusa.net">Travis Beaty</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A = title=3DEUforum at topica.com=20 href=3D"mailto:EUforum at topica.com">EUforum</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Sunday, July 07, 2002 = 5:02 PM</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [WIN32LIB] Font = Confusion</DIV> <DIV><BR></DIV><PRE>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The Euphoria = Mailing List =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 </PRE> <DIV class=3DSection1> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hello=20 All!<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial"><o:p> </o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">I=92ve got an = interesting problem=20 that I=92m hoping someone can help me out with.<SPAN=20 style=3D"mso-spacerun: yes"> </SPAN>I have a group control on a=20 tabItem.<SPAN style=3D"mso-spacerun: yes"> </SPAN>On this group = control, I=20 originally had five labels, each of which needed to be able to have = its own=20 font, font color, and background color.<SPAN style=3D"mso-spacerun: = yes"> =20 </SPAN>Unfortunately, after trying everything I could think of, as = well as=20 other folks=92 advice, I could not get the font color to change inside = the=20 label. <SPAN style=3D"mso-spacerun: yes"> </SPAN>(I could do = everything=20 else.)<SPAN style=3D"mso-spacerun: yes"> </SPAN>I tried <SPAN=20 class=3DGramE>setTextColor(</SPAN>), setPenColor(), even what API = calls I knew,=20 without success.<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial"><o:p> </o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">So, I=92ve decided to = draw my own=20 labels.<SPAN style=3D"mso-spacerun: yes"> </SPAN>I=92ve done = this by simply=20 drawing a filled rectangle corresponding to the boundaries of my = =93control,=94=20 then writing within that rectangle using wPuts().<SPAN=20 style=3D"mso-spacerun: yes"> </SPAN>This seemed simple enough, = until it=20 came to changing the font before writing to the control. <SPAN=20 style=3D"mso-spacerun: yes"> </SPAN><SPAN class=3DGramE>When I do = this, the=20 font of the group box changes as well.</SPAN><SPAN=20 style=3D"mso-spacerun: yes"> </SPAN>Is there any way that I can = change the=20 font of the pen without changing the font of the control? <SPAN=20 style=3D"mso-spacerun: yes"> </SPAN>This will be especially = important,=20 because, as I said, it is possible that each one of these five = =93labels=94 will=20 have separate fonts.<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial"><o:p> </o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Any ideas about what to = do would=20 be greatly appreciated.<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial"><o:p> </o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Travis=20 Beaty<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><st1:place><st1:City><FONT face=3DArial = size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial">Evans</SPAN></FONT></st1:City><FONT=20 face=3DArial size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial">,=20 </SPAN></FONT><st1:State><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial">Colorado</SPAN></FONT></st1:State></st1:place><FONT=20 face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial">.<o:p></o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial"><o:p> </o:p></SPAN></FONT></P> <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20 style=3D"FONT-SIZE: 10pt; FONT-FAMILY: = Arial"><o:p> </o:p></SPAN></FONT></P></DIV><PRE>=3D=3D^=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D This email was sent to: ddparnell at bigpond.com EASY UNSUBSCRIBE click here: <A = href=3D"http://topica.com/u/?b1dd66.b2mL5y">http://topica.com/u/?b1dd66.b= 2mL5y</A> Or send an email to: EUforum-unsubscribe at topica.com T O P I C A -- Register now to manage your mail! <A = href=3D"http://www.topica.com/partner/tag02/register">http://www.topica.c= om/partner/tag02/register</A> =3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</PRE></BLOCKQUOTE></B= ------=_NextPart_000_0022_01C225E7.CF593BC0--
3. Re: [WIN32LIB] Font Confusion
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 07, 2002
- 363 views
Travis, here some code that I think does the sort of thing you are talking about. ------------------ -- colorlabel.exw -- -- This demonstrates one method of creating coloured labels. without warning include win32lib.ew constant SimpleWin = create( Window, "Simple Window", 0, 0, 0, 200, 140, 0 ), lbl1 = create(Window, "Label One", SimpleWin, 5, 5, 120, 20, {WS_VISIBLE,WS_CHILD}), lbl2 = create(Window, "Label Two", SimpleWin, 5, 35, 120, 20, {WS_VISIBLE,WS_CHILD}), lbl3 = create(Window, "Label Three", SimpleWin, 5, 65, 120, 20, {WS_VISIBLE,WS_CHILD}), btn1 = create(Button, "Flip", SimpleWin, 135, 5, 50, 25, 0) sequence lblList lblList = {lbl1,lbl2,lbl3} setFont(lbl1, "Arial", 10, Normal) setFont(lbl2, "Courier New", 14, Normal) setFont(lbl3, "Times Roman", 12, Normal) defineUserProperty(lbl1, "TextColor", BrightRed) defineUserProperty(lbl1, "TextBG", Black) defineUserProperty(lbl2, "TextColor", BrightCyan) defineUserProperty(lbl2, "TextBG", Brown) defineUserProperty(lbl3, "TextColor", BrightWhite) defineUserProperty(lbl3, "TextBG", Blue) integer vPainting vPainting = False ------------------------------------------------ procedure onPaint_lbls(integer self, integer event, sequence parms) ------------------------------------------------ sequence lVal if vPainting = False then vPainting = True lVal = getUserProperty(self, "TextColor") setTextColor( self, lVal[1]) lVal = getUserProperty(self, "TextBG") setWindowBackColor(self, lVal[1]) wPuts( {self, 2,2}, getText(self)) vPainting = False end if end procedure setHandler(lblList, w32HPaint, routine_id("onPaint_lbls")) ------------------------------------------------ procedure onClick_btn1(integer self, integer event, sequence parms) ------------------------------------------------ atom c1, c2 sequence lVal for i = 1 to length(lblList) do lVal = getUserProperty(lblList[i], "TextColor") c1 = lVal[1] lVal = getUserProperty(lblList[i], "TextBG") c2 = lVal[1] setUserProperty(lblList[i], "TextColor", c2) setUserProperty(lblList[i], "TextBG", c1) end for repaintWindow(SimpleWin) end procedure setHandler(btn1, w32HClick, routine_id("onClick_btn1")) WinMain( SimpleWin, Normal) ------------------ Derek
4. Re: [WIN32LIB] Font Confusion
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 07, 2002
- 376 views
Travis, here is the same example with self-centering text... -------------------- -- colorlabel.exw -- -- This demonstrates one method of creating coloured labels. without warning with trace include win32lib.ew constant SimpleWin = create( Window, "Simple Window", 0, 0, 0, 200, 140, 0 ), lbl1 = create(Window, "Label One", SimpleWin, 5, 5, 120, 20, {WS_VISIBLE,WS_CHILD}), lbl2 = create(Window, "Label Two", SimpleWin, 5, 35, 120, 20, {WS_VISIBLE,WS_CHILD}), lbl3 = create(Window, "Label Three", SimpleWin, 5, 65, 120, 20, {WS_VISIBLE,WS_CHILD}), btn1 = create(Button, "Flip", SimpleWin, 135, 5, 50, 25, 0) sequence lblList lblList = {lbl1,lbl2,lbl3} setFont(lbl1, "Arial", 10, Normal) setFont(lbl2, "Courier New", 14, Normal) setFont(lbl3, "Times Roman", 12, Normal) defineUserProperty(lbl1, "TextColor", BrightRed) defineUserProperty(lbl1, "TextBG", Black) defineUserProperty(lbl2, "TextColor", BrightCyan) defineUserProperty(lbl2, "TextBG", Brown) defineUserProperty(lbl3, "TextColor", BrightWhite) defineUserProperty(lbl3, "TextBG", Blue) with trace integer vPainting vPainting = False ------------------------------------------------ procedure onPaint_lbls(integer self, integer event, sequence parms) ------------------------------------------------ sequence lVal sequence lTE sequence text sequence lEx if vPainting = False then vPainting = True lVal = getUserProperty(self, "TextColor") setTextColor( self, lVal[1]) lVal = getUserProperty(self, "TextBG") setWindowBackColor(self, lVal[1]) text = getText(self) lTE = getTextExtent(self, text) lEx = getClientSize(self) wPuts( {self, floor((lEx[3] - lTE[1])/2), floor((lEx[4] - lTE[2])/2)}, text ) vPainting = False end if end procedure setHandler(lblList, w32HPaint, routine_id("onPaint_lbls")) integer vPhase vPhase = 0 sequence vLblText vLblText = {{"One","1"}, {"Two","2"},{"Three","3"}} ------------------------------------------------ procedure onClick_btn1(integer self, integer event, sequence parms) ------------------------------------------------ atom c1, c2 sequence lVal vPhase = not vPhase for i = 1 to length(lblList) do -- Swap Fg and Bg colors lVal = getUserProperty(lblList[i], "TextColor") c1 = lVal[1] lVal = getUserProperty(lblList[i], "TextBG") c2 = lVal[1] setUserProperty(lblList[i], "TextColor", c2) setUserProperty(lblList[i], "TextBG", c1) -- Change width of text. setText(lblList[i], "Label " & vLblText[i][1+vPhase]) end for repaintWindow(SimpleWin) end procedure setHandler(btn1, w32HClick, routine_id("onClick_btn1")) WinMain( SimpleWin, Normal) -------------------- ----- Original Message ----- From: "Travis Beaty" <travis_beaty at mcleodusa.net> To: "EUforum" <EUforum at topica.com> Sent: Monday, July 08, 2002 3:33 AM Subject: RE: [WIN32LIB] Font Confusion > > > Secondly, did you ever test that code I sent on Windows ME to see if it > crashed, and if so, why? Just curious ... got a long way to go in this > project before that becomes a real concern. > This was caused because of bugs in the resource management in the library. I'm rewriting that subsystem, so hopefully this problem will go away. ----------- Derek
5. Re: [WIN32LIB] Font Confusion
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 12, 2002
- 369 views
Thanks Henri. I've just finished rewritting the resource management subsystem in the library and should finish my testing in the next day or two. You can retest it on your system then. --------------- Derek. ----- Original Message ----- From: "Henri Goffin" <H.Goffin at skynet.be> To: "EUforum" <EUforum at topica.com> Subject: RE: [WIN32LIB] Font Confusion > > Derek, > > your sample program generates an error on my system (W2K Pro). I get: > "Error code 491 ezCreateFont: SaveDC failed". Win32Lib version is v057.9. > And here is the ex.err file. > > As an additional hint i have noticed that when i comment out the line: > setWindowBackColor(self, lVal[1]) > in onPaint_lbls i get the colored text but no background (logically) and > when instead i remove the line with wputs in the same proc i get (guess > what) the flipping backgrounds but no text. But in both cases no error > popup. > > This said, i don't need an urgent correction. Just that i like to try out > all examples posted in this forum and i suppose you might like to be > informed of possible bugs. > > May the Eu-phorce be with us forever. > > Henri Goffin > > > ---- > > > >