[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Bug in Text.setSelection?
|
- From: Doug Pearson <doug-list@xxxxxxxxxxxxxx>
- Date: Wed, 22 Jun 2005 19:52:38 -0700
- Newsgroups: eclipse.platform.swt
- Organization: EclipseCorner
- User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
The code for the Text widget's set selection on Windows looks like this:
public void setSelection (int start) {
checkWidget ();
if (OS.IsDBLocale) start = wcsToMbcsPos (start);
OS.SendMessage (handle, OS.EM_SETSEL, start, start);
OS.SendMessage (handle, OS.EM_SCROLLCARET, 0, 0);
}
I'm looking to implement a common pattern with a text widget, where if
the user has set the caret to a position other than the end of the
widget the window doesn't scroll as new text is added.
The underlying control supports this but because of the call to
"EM_SCROLLCARET" in this method I don't think it's possible to implement
this in SWT. (You need to move the selection to add text to the end of
the control and then move it back).
This scroll caret call seems clearly unnecessary as there's a separate
showSelection() method:
public void showSelection () {
checkWidget ();
OS.SendMessage (handle, OS.EM_SCROLLCARET, 0, 0);
}
so if you want the scroll behavior you can call this method.
So my question is simple: is there any reason not to treat this as a bug
or shall I go ahead and write it up?
Thanks,
Doug