1. setting text color in Rich Edit
Judith,
re: Rich Edit:
I assume you've found out that "cut" works ok in Win32Lib 0.53, but that
there's some difficulty getting user input text colorized.
Here's the best I have found, only problem is, it only works on text which
is *selected*:
in the RE example that comes with Win32Lib, in "procedure CF_onClick()",
(which is the "change font" procedure),
comment out "setFont( RE, {font[4],font[1]} , font[2], font[3] )"
(to remove the *effect* of the font selection dialog),
and add "setFont(RE, {Red,"Arial"}, 20, Normal)"
(to force the font to be Red)
then, when you run it, IF YOU SELECT SOME TEXT, and click "change font", and
in that dialog just hit "ok", it will change the *selected* text to Red. Of
course, the problem here is how to programmatically *select* the text, & I
haven't a clue how to do that.
At this point, (unless maybe someone knows how to programmatically select
text in an acceptable fashion), looks to me like what you did with your own
editor may be the better bet?
Dan
2. Re: setting text color in Rich Edit
----- Original Message -----
From: "Dan B Moyer" <DANMOYER at PRODIGY.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Tuesday, October 10, 2000 12:26 AM
Subject: setting text color in Rich Edit
> At this point, (unless maybe someone knows how to programmatically select
> text in an acceptable fashion), looks to me like what you did with your
own
> editor may be the better bet?
Its undocumented but the setIndex() routine can be used to select text on
RichEdit controls.
eg..
-- Select characters 30 - 43 inclusive...
setIndex(RE, {30, 43})
I should really update the docs on this one.
----
cheers,
Derek
3. Re: setting text color in Rich Edit
Derek,
Nice! I'll give it a try. I was busy trying to figure out how to use
"EM_SETSEL", but yours looks easier.
Thanks!
Dan
----- Original Message -----
From: "Derek Parnell" <dparnell at BIGPOND.NET.AU>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Monday, October 09, 2000 6:36 AM
Subject: Re: setting text color in Rich Edit
> ----- Original Message -----
> From: "Dan B Moyer" <DANMOYER at PRODIGY.NET>
> To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> Sent: Tuesday, October 10, 2000 12:26 AM
> Subject: setting text color in Rich Edit
>
> > At this point, (unless maybe someone knows how to programmatically
select
> > text in an acceptable fashion), looks to me like what you did with your
> own
> > editor may be the better bet?
>
> Its undocumented but the setIndex() routine can be used to select text on
> RichEdit controls.
>
> eg..
> -- Select characters 30 - 43 inclusive...
> setIndex(RE, {30, 43})
>
> I should really update the docs on this one.
>
> ----
> cheers,
> Derek
4. Re: setting text color in Rich Edit
Derek,
That helps a lot for text already in the RichEdit. But lets pretend we have
a text file - or whatever not already richEdit - and want to colorize it as
we putStream or before we putStream?
Do you know a solution to that?
I suppose we could kludge it and inspect the data after streaming into the
RichEdit and colorize it then but it seems it would be faster to colorize as
we putStream.
Judith
On Tue, 10 Oct 2000 00:36:06 +1100, Derek Parnell <dparnell at BIGPOND.NET.AU>
wrote:
>Its undocumented but the setIndex() routine can be used to select text on
>RichEdit controls.
>
>eg..
> -- Select characters 30 - 43 inclusive...
> setIndex(RE, {30, 43})
>
>I should really update the docs on this one.
>
>----
>cheers,
>Derek
5. Re: setting text color in Rich Edit
Derek,
Sorry, should have asked this in last post but didn't think of it in time:
is there some way to get the POSITION of the *cursor* in the Rich Edit
control? (That, plus test for keywords, plus your selection trick, plus
setFont might effect keyword colorizing in the Rich Edit.)
Dan
----- Original Message -----
From: "Derek Parnell" <dparnell at BIGPOND.NET.AU>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Monday, October 09, 2000 6:36 AM
Subject: Re: setting text color in Rich Edit
> ----- Original Message -----
> From: "Dan B Moyer" <DANMOYER at PRODIGY.NET>
> To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> Sent: Tuesday, October 10, 2000 12:26 AM
> Subject: setting text color in Rich Edit
>
> > At this point, (unless maybe someone knows how to programmatically
select
> > text in an acceptable fashion), looks to me like what you did with your
> own
> > editor may be the better bet?
>
> Its undocumented but the setIndex() routine can be used to select text on
> RichEdit controls.
>
> eg..
> -- Select characters 30 - 43 inclusive...
> setIndex(RE, {30, 43})
>
> I should really update the docs on this one.
>
> ----
> cheers,
> Derek
6. Re: setting text color in Rich Edit
Judith,
I *think* in order for a file to get "naturally" colorized as it Streams in,
it has to have been *saved* in some ".rtf" format; but since what's *in* the
Rich Edit control is what would be saved, if it were colorized by Derek's
trick *as it were typed* (similar to what David has happening), then it
would (nearly automatically?) be saved in that format?? Then when it
Streams in, presto, auto color.
Dan
----- Original Message -----
From: "Judith Evans" <camping at FLASH.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Monday, October 09, 2000 6:53 AM
Subject: Re: setting text color in Rich Edit
> Derek,
>
> That helps a lot for text already in the RichEdit. But lets pretend we
have
> a text file - or whatever not already richEdit - and want to colorize it
as
> we putStream or before we putStream?
>
> Do you know a solution to that?
>
> I suppose we could kludge it and inspect the data after streaming into the
> RichEdit and colorize it then but it seems it would be faster to colorize
as
> we putStream.
>
> Judith
>
>
> On Tue, 10 Oct 2000 00:36:06 +1100, Derek Parnell
<dparnell at BIGPOND.NET.AU>
> wrote:
>
>
> >Its undocumented but the setIndex() routine can be used to select text on
> >RichEdit controls.
> >
> >eg..
> > -- Select characters 30 - 43 inclusive...
> > setIndex(RE, {30, 43})
> >
> >I should really update the docs on this one.
> >
> >----
> >cheers,
> >Derek
7. Re: setting text color in Rich Edit
Yeah, but the exe exw might not like Richtext format and I don't want to
write out two files, one to reload with and one for Euphoria.
Judith
On Mon, 9 Oct 2000 07:06:48 -0700, Dan B Moyer <DANMOYER at PRODIGY.NET> wrote:
>Judith,
>
>I *think* in order for a file to get "naturally" colorized as it Streams
in,
>it has to have been *saved* in some ".rtf" format; but since what's *in*
the
>Rich Edit control is what would be saved, if it were colorized by Derek's
>trick *as it were typed* (similar to what David has happening), then it
>would (nearly automatically?) be saved in that format?? Then when it
>Streams in, presto, auto color.
>
>Dan
>
>----- Original Message -----
>From: "Judith Evans" <camping at FLASH.NET>
>To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
>Sent: Monday, October 09, 2000 6:53 AM
>Subject: Re: setting text color in Rich Edit
>
>
>> Derek,
>>
>> That helps a lot for text already in the RichEdit. But lets pretend we
>have
>> a text file - or whatever not already richEdit - and want to colorize it
>as
>> we putStream or before we putStream?
>>
>> Do you know a solution to that?
>>
>> I suppose we could kludge it and inspect the data after streaming into
the
>> RichEdit and colorize it then but it seems it would be faster to colorize
>as
>> we putStream.
>>
>> Judith
>>
>>
>> On Tue, 10 Oct 2000 00:36:06 +1100, Derek Parnell
><dparnell at BIGPOND.NET.AU>
>> wrote:
>>
>>
>> >Its undocumented but the setIndex() routine can be used to select text
on
>> >RichEdit controls.
>> >
>> >eg..
>> > -- Select characters 30 - 43 inclusive...
>> > setIndex(RE, {30, 43})
>> >
>> >I should really update the docs on this one.
>> >
>> >----
>> >cheers,
>> >Derek
8. Re: setting text color in Rich Edit
OOps! Forgot about that! Sorry.
Dan
----- Original Message -----
From: "Judith Evans" <camping at FLASH.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Monday, October 09, 2000 7:15 AM
Subject: Re: setting text color in Rich Edit
> Yeah, but the exe exw might not like Richtext format and I don't want to
> write out two files, one to reload with and one for Euphoria.
>
> Judith
>
>
> On Mon, 9 Oct 2000 07:06:48 -0700, Dan B Moyer <DANMOYER at PRODIGY.NET>
wrote:
>
> >Judith,
> >
> >I *think* in order for a file to get "naturally" colorized as it Streams
> in,
> >it has to have been *saved* in some ".rtf" format; but since what's *in*
> the
> >Rich Edit control is what would be saved, if it were colorized by Derek's
> >trick *as it were typed* (similar to what David has happening), then it
> >would (nearly automatically?) be saved in that format?? Then when it
> >Streams in, presto, auto color.
> >
> >Dan
> >
> >----- Original Message -----
> >From: "Judith Evans" <camping at FLASH.NET>
> >To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> >Sent: Monday, October 09, 2000 6:53 AM
> >Subject: Re: setting text color in Rich Edit
> >
> >
> >> Derek,
> >>
> >> That helps a lot for text already in the RichEdit. But lets pretend we
> >have
> >> a text file - or whatever not already richEdit - and want to colorize
it
> >as
> >> we putStream or before we putStream?
> >>
> >> Do you know a solution to that?
> >>
> >> I suppose we could kludge it and inspect the data after streaming into
> the
> >> RichEdit and colorize it then but it seems it would be faster to
colorize
> >as
> >> we putStream.
> >>
> >> Judith
> >>
> >>
> >> On Tue, 10 Oct 2000 00:36:06 +1100, Derek Parnell
> ><dparnell at BIGPOND.NET.AU>
> >> wrote:
> >>
> >>
> >> >Its undocumented but the setIndex() routine can be used to select text
> on
> >> >RichEdit controls.
> >> >
> >> >eg..
> >> > -- Select characters 30 - 43 inclusive...
> >> > setIndex(RE, {30, 43})
> >> >
> >> >I should really update the docs on this one.
> >> >
> >> >----
> >> >cheers,
> >> >Derek
9. Re: setting text color in Rich Edit
Dan and David,
Good news! The method works! We can now use RichEdit if we want to in the
IDE editor. That would sure simplify things.
Thanks Dan for getting us started on this today.
Judith
10. Re: setting text color in Rich Edit
Judith,
Well, that's wonderful! But I'm curious as to what you did; I wasn't able
to find any way to know where the cursor *is* in the Rich Edit (to know what
position values to use to select text to color the keywords as they're
entered), nor could I think of anything to colorize while Streaming. I
couldn't ever figure out how David got the cursor to be initially present in
his "generic" example (ie, without first mouse clicking).
Anyway, good work, glad I said something that helped, gotta catch some zzz's
now.
Dan
----- Original Message -----
From: "Judith Evans" <camping at FLASH.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Monday, October 09, 2000 7:28 AM
Subject: Re: setting text color in Rich Edit
> Dan and David,
>
> Good news! The method works! We can now use RichEdit if we want to in the
> IDE editor. That would sure simplify things.
>
> Thanks Dan for getting us started on this today.
>
> Judith
11. Re: setting text color in Rich Edit
Hi Dan/Judith
you can use getIndex(RE) which returns an atom that tells you where the
insertion cursor is.
The next win32lib also has getSelection(RE) which retruns a two-element
sequence containing the character positions of the start and end of any
selected text.
These functions also work with MleText and EditText controls.
----
cheers
Derek.
----- Original Message -----
From: "Dan B Moyer" <DANMOYER at PRODIGY.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Tuesday, October 10, 2000 2:27 AM
Subject: Re: setting text color in Rich Edit
> Judith,
>
> Well, that's wonderful! But I'm curious as to what you did; I wasn't able
> to find any way to know where the cursor *is* in the Rich Edit (to know
what
> position values to use to select text to color the keywords as they're
> entered), nor could I think of anything to colorize while Streaming. I
> couldn't ever figure out how David got the cursor to be initially present
in
> his "generic" example (ie, without first mouse clicking).
>
> Anyway, good work, glad I said something that helped, gotta catch some
zzz's
> now.
>
> Dan
>
> ----- Original Message -----
> From: "Judith Evans" <camping at FLASH.NET>
> To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> Sent: Monday, October 09, 2000 7:28 AM
> Subject: Re: setting text color in Rich Edit
>
>
> > Dan and David,
> >
> > Good news! The method works! We can now use RichEdit if we want to in
the
> > IDE editor. That would sure simplify things.
> >
> > Thanks Dan for getting us started on this today.
> >
> > Judith
12. Re: setting text color in Rich Edit
Here's what I found at
It's basically an excerpt from the RTF specification. It's probably easier
to save everything in text format, and color code on the fly. Set up your
color table at the beginning, and insert the color formatting as you go. To
color text on the fly, you could select the word in question, and replace it
with the rich text formatting.
Color Table
The \colortbl control word introduces the color table group, which defines
screen colors, character colors, and other color information. This group has
the following syntax:
<colortbl> '{' \colortbl <colordef>+ '}'
<colordef> \red ? & \green ? & \blue ? ';'
The following are valid control words for this group:
Control
Word Meaning
\redN Red index
\greenN Green index
\blueN Blue index
Each definition must be delimited by a semicolon, even if the definition is
omitted. If a color definition is omitted, the RTF reader uses its default
color. The example below defines the default color table used by Word. The
first color is omitted, as shown by the semicolon following the \colortbl
control word. The missing definition indicates that color 0 is the ''auto''
color.
\red0\green255\blue0;
The foreground and background colors use indexes into the color table to
define a color. For more information on color setup, see your Windows
documentation.
The following example defines a block of text in color (where supported).
Note that the cf/cb index is the index of an entry in the color table, which
represents a red/green/blue color combination.
{\f1\cb1\cf2 This is colored text. The background is color
1 and the foreground is color 2.}
13. Re: setting text color in Rich Edit
Matt,
I'll have to play with this & see what I can do; there's two "on the fly"s,
though: on the fly as text comes in from a file, and on the fly as the user
types into the Rich Edit "screen". The "hidden" <grin> cursor & selection
control functions should help with user entry colorizing, and I guess what
you just supplied would help with the input of a text file to the RichEdit
control.
Thanks!
Dan
----- Original Message -----
From: "Matthew Lewis" <MatthewL at KAPCOUSA.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Monday, October 09, 2000 10:46 AM
Subject: Re: setting text color in Rich Edit
> Here's what I found at
> http://msdn.microsoft.com/library/specs/rtfspec_6.htm
>
> It's basically an excerpt from the RTF specification. It's probably
easier
> to save everything in text format, and color code on the fly. Set up your
> color table at the beginning, and insert the color formatting as you go.
To
> color text on the fly, you could select the word in question, and replace
it
> with the rich text formatting.
>
> Color Table
> The \colortbl control word introduces the color table group, which defines
> screen colors, character colors, and other color information. This group
has
> the following syntax:
>
> <colortbl> '{' \colortbl <colordef>+ '}'
> <colordef> \red ? & \green ? & \blue ? ';'
>
>
> The following are valid control words for this group:
>
> Control
> Word Meaning
> \redN Red index
> \greenN Green index
> \blueN Blue index
>
>
> Each definition must be delimited by a semicolon, even if the definition
is
> omitted. If a color definition is omitted, the RTF reader uses its default
> color. The example below defines the default color table used by Word. The
> first color is omitted, as shown by the semicolon following the \colortbl
> control word. The missing definition indicates that color 0 is the
''auto''
> color.
>
> {\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
> \red0\green255\blue0;
> \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;
> \red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;
> \red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
> \red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
>
> The foreground and background colors use indexes into the color table to
> define a color. For more information on color setup, see your Windows
> documentation.
>
> The following example defines a block of text in color (where supported).
> Note that the cf/cb index is the index of an entry in the color table,
which
> represents a red/green/blue color combination.
>
> {\f1\cb1\cf2 This is colored text. The background is color
> 1 and the foreground is color 2.}