Re: Multiline Edit text select



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







.



Relevant Pages

  • Re: Reset multi select
    ... Just requery the list box using a Macro or a Command Button and call it CLEAR SELECTIONS or somthing. ... > That's strange. ... > Steve Schapel, Microsoft Access MVP ...
    (microsoft.public.access.formscoding)
  • Re: Multiline Edit text select
    ... messages get through to *any* window to which you might send them, ... to your edit control. ... The strange and irritating thing is, the text appears highlighted in its ... which involves selecting the text and using EM_REPLACESEL, ...
    (microsoft.public.windowsce.embedded)
  • Re: Outlook 2003 email addressing issue
    ... the Message Window? ... > window opens up called Select Names and a box titled Outlook Address Book ... > I can get the To: and Cc: selections to take hold if I do all selections ...
    (microsoft.public.outlook.general)
  • Re: Outlook 2003 email addressing issue
    ... the Message Window? ... > window opens up called Select Names and a box titled Outlook Address Book ... > I can get the To: and Cc: selections to take hold if I do all selections ...
    (microsoft.public.outlook)
  • Re: Outlook 2003 email addressing issue
    ... Remove/Re-add the Outlook Address Book Service ... I am selecting the addresses in the Select Names dialogue which ... > into the To: and Cc: rows in the message window. ... >>> selections - Outlook Address Book and Contacts. ...
    (microsoft.public.outlook.general)