1. [WIN] RE: Win32lib: setting cursor in RichEdit

Well, duh?, I must be brain dead. I setFocus(RE) and that works. But what if
I want the cursor on the second line?

Judith


On Fri, 13 Oct 2000 06:01:49 -0400, Judith Evans <camping at FLASH.NET> wrote:

>Matt, Derek,
>
>Is there a way to initially set the cursor in the RichEdit control? I have
a
>window with 2 Combo boxes and the RichEdit under them. The window comes up
>with the cursor in the first Combo box.
>
>Thanks,
>
>Judith

new topic     » topic index » view message » categorize

2. Re: [WIN] RE: Win32lib: setting cursor in RichEdit

Hi Judith,

Well, for me setFocus(RE) does *not* work. I'm very surprised.
What *does* work is setText(RE, 13 & 10) to fill the first line of the
RichEdit. But wtf is wrong with setFocus?

Ad

----- Oorspronkelijk bericht -----
Van: Judith Evans <camping at FLASH.NET>
Aan: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Verzonden: vrijdag 13 oktober 2000 12:57
Onderwerp: [WIN] RE: Win32lib: setting cursor in RichEdit


> Well, duh?, I must be brain dead. I setFocus(RE) and that works. But what
if
> I want the cursor on the second line?
>
> Judith
>
>
> On Fri, 13 Oct 2000 06:01:49 -0400, Judith Evans <camping at FLASH.NET>
wrote:
>
> >Matt, Derek,
> >
> >Is there a way to initially set the cursor in the RichEdit control? I
have
> a
> >window with 2 Combo boxes and the RichEdit under them. The window comes
up
> >with the cursor in the first Combo box.
> >
> >Thanks,
> >
> >Judith

new topic     » goto parent     » topic index » view message » categorize

3. [WIN] RE: Win32lib: setting cursor in RichEdit

Hi Ad,


