Board index » delphi » Q: MULTIPLE FONTS WITHIN TMEMO IN DELPHI 1.0?

Q: MULTIPLE FONTS WITHIN TMEMO IN DELPHI 1.0?

Hello,

I'm writing (or trying to...) my own code editor. Only problem is that I want
to have colours change for various bits of code (just like in the delphi code
editor) at runtime; TMemo can't accomplish this. I'm trying to write my own
TMemo type component but have found it most difficult. Basically I'v defined
my own structure to store character information, font information and use
Windows API calls to write the text to the particular window I'm using at the
time. Getting all this to work has got to be one of the hardest exercises I've
ever tried. Does anyone know of a multiple font,colour etc editor possibly
with code so that I could have a look how it's done??

Please email me on Cic...@c031.aone.net.au as I don't frequest newsgroups very
often.

Thanks in advance... any answers would be greatly appreciated.

Steven

 

Re:Q: MULTIPLE FONTS WITHIN TMEMO IN DELPHI 1.0?


Quote
In article <4m8vbp$...@news.mel.aone.net.au>, cic...@c031.aone.net.au (Cicero) writes:
>Hello,

>I'm writing (or trying to...) my own code editor. Only problem is that I want
>to have colours change for various bits of code (just like in the delphi code
>editor) at runtime; TMemo can't accomplish this. I'm trying to write my own
>TMemo type component but have found it most difficult. Basically I'v defined
>my own structure to store character information, font information and use
>Windows API calls to write the text to the particular window I'm using at the
>time. Getting all this to work has got to be one of the hardest exercises I've
>ever tried. Does anyone know of a multiple font,colour etc editor possibly
>with code so that I could have a look how it's done??

>Please email me on Cic...@c031.aone.net.au as I don't frequest newsgroups very
>often.

Not a solution, just a comment.  There's an editor out there that does
all this, and is (presumably) written in Delphi; namely the Delphi code
editor itself.  I've always thought that it would be
wonderful/magnanimous/generous/excellent of Borland to release some
parts of the souce code to the IDE itself for developers to see how it's
done; and certainly packaging the code editor as a drop in component
(with source or not) would be a great addition to our arsenal.

How about it Borland?

Quote
>Thanks in advance... any answers would be greatly appreciated.

>Steven

Greetings from an almost namesake,
-* Stephen *-
Stephen Posey
University of New Orleans
Email  : S...@uno.edu
WWW    : http://www.uno.edu/~slp

Re:Q: MULTIPLE FONTS WITHIN TMEMO IN DELPHI 1.0?


In article <4mas0b$...@www.uno.edu>, s...@uno.edu says...

Quote

>In article <4m8vbp$...@news.mel.aone.net.au>, cic...@c031.aone.net.au
(Cicero) writes:
>>Hello,

>>I'm writing (or trying to...) my own code editor. Only problem is that I
want
>>to have colours change for various bits of code (just like in the delphi
code
>>editor) at runtime; TMemo can't accomplish this. I'm trying to write my own
>>TMemo type component but have found it most difficult. Basically I'v
defined
>>my own structure to store character information, font information and use
>>Windows API calls to write the text to the particular window I'm using at
the
>>time. Getting all this to work has got to be one of the hardest exercises
I've
>>ever tried. Does anyone know of a multiple font,colour etc editor possibly
>>with code so that I could have a look how it's done??

>>Please email me on Cic...@c031.aone.net.au as I don't frequest newsgroups
very
>>often.

I've accomplished what you want with TListBox, using OwnerDrawFixed.  It is
documented fairly well with the online help.  In essence, each line of the
list box displays a TBitmap, which is stored in the Object of each Item.

Your info is NOT stored in a string, just the bitmap. In fact, each string in
your list can be just ''.  The listbox gives you a flexible area to display
stuff, and a scroll bar pops up when necessary. It works for me.  Good luck.

Re:Q: MULTIPLE FONTS WITHIN TMEMO IN DELPHI 1.0?


Quote
b...@aa.net (Bob Richardson) wrote:
>In article <4mas0b$...@www.uno.edu>, s...@uno.edu says...

>>In article <4m8vbp$...@news.mel.aone.net.au>, cic...@c031.aone.net.au
>(Cicero) writes:
>>>Hello,

>>>I'm writing (or trying to...) my own code editor. Only problem is that I
>want
>>>to have colours change for various bits of code (just like in the delphi
>code
>>>editor) at runtime; TMemo can't accomplish this. I'm trying to write my own
>>>TMemo type component but have found it most difficult. Basically I'v
>defined
>>>my own structure to store character information, font information and use
>>>Windows API calls to write the text to the particular window I'm using at
>the
>>>time. Getting all this to work has got to be one of the hardest exercises
>I've
>>>ever tried. Does anyone know of a multiple font,colour etc editor possibly
>>>with code so that I could have a look how it's done??

The TConsole and TColorConsole components will give you an idea of how
much work is involved in traking text attributes.  These components
were not intended for use as an editor.  You can download them from
Compuserve, and they're on the web.  Do an Alta-Vista search on
TConsole to locate the files.

For 16 bit Delphi, you'd save yourself a lot of heartache by
purchasing a rich-text edit control from one of the many vendors out
there.  Or, upgrade to Delphi 2.0 and use its built-in TRichTextEdit
control.

-Danny

Other Threads