Re: Multiline Edit text select
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Tue, 29 Apr 2008 08:26:29 -0700
Right, but the whole of the text, with the selections, still ends up
selected, right? It must be that the dialog is doing that for you at the
end of dialog initialization. It appears to me that, if you use
PostMessage() to send the message, rather than SendMessage(), you can make
the call during initialization of the dialog and everything will work fine.
That would save you from having to fire a timer, etc.
PostMessage( GetDlgItem( hDlg, IDC_EDIT), EM_SETSEL, 5, 5 );
for example.
Paul T.
"Peter A" <as6ey6j@xxxxxxxxx> wrote in message
news:e1$WmscqIHA.2292@xxxxxxxxxxxxxxxxxxxxxxx
Thanks for your response. I tried various combinations with EM_SETSEL but
none worked. I found by doing it later - after InitDialog - it worked. So
I've implemented a work-around: set a timer for 100 ms [there being no
obvious other event I could employ] and issue the command then. But it's
still strange: all the other EM_SETSEL's I issue for text replacements are
done during InitDialog and work.
Peter
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:%23Q2SVIUqIHA.1952@xxxxxxxxxxxxxxxxxxxxxxx
My best guess is that you're just doing the EM_SETSEL wrong. Have you
tried using 0, and -1 as the wParam and lParam parameters with EM_SETSEL?
Remember, too, that you must have a working message loop in order to have
messages get through to *any* window to which you might send them,
including to your edit control.
Paul T.
"Peter A" <as6ey6j@xxxxxxxxx> wrote in message
news:%23TUgej6pIHA.3428@xxxxxxxxxxxxxxxxxxxxxxx
Well, I have a multiline Edit control and I fill it with text on
InitDialog.
The strange and irritating thing is, the text appears highlighted in its
entirety - which presumably means "selected" - and I am quite unable to
unselect (or unhighlight) the text from within the program. Sending
EM_SETSEL with start position -1 (or any other value) has apparently no
effect.
Stranger still, I replace some place holders in the text by variable
data, which involves selecting the text and using EM_REPLACESEL, and
this works O.K. Yet, at the end of all this, still all the text in the
control is selected.
(Behaviour is the same on the Emulator and on the device (Windows CE
2003)).
Anyone any ideas?
Thanks
--
Peter Aspey
E-mail: replace 6 by p
.
- References:
- Re: Multiline Edit text select
- From: Paul G. Tobey [eMVP]
- Re: Multiline Edit text select
- Prev by Date: Re: connecting to CEPC under Vista
- Next by Date: Re: Porting Windows Driver to Windows CE
- Previous by thread: Re: Multiline Edit text select
- Next by thread: Registering a Port
- Index(es):
Relevant Pages
|
|