What I've discovered I need to do is setFocus(RE) and then setIndex(RE,
pos). But I still don't know how to put the cursor on the second line if you
are using RTF text. (I can if I don't streamRTF in, however.)

I've played a lot with the RTF codes you have to place in front of your data
and in front of each group of words that need a different font or color. I
got that nicely going, only to discover that getIndex( RE) is not helping me
know where in the stream the user is - just where he in on control. In other
words he might be in position 10 screenwise but positiong 528 streamwise. So
I haven't found a good method to colorize the data while the user works on
it. URGH! Have you had any luck with this? I sure hope I'm doing something
incorrectly and there is a solution. The first method I used was to color
with setIndex/setFont but I didn't like that at all.

Judith


On Fri, 13 Oct 2000 14:13:09 +0200, Ad Rienks <kwibus at ZONNET.NL> wrote:

>Hi Judith,
>
>Well, for me setFocus(RE) does *not* work. I'm very surprised.
>What *does* work is setText(RE, 13 & 10) to fill the first line of the
>RichEdit. But wtf is wrong with setFocus?
>
>Ad
>
>----- Oorspronkelijk bericht -----
>Van: Judith Evans <camping at FLASH.NET>
>Aan: <EUPHORIA at LISTSERV.MUOHIO.EDU>
>Verzonden: vrijdag 13 oktober 2000 12:57
>Onderwerp: [WIN] RE: Win32lib: setting cursor in RichEdit
>
>
>> Well, duh?, I must be brain dead. I setFocus(RE) and that works. But what
>if
>> I want the cursor on the second line?
>>
>> Judith
>>
>>
>> On Fri, 13 Oct 2000 06:01:49 -0400, Judith Evans <camping at FLASH.NET>
>wrote:
>>
>> >Matt, Derek,
>> >
>> >Is there a way to initially set the cursor in the RichEdit control? I
>have
>> a
>> >window with 2 Combo boxes and the RichEdit under them. The window comes
>up
>> >with the cursor in the first Combo box.
>> >
>> >Thanks,
>> >
>> >Judith

new topic     » goto parent     » topic index » view message » categorize

4. Re: [WIN] RE: Win32lib: setting cursor in RichEdit

Judith Evans wrote:

> I've played a lot with the RTF codes you have to place in
> front of your data and in front of each group of words that need a
different
> font or color. I got that nicely going, only to discover that getIndex(
RE) is
> not helping me know where in the stream the user is - just where he in on
> control. In other words he might be in position 10 screenwise but
positiong 528
> streamwise. So I haven't found a good method to colorize the data while
the
> user works on it. URGH! Have you had any luck with this? I sure hope I'm
> doing something incorrectly and there is a solution. The first method I
used
> was to color with setIndex/setFont but I didn't like that at all.

What you might try is mixing your streaming methods.  the get/setIndex()
routines are looking at the content of the control as normal text, whereas
you're streaming in rich text.  For in process colorization, I'd select the
text as normal text, then replace it with a stream of rich text with the
appropriate formatting.  I think the difference between the plain text and
rich text is what's complicating matters.

Matt

new topic     » goto parent     » topic index » view message » categorize

5. [WIN] RE: Win32lib: setting cursor in RichEdit

Matt,

I don't think I quite understand.

Do you mean load a file into the editor (RTF formatted, like I'm doing now)
and onKeyPress, pull all the data out as getRichText, use the cursor
position  from getIndex( RE ) with that position in the getRichText data,
colorize the data bounded by spaces left and right and reload as RTF? That's
a mighty big bunch of data to be moving around. Won't it take time? But it
sounds like it will work. For the IDE there is not that much data in the
editor at a time but for projecting the method into a general purpose
editor, one never knows how much there will be.

I appreciate your ideas.

Judith



On Fri, 13 Oct 2000 10:28:06 -0700, Matthew Lewis <MatthewL at KAPCOUSA.COM>
wrote:

>Judith Evans wrote:
>
>> I've played a lot with the RTF codes you have to place in
>> front of your data and in front of each group of words that need a
>different
>> font or color. I got that nicely going, only to discover that getIndex(
>RE) is
>> not helping me know where in the stream the user is - just where he in on
>> control. In other words he might be in position 10 screenwise but
>positiong 528
>> streamwise. So I haven't found a good method to colorize the data while
>the
>> user works on it. URGH! Have you had any luck with this? I sure hope I'm
>> doing something incorrectly and there is a solution. The first method I
>used
>> was to color with setIndex/setFont but I didn't like that at all.
>
>What you might try is mixing your streaming methods.  the get/setIndex()
>routines are looking at the content of the control as normal text, whereas
>you're streaming in rich text.  For in process colorization, I'd select the
>text as normal text, then replace it with a stream of rich text with the
>appropriate formatting.  I think the difference between the plain text and
>rich text is what's complicating matters.
>
>Matt

new topic     » goto parent     » topic index » view message » categorize

6. Re: [WIN] RE: Win32lib: setting cursor in RichEdit

Judith Evans wrote:

> Matt,
>
> I don't think I quite understand.
>
> Do you mean load a file into the editor (RTF formatted, like
> I'm doing now)
> and onKeyPress, pull all the data out as getRichText, use the cursor
> position  from getIndex( RE ) with that position in the
> getRichText data,
> colorize the data bounded by spaces left and right and reload
> as RTF?

Actually, I was thinking more like just pulling out just the text that's
been edited (last word or line).  You could keep track of what line is being
edited (EM_LINEINDEX, EM_CHARFROMPOS, EM_LINEFROMCHAR should all be useful),
and wait for it to be changed.  At that point, use EM_GETLINE to get the
text of the line, color code it, and stream it back in as rich text.

It's not quite as simple as all that, of course, but that's my take on how
it might be done.  I'm no expert on writing editor stuff, though.

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

7. Re: [WIN] RE: Win32lib: setting cursor in RichEdit

Oh, I didn't know about all those EM_ ers.

I've also just thought about puting the text in originally as setText and
then using setIndex( RE,{n,n}) and setFont to color it. The big hit would
only be at load time. Then as the user works, I would have the cursor
position as reference and replacing text would be easy. Do you think your
method will be better in the long run?

Thanks,
Judith


On Fri, 13 Oct 2000 16:26:35 -0700, Matthew Lewis <MatthewL at KAPCOUSA.COM>
wrote:


>Actually, I was thinking more like just pulling out just the text that's
>been edited (last word or line).  You could keep track of what line is
being
>edited (EM_LINEINDEX, EM_CHARFROMPOS, EM_LINEFROMCHAR should all be
useful),

>Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

8. [WIN] RE: Win32lib: setting cursor in RichEdit

--- Judith Evans <camping at FLASH.NET> wrote:
> I've also just thought about puting the text in originally as setText and
> then using setIndex( RE,{n,n}) and setFont to color it. The big hit would
> only be at load time. Then as the user works, I would have the cursor
> position as reference and replacing text would be easy. Do you think your
> method will be better in the long run?

I doubt my method would be better, assuming that you've got something that
actually works, as opposed to my speculation. ;)  Also, I wouldn't be too
worried about it if the only real slow down is at run time.  Eu seems to do a
really great (read: fast) job at loading/manipulating text files.  It'll prolly
still come up quicker than MS's commercial IDE's.


=====
Matt Lewis
http://www.realftp.com/matthewlewis

__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.
http://im.yahoo.com/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu