|
| Different font color in edit control |
| Iniciado por guest, 09,jun. 2015 14:42 - 9 respuestas |
| |
| | | |
|
| |
| Publicado el 09,junio 2015 - 14:42 |
Hi,
I am using a edit control where I am appending text through code. My requirement is alternate font color like below: Line 1 in blue color Line 2 in black color
Any help how to achieve this?
Thanks and Regards, Naveen Rrathan |
| |
| |
| | | |
|
| | |
| |
| Publicado el 09,junio 2015 - 15:37 |
you can define your edit control as RTF it's easy.
just check the WD Coloring Search Example |
| |
| |
| | | |
|
| | |
| |
| Publicado el 09,junio 2015 - 16:01 |
Have a look at RTFSelection()
http://doc.windev.com/en-US/…
You could mark the last added row with ..Cursor and ..CursorEnd, then change the RTF attributes of the selection with RTFSelection.
HTH Sebastian |
| |
| |
| | | |
|
| | |
| |
| Publicado el 09,junio 2015 - 16:17 |
Hi Paulo,
WD Coloring example you mentioned is not helping.
Actually each time I append to my edit control I have to do it with different color,. That is my requirement. Any help?
Thanks and Regards, Naveen Rathan |
| |
| |
| | | |
|
| | |
| |
| Publicado el 09,junio 2015 - 16:23 |
Hi
you can probably do that with the dpen function
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,junio 2015 - 09:09 |
Hi Fabrice,
dPen is not working. Actually I want something like below snippet to work.
EDT_MyEdit = "text1" EDT_MyEdit..Color = DarkBlue EDT_MyEdit = "text2" EDT_MyEdit..Color = Black EDT_MyEdit = "text3"
But this way whole contents are changing their color to the mentioned. But I want only text2 to be in blue and text3 to be in black.
Any help?
Thanks and Regards, Naveen Rathan |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,junio 2015 - 09:52 |
Hi,
I Would probably solve this with my SyntaxEdit component (Component one)
But if you are able to colorize one rtf edit (with one color) why dont you use 2 rtf edit`s?
Edt_Main_Rtf = "" //To hold everything Edt_One_rtf = "" // Pr line Edt_One_rft = "Text line 1" edt_one_rtf..color = //Or whatever you do to colorize a whole rtf colotrol with text RTFAdd(Edt_Main_rtf ,edt_one_rtf) Edt_One_rft = "Text line 2" edt_one_rtf..color = //Or whatever you do to colorize a whole rtf colotrol with text RTFAdd(Edt_Main_rtf,edt_one_rtf) And so forth .. Cheers Tor-Bjarne |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,junio 2015 - 10:26 |
Hi, the 'problem' here is 'knowledge' and ok, it's a bit complicated. It's some years ago when I wrote a WINDEV program which managed RTF-Text (partly automatically) for about 20 different languages and scripts like Georgian and Russian targeting a label printer. And yes, I had to study the RTF specifications ( http://www.biblioscape.com/rtf15_spec.htm ) in order to be able to do what our customer wished. If you really want to stay with RTF then this is your way to go!
I believe that your task is much easier to accomplish, because nowadays you can use an HTML-control and generate a document by adding a header and a body and insert the lines of text with the known tags for font, color and size into the body of that HTML-document. This would circumvent the necessity of studying the RTF-specs. At the end you still could use the HTMLtoRTF(...) function in order to get a 'plain' RTF-text from the HTML-control. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,junio 2015 - 14:26 |
Hi Naveen,
With a RTF control this is fairly easy to do. Here is a simple example:
// Put the following code in the "initialization" section of any RTF control s1 is string = "Line in RED" s2 is string = "Line is GREEN" s3 is string = "Line in BLUE" RTFAdd(MySelf, RTFSelection(s1,rtfColor,LightRed,1,Length(s1))) RTFAdd(MySelf, RTFSelection(s2,rtfColor,LightGreen,1,Length(s2))) RTFAdd(MySelf, RTFSelection(s3,rtfColor,LightBlue,1,Length(s3))) Best regards, Alexandre Leclerc |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,junio 2015 - 16:04 |
Hi Alexandre,
Thanks a ton. You gave the simplest solution of all.
Regards, Naveen Rathan |
| |
| |
| | | |
|
| | | | |
| | |
|