Emuforums.com

Go Back   Emuforums.com > General Discussion > Web development / Programming
About Us Register FAQ Members List Calendar Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old April 24th, 2004   #1 (permalink)
Protect EVERYONE
 
ChaosBlade's Avatar
 
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.
ChaosBlade is offline   Reply With Quote
Old April 24th, 2004   #2 (permalink)
Single
 
SnakeBite's Avatar
 
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.
SnakeBite is offline   Reply With Quote
Old April 24th, 2004   #3 (permalink)
Protect EVERYONE
 
ChaosBlade's Avatar
 
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.
ChaosBlade is offline   Reply With Quote
Old April 24th, 2004   #4 (permalink)
Single
 
SnakeBite's Avatar
 
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.
SnakeBite is offline   Reply With Quote
Old April 24th, 2004   #5 (permalink)
Protect EVERYONE
 
ChaosBlade's Avatar
 
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.
ChaosBlade is offline   Reply With Quote
Old April 29th, 2004   #6 (permalink)
Single
 
SnakeBite's Avatar
 
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.
SnakeBite is offline   Reply With Quote
Old April 29th, 2004   #7 (permalink)
Protect EVERYONE
 
ChaosBlade's Avatar
 
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.
ChaosBlade is offline   Reply With Quote
Old April 29th, 2004   #8 (permalink)
Single
 
SnakeBite's Avatar
 
Join Date: Apr 2002
Location: Norway
Posts: 667
np
__________________
This is my new improved sig.
SnakeBite is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 02:22.

© 2006 - 2008 Emu Forums | About Emu Forums | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.7.0 Release Candidate 3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5