Re: [WIN] richedit: how to programmatically select text?

new topic     » goto parent     » topic index » view thread      » older message » newer message

> posted by: Derek Parnell <ddparnell at bigpond.com>
>
> danielmoyer wrote:
> >
> > I tried to select text in a richedit (using Win32Lib 59.1) by using
> > setIndex, & it wouldn't work;  is this a bug that's corrected in more
recent
> > versions, or is there an alternate way to programmatically select text
in a
> > richedit control?
>
> Nothing new or fixed here.
>
>    setIndex(myRichEdit, {start, stop} )
>
> What happens when you try?
>
> -- 
> Derek Parnell
> Melbourne, Australia
>

The text between start & stop is not selected (ie, not high-lighted).

In order to experiment with richedit to see if I could use it, I went into
generic.exw & added an "info" button to the tool bar, & put some text in the
richedit like this:

setText(GText, "this is a line\nthis is a second line\n" &
   "select some text & click the right-most question mark\n" &
   "to see the index of start/finish")

And then in the click on that button event did this:


-- richedit info... behavior
procedure onClick_ToolInfo(integer self, integer even, sequence parms)
    atom found

    found = findText(GText, "click", 0, findDown + findMatchCase +
findWholeWord)
    setIndex(GText, {found,  found + length("click")})

       setText({GStatus,2},"")
       setText({GStatus,2},sprint(found))


end procedure
setHandler (ToolInfo, w32HClick, routine_id( "onClick_ToolInfo" ))

I thought the above should have high-lighted "click" when the button in the
toolbar was clicked on, but while the status bar showed the correct position
of the word, it was not high-lighted.

Using:
Win98 1st ed, Eu 2.3, Win32Lib 59.1.

Dan

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu