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

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

Mario,

Thanks for trying in the blind; WM_SETSEL isn't it, & WM_SETFOCUS didn't
work, & I couldn't find any other constant that looked like it would be the
one either..

But Derek's setFocus() suggestion worked fine.

Dan

----- Original Message ----- 
From: "Mario Steele" <eumario at tuscanchat.com>
To: <EUforum at topica.com>
Sent: Tuesday, August 17, 2004 12:50 AM
Subject: Re: [WIN] richedit: how to programmatically select text?


>
>
> You can either do that, or you can use this method of selecting text.
>
> }}}
<eucode>
> include win32lib.ew
> constant mywin = create(Window,"RichEdit
Text",0,Default,Default,300,200,0),
>                 riched = create(RichEdit,"",mywin,0,0,300,200,0),
>                 mFile = create(Menu,"&File",mywin,0,0,0,0,0),
>                 mSelTex = create(MenuItem,"&Select Text",mFile,0,0,0,0,0),
>                 mSep1 = create(MenuItem,"-",mFile,0,0,0,0,0),
>                 mExit = create(MenuItem,"E&xit",mFile,0,0,0,0,0)
>
> procedure onResize_mywin(integer id, integer event, sequence param)
>     param = getClientRect(mywin)
>     setRect(riched,0,0,param[3],param[4],1)
> end procedure
> setHandler(mywin,w32HResize,routine_id("onResize_mywin"))
>
> procedure onOpen_mywin(integer id, integer event, sequence param)
>     setText(riched,"Hello World, this is a Select Text demo")
> end procedure
> setHandler(mywin,w32HOpen,routine_id("onOpen_mywin"))
>
> procedure onClick_mSelText(integer id, integer event, sequence param)
>     object void
>     void = sendMessage(riched,WM_SETSEL,0,15)
> end procedure
> setHandler(mSelText,w32HClick,routine_id("onClick_mSelText"))
>
> procedure onClick_mExit(integer id, integer event, sequence param)
>     closeWindow(mywin)
> end procedure
> setHandler(mExit,w32HClick,routine_id("onClick_mExit"))
>
> WinMain(mywin,Normal)
> </eucode>
{{{

>
> This code is untested, seeing as I'm now on Linux, and no longer have
> access to a Windows Computer.  But if I'm right, this should work, minus
> the fact, that it might be another Window Message Constant, but it
> should be something similar to that.
>
> EuMario
>
>
>
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu