|
|
|||||||
| About Us | Register | FAQ | Members List | Calendar | Mark Forums Read |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Protect EVERYONE
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2003
Location: Israel
Posts: 1,959
|
Component that colors parts of text ?
Im writing a chat app as a project in school. The project is written in C++ using the Borland C++Builder 6 IDE (Visual as you can tell) .
Is there a component that can have only parts of its text colored ? I tried messing with RichEdit but it seems it only colors the selected text. Any suggestions ?
__________________
"..Did you win?" "I lost." "You dumbass! You're still alive, You won!"
![]() "I couldn't protect anyone, And i couldn't defeat those who wounded us." I LOST. |
|
|
|
|
|
#2 (permalink) |
|
Single
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Apr 2002
Location: Norway
Posts: 667
|
dunno how Borland C++ works, but try selecting the text programmatically, then apply the text formatting. I've done this with Borland Delphi, and it works perfectly. it's a very bad way of doing it, though, as it's very slow. the best way is to write your own component.
__________________
This is my new improved sig. |
|
|
|
|
|
#3 (permalink) |
|
Protect EVERYONE
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2003
Location: Israel
Posts: 1,959
|
Thats what i thought. I could try doing it with RichEdit and slowly like you mentioned, since im not very good at C++ Yet, and probably cant write a good working visual component - Or maybe could you give me a few pointers ? as to how it can be done ?
__________________
"..Did you win?" "I lost." "You dumbass! You're still alive, You won!"
![]() "I couldn't protect anyone, And i couldn't defeat those who wounded us." I LOST. |
|
|
|
|
|
#4 (permalink) |
|
Single
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Apr 2002
Location: Norway
Posts: 667
|
hmm.. it's a long time ago I did it, but I remember I selected the text using some kind of search function, and used SelStart and SelLength to control which part of the text was selected. Then you can change the formatting like you normally do with selected text. I think the search function was named Find or smth.
__________________
This is my new improved sig. |
|
|
|
|
|
#5 (permalink) |
|
Protect EVERYONE
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2003
Location: Israel
Posts: 1,959
|
Thanks, though im aware of how to select the right text. Since both you and me agree its a rather slow solution, i was wondering if you could suggest how to make a new component as im not sure on how to start myself. Again, i must apologize for not being a very good OOP programmer (yet, hopefully) .
__________________
"..Did you win?" "I lost." "You dumbass! You're still alive, You won!"
![]() "I couldn't protect anyone, And i couldn't defeat those who wounded us." I LOST. |
|
|
|
|
|
#6 (permalink) |
|
Single
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Apr 2002
Location: Norway
Posts: 667
|
err.. I tried writing a component once that formats IRC text into colors, bold, etc, but it ended up really bad. (flickering, slow, scrollbars fscked). the best way is to makea new component that derives from/inherites (or whatever it was called) from the memo class, then override the paint function, and do whatever coding you must do in there. if you haven't written custom components before, I suggest you start with something simple, like making a custom edit or something. the help files that comes with Borland Delphi, really helped me out. Look in your help files, under "Custom Components" or something like that. you'll find everything you need to know there
__________________
This is my new improved sig. |
|
|
|
|
|
#7 (permalink) |
|
Protect EVERYONE
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2003
Location: Israel
Posts: 1,959
|
I see, thanks for all your help :]
__________________
"..Did you win?" "I lost." "You dumbass! You're still alive, You won!"
![]() "I couldn't protect anyone, And i couldn't defeat those who wounded us." I LOST. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|