Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Why is this so hard - or am I just a little slow
Why is this so hard - or am I just a little slow [message #457124] Fri, 17 June 2005 15:01 Go to next message
Mark Victory is currently offline Mark VictoryFriend
Messages: 133
Registered: July 2009
Senior Member
How do I send an event to a Text object
Specifically, how do I send a Delete Key press to a Text object?

Thanks,
Mark
Re: Why is this so hard - or am I just a little slow [message #457125 is a reply to message #457124] Fri, 17 June 2005 15:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Typically you don't. You would just get the text and delete the
character that you want deleted and put it back.

Mark Victory wrote:
> How do I send an event to a Text object
> Specifically, how do I send a Delete Key press to a Text object?
>
> Thanks,
> Mark
>
>

--
Thanks,
Rich Kulp
Re: Why is this so hard - or am I just a little slow [message #457126 is a reply to message #457125] Fri, 17 June 2005 15:22 Go to previous messageGo to next message
Mark Victory is currently offline Mark VictoryFriend
Messages: 133
Registered: July 2009
Senior Member
Thanks Rich,

That seems a little odd.

That would require me to duplicate all the "delete" processing that is
already built into the Text control.
Not that the code is onerous but why not let the Text control "do what it
does"?

Also, maybe I just missed it but I didn't see a method that would tell me
what characters are selected in the Text control.

Thanks again,
Mark

"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
news:d8upgi$260$2@news.eclipse.org...
> Typically you don't. You would just get the text and delete the character
> that you want deleted and put it back.
>
> Mark Victory wrote:
>> How do I send an event to a Text object
>> Specifically, how do I send a Delete Key press to a Text object?
>>
>> Thanks,
>> Mark
>
> --
> Thanks,
> Rich Kulp
Re: Why is this so hard - or am I just a little slow [message #457130 is a reply to message #457126] Fri, 17 June 2005 18:18 Go to previous messageGo to next message
Jeff Myers is currently offline Jeff MyersFriend
Messages: 396
Registered: July 2009
Senior Member
Mark,

If you're trying to delete the selected text, try calling the cut()
method on the Text control. If you want to get the selection see the
getSelection(), getSelectionCount() and getSelectionText() methods.

Hope this helps,
- Jeff

Mark Victory wrote:
> Thanks Rich,
>
> That seems a little odd.
>
> That would require me to duplicate all the "delete" processing that is
> already built into the Text control.
> Not that the code is onerous but why not let the Text control "do what it
> does"?
>
> Also, maybe I just missed it but I didn't see a method that would tell me
> what characters are selected in the Text control.
>
> Thanks again,
> Mark

>
>
Re: Why is this so hard - or am I just a little slow [message #457131 is a reply to message #457130] Fri, 17 June 2005 19:50 Go to previous messageGo to next message
Mark Victory is currently offline Mark VictoryFriend
Messages: 133
Registered: July 2009
Senior Member
Thanks Jeff,

Cut( ) is not the way to go as it alters what is on the clipboard.

getSelection( ) allow me to do what I want, I believe.

This all seems ridiculously complicated.
If I could just get the Delete key event to go to my Text control rather
than to the action that has Delete as it's accelerator then life would be
good.

Thanks,
Mark


"Jeff Myers" <myersj@gmail.com> wrote in message
news:d8v44t$fd8$1@news.eclipse.org...
> Mark,
>
> If you're trying to delete the selected text, try calling the cut() method
> on the Text control. If you want to get the selection see the
> getSelection(), getSelectionCount() and getSelectionText() methods.
>
> Hope this helps,
> - Jeff
>
> Mark Victory wrote:
>> Thanks Rich,
>>
>> That seems a little odd.
>>
>> That would require me to duplicate all the "delete" processing that is
>> already built into the Text control.
>> Not that the code is onerous but why not let the Text control "do what it
>> does"?
>>
>> Also, maybe I just missed it but I didn't see a method that would tell me
>> what characters are selected in the Text control.
>>
>> Thanks again,
>> Mark
>
>>
Re: Why is this so hard - or am I just a little slow [message #457138 is a reply to message #457131] Sat, 18 June 2005 00:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mcheung.equilar.com

how about try AddKeyListener()?


"Mark Victory" <mvictory@us.ibm.com> wrote in message
news:d8v9hi$lv7$1@news.eclipse.org...
> Thanks Jeff,
>
> Cut( ) is not the way to go as it alters what is on the clipboard.
>
> getSelection( ) allow me to do what I want, I believe.
>
> This all seems ridiculously complicated.
> If I could just get the Delete key event to go to my Text control rather
> than to the action that has Delete as it's accelerator then life would be
> good.
>
> Thanks,
> Mark
>
>
> "Jeff Myers" <myersj@gmail.com> wrote in message
> news:d8v44t$fd8$1@news.eclipse.org...
>> Mark,
>>
>> If you're trying to delete the selected text, try calling the cut()
>> method on the Text control. If you want to get the selection see the
>> getSelection(), getSelectionCount() and getSelectionText() methods.
>>
>> Hope this helps,
>> - Jeff
>>
>> Mark Victory wrote:
>>> Thanks Rich,
>>>
>>> That seems a little odd.
>>>
>>> That would require me to duplicate all the "delete" processing that is
>>> already built into the Text control.
>>> Not that the code is onerous but why not let the Text control "do what
>>> it does"?
>>>
>>> Also, maybe I just missed it but I didn't see a method that would tell
>>> me what characters are selected in the Text control.
>>>
>>> Thanks again,
>>> Mark
>>
>>>
>
Re: Why is this so hard - or am I just a little slow [message #457146 is a reply to message #457131] Sun, 19 June 2005 02:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bob.objfac.com

In SWT, incoming events are platform-specific. They are then converted
to platform-independent SWT events (in both of the two styles).
Consequently, feeding an SWT control an incoming event is platform-specific.

It's a surprising design point to some, especially those who come from a
scripting background like AppleScript.

That said, I believe some have been successful in recording SWT events
and playing them back, but I don't know how they did it.

Bob

Mark Victory wrote:
> Thanks Jeff,
>
> Cut( ) is not the way to go as it alters what is on the clipboard.
>
> getSelection( ) allow me to do what I want, I believe.
>
> This all seems ridiculously complicated.
> If I could just get the Delete key event to go to my Text control rather
> than to the action that has Delete as it's accelerator then life would be
> good.
>
> Thanks,
> Mark
>
>
> "Jeff Myers" <myersj@gmail.com> wrote in message
> news:d8v44t$fd8$1@news.eclipse.org...
>
>>Mark,
>>
>>If you're trying to delete the selected text, try calling the cut() method
>>on the Text control. If you want to get the selection see the
>>getSelection(), getSelectionCount() and getSelectionText() methods.
>>
>>Hope this helps,
>> - Jeff
>>
>>Mark Victory wrote:
>>
>>>Thanks Rich,
>>>
>>>That seems a little odd.
>>>
>>>That would require me to duplicate all the "delete" processing that is
>>>already built into the Text control.
>>>Not that the code is onerous but why not let the Text control "do what it
>>>does"?
>>>
>>>Also, maybe I just missed it but I didn't see a method that would tell me
>>>what characters are selected in the Text control.
>>>
>>>Thanks again,
>>>Mark
>>
>
Re: Why is this so hard - or am I just a little slow [message #457164 is a reply to message #457131] Mon, 20 June 2005 13:42 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Mark, there are a couple of possibilities here:

First, if you use a StyledText then you can simulate a Delete keypress with
StyledText.invokeAction(ST.DELETE_NEXT).

Alternatively, you can post KeyDown/KeyUp events into the OS as shown in the
snippet below. However, note that there seems to be a bug here on gtk, so
I've logged https://bugs.eclipse.org/bugs/show_bug.cgi?id=100810 .

public static void main (String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setBounds(10,10,200,200);
final Text text = new Text(shell, SWT.BORDER);
text.setBounds(10,50,150,100);
text.setText("abcdefghijklmnop");
final Button button = new Button(shell, SWT.PUSH);
button.setBounds(10,10,90,30);
button.setText("Push");
button.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
Event newEvent = new Event();
newEvent.keyCode = SWT.DEL;
newEvent.type = SWT.KeyDown;
text.setFocus(); // so that key events go to Text
display.post(newEvent);
newEvent = new Event();
newEvent.keyCode = SWT.DEL;
newEvent.type = SWT.KeyUp;
display.post(newEvent);
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}

Grant

"Mark Victory" <mvictory@us.ibm.com> wrote in message
news:d8v9hi$lv7$1@news.eclipse.org...
> Thanks Jeff,
>
> Cut( ) is not the way to go as it alters what is on the clipboard.
>
> getSelection( ) allow me to do what I want, I believe.
>
> This all seems ridiculously complicated.
> If I could just get the Delete key event to go to my Text control rather
> than to the action that has Delete as it's accelerator then life would be
> good.
>
> Thanks,
> Mark
>
>
> "Jeff Myers" <myersj@gmail.com> wrote in message
> news:d8v44t$fd8$1@news.eclipse.org...
> > Mark,
> >
> > If you're trying to delete the selected text, try calling the cut()
method
> > on the Text control. If you want to get the selection see the
> > getSelection(), getSelectionCount() and getSelectionText() methods.
> >
> > Hope this helps,
> > - Jeff
> >
> > Mark Victory wrote:
> >> Thanks Rich,
> >>
> >> That seems a little odd.
> >>
> >> That would require me to duplicate all the "delete" processing that is
> >> already built into the Text control.
> >> Not that the code is onerous but why not let the Text control "do what
it
> >> does"?
> >>
> >> Also, maybe I just missed it but I didn't see a method that would tell
me
> >> what characters are selected in the Text control.
> >>
> >> Thanks again,
> >> Mark
> >
> >>
>
Re: Why is this so hard - or am I just a little slow [message #457169 is a reply to message #457164] Mon, 20 June 2005 14:20 Go to previous messageGo to next message
Stef van Dijk is currently offline Stef van DijkFriend
Messages: 31
Registered: July 2009
Member
One possibility as to why this doesn't work on Gtk is that from my
experience, focus is not given immediately and usually requires the event
loop to be run. Therefore, while you've tried to set focus to the text
field, it may not have actually happened at the time you then posted the
event. To me, that's the big issue with the post() feature. You can't
explicitly indicate the target for the event so you have to play games and
hope for the best.

Stef

"Grant Gayed" <grant_gayed@ca.ibm.com> wrote in message
news:d96h3n$aom$1@news.eclipse.org...
> Mark, there are a couple of possibilities here:
>
> First, if you use a StyledText then you can simulate a Delete keypress
with
> StyledText.invokeAction(ST.DELETE_NEXT).
>
> Alternatively, you can post KeyDown/KeyUp events into the OS as shown in
the
> snippet below. However, note that there seems to be a bug here on gtk, so
> I've logged https://bugs.eclipse.org/bugs/show_bug.cgi?id=100810 .
>
> public static void main (String[] args) {
> final Display display = new Display();
> final Shell shell = new Shell(display);
> shell.setBounds(10,10,200,200);
> final Text text = new Text(shell, SWT.BORDER);
> text.setBounds(10,50,150,100);
> text.setText("abcdefghijklmnop");
> final Button button = new Button(shell, SWT.PUSH);
> button.setBounds(10,10,90,30);
> button.setText("Push");
> button.addListener(SWT.Selection, new Listener() {
> public void handleEvent(Event event) {
> Event newEvent = new Event();
> newEvent.keyCode = SWT.DEL;
> newEvent.type = SWT.KeyDown;
> text.setFocus(); // so that key events go to Text
> display.post(newEvent);
> newEvent = new Event();
> newEvent.keyCode = SWT.DEL;
> newEvent.type = SWT.KeyUp;
> display.post(newEvent);
> }
> });
> shell.open();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch()) display.sleep();
> }
> display.dispose();
> }
>
> Grant
>
> "Mark Victory" <mvictory@us.ibm.com> wrote in message
> news:d8v9hi$lv7$1@news.eclipse.org...
> > Thanks Jeff,
> >
> > Cut( ) is not the way to go as it alters what is on the clipboard.
> >
> > getSelection( ) allow me to do what I want, I believe.
> >
> > This all seems ridiculously complicated.
> > If I could just get the Delete key event to go to my Text control rather
> > than to the action that has Delete as it's accelerator then life would
be
> > good.
> >
> > Thanks,
> > Mark
> >
> >
> > "Jeff Myers" <myersj@gmail.com> wrote in message
> > news:d8v44t$fd8$1@news.eclipse.org...
> > > Mark,
> > >
> > > If you're trying to delete the selected text, try calling the cut()
> method
> > > on the Text control. If you want to get the selection see the
> > > getSelection(), getSelectionCount() and getSelectionText() methods.
> > >
> > > Hope this helps,
> > > - Jeff
> > >
> > > Mark Victory wrote:
> > >> Thanks Rich,
> > >>
> > >> That seems a little odd.
> > >>
> > >> That would require me to duplicate all the "delete" processing that
is
> > >> already built into the Text control.
> > >> Not that the code is onerous but why not let the Text control "do
what
> it
> > >> does"?
> > >>
> > >> Also, maybe I just missed it but I didn't see a method that would
tell
> me
> > >> what characters are selected in the Text control.
> > >>
> > >> Thanks again,
> > >> Mark
> > >
> > >>
> >
>
>
Re: Why is this so hard - or am I just a little slow [message #457170 is a reply to message #457169] Mon, 20 June 2005 14:25 Go to previous messageGo to next message
Stef van Dijk is currently offline Stef van DijkFriend
Messages: 31
Registered: July 2009
Member
BTW, I should add that when I referred to my experience regarding focus on
Gtk, that was with regard to straight Gtk programming and not with using SWT
on Gtk. I haven't looked at the relevent code within SWT to see if it
"waits" until focus is in fact transferred before returning from the
setFocus() call.

Stef

"Stef van Dijk" <not-me@not-here.com> wrote in message
news:d96jc0$e5e$1@news.eclipse.org...
> One possibility as to why this doesn't work on Gtk is that from my
> experience, focus is not given immediately and usually requires the event
> loop to be run. Therefore, while you've tried to set focus to the text
> field, it may not have actually happened at the time you then posted the
> event. To me, that's the big issue with the post() feature. You can't
> explicitly indicate the target for the event so you have to play games and
> hope for the best.
>
> Stef
>
> "Grant Gayed" <grant_gayed@ca.ibm.com> wrote in message
> news:d96h3n$aom$1@news.eclipse.org...
> > Mark, there are a couple of possibilities here:
> >
> > First, if you use a StyledText then you can simulate a Delete keypress
> with
> > StyledText.invokeAction(ST.DELETE_NEXT).
> >
> > Alternatively, you can post KeyDown/KeyUp events into the OS as shown in
> the
> > snippet below. However, note that there seems to be a bug here on gtk,
so
> > I've logged https://bugs.eclipse.org/bugs/show_bug.cgi?id=100810 .
> >
> > public static void main (String[] args) {
> > final Display display = new Display();
> > final Shell shell = new Shell(display);
> > shell.setBounds(10,10,200,200);
> > final Text text = new Text(shell, SWT.BORDER);
> > text.setBounds(10,50,150,100);
> > text.setText("abcdefghijklmnop");
> > final Button button = new Button(shell, SWT.PUSH);
> > button.setBounds(10,10,90,30);
> > button.setText("Push");
> > button.addListener(SWT.Selection, new Listener() {
> > public void handleEvent(Event event) {
> > Event newEvent = new Event();
> > newEvent.keyCode = SWT.DEL;
> > newEvent.type = SWT.KeyDown;
> > text.setFocus(); // so that key events go to Text
> > display.post(newEvent);
> > newEvent = new Event();
> > newEvent.keyCode = SWT.DEL;
> > newEvent.type = SWT.KeyUp;
> > display.post(newEvent);
> > }
> > });
> > shell.open();
> > while (!shell.isDisposed()) {
> > if (!display.readAndDispatch()) display.sleep();
> > }
> > display.dispose();
> > }
> >
> > Grant
> >
> > "Mark Victory" <mvictory@us.ibm.com> wrote in message
> > news:d8v9hi$lv7$1@news.eclipse.org...
> > > Thanks Jeff,
> > >
> > > Cut( ) is not the way to go as it alters what is on the clipboard.
> > >
> > > getSelection( ) allow me to do what I want, I believe.
> > >
> > > This all seems ridiculously complicated.
> > > If I could just get the Delete key event to go to my Text control
rather
> > > than to the action that has Delete as it's accelerator then life would
> be
> > > good.
> > >
> > > Thanks,
> > > Mark
> > >
> > >
> > > "Jeff Myers" <myersj@gmail.com> wrote in message
> > > news:d8v44t$fd8$1@news.eclipse.org...
> > > > Mark,
> > > >
> > > > If you're trying to delete the selected text, try calling the cut()
> > method
> > > > on the Text control. If you want to get the selection see the
> > > > getSelection(), getSelectionCount() and getSelectionText() methods.
> > > >
> > > > Hope this helps,
> > > > - Jeff
> > > >
> > > > Mark Victory wrote:
> > > >> Thanks Rich,
> > > >>
> > > >> That seems a little odd.
> > > >>
> > > >> That would require me to duplicate all the "delete" processing that
> is
> > > >> already built into the Text control.
> > > >> Not that the code is onerous but why not let the Text control "do
> what
> > it
> > > >> does"?
> > > >>
> > > >> Also, maybe I just missed it but I didn't see a method that would
> tell
> > me
> > > >> what characters are selected in the Text control.
> > > >>
> > > >> Thanks again,
> > > >> Mark
> > > >
> > > >>
> > >
> >
> >
>
>
Re: Why is this so hard - or am I just a little slow [message #457177 is a reply to message #457164] Mon, 20 June 2005 18:36 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Actually the problem on gtk is not a Display.post() issue after all, but a
widget inconsistency. On gtk setting focus to a Text selects all of its
contents (unlike the other platforms), so then posting a Delete
KeyDown/KeyUp event predictably clears everything.

"Grant Gayed" <grant_gayed@ca.ibm.com> wrote in message
news:d96h3n$aom$1@news.eclipse.org...
> Mark, there are a couple of possibilities here:
>
> First, if you use a StyledText then you can simulate a Delete keypress
with
> StyledText.invokeAction(ST.DELETE_NEXT).
>
> Alternatively, you can post KeyDown/KeyUp events into the OS as shown in
the
> snippet below. However, note that there seems to be a bug here on gtk, so
> I've logged https://bugs.eclipse.org/bugs/show_bug.cgi?id=100810 .
>
> public static void main (String[] args) {
> final Display display = new Display();
> final Shell shell = new Shell(display);
> shell.setBounds(10,10,200,200);
> final Text text = new Text(shell, SWT.BORDER);
> text.setBounds(10,50,150,100);
> text.setText("abcdefghijklmnop");
> final Button button = new Button(shell, SWT.PUSH);
> button.setBounds(10,10,90,30);
> button.setText("Push");
> button.addListener(SWT.Selection, new Listener() {
> public void handleEvent(Event event) {
> Event newEvent = new Event();
> newEvent.keyCode = SWT.DEL;
> newEvent.type = SWT.KeyDown;
> text.setFocus(); // so that key events go to Text
> display.post(newEvent);
> newEvent = new Event();
> newEvent.keyCode = SWT.DEL;
> newEvent.type = SWT.KeyUp;
> display.post(newEvent);
> }
> });
> shell.open();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch()) display.sleep();
> }
> display.dispose();
> }
>
> Grant
>
> "Mark Victory" <mvictory@us.ibm.com> wrote in message
> news:d8v9hi$lv7$1@news.eclipse.org...
> > Thanks Jeff,
> >
> > Cut( ) is not the way to go as it alters what is on the clipboard.
> >
> > getSelection( ) allow me to do what I want, I believe.
> >
> > This all seems ridiculously complicated.
> > If I could just get the Delete key event to go to my Text control rather
> > than to the action that has Delete as it's accelerator then life would
be
> > good.
> >
> > Thanks,
> > Mark
> >
> >
> > "Jeff Myers" <myersj@gmail.com> wrote in message
> > news:d8v44t$fd8$1@news.eclipse.org...
> > > Mark,
> > >
> > > If you're trying to delete the selected text, try calling the cut()
> method
> > > on the Text control. If you want to get the selection see the
> > > getSelection(), getSelectionCount() and getSelectionText() methods.
> > >
> > > Hope this helps,
> > > - Jeff
> > >
> > > Mark Victory wrote:
> > >> Thanks Rich,
> > >>
> > >> That seems a little odd.
> > >>
> > >> That would require me to duplicate all the "delete" processing that
is
> > >> already built into the Text control.
> > >> Not that the code is onerous but why not let the Text control "do
what
> it
> > >> does"?
> > >>
> > >> Also, maybe I just missed it but I didn't see a method that would
tell
> me
> > >> what characters are selected in the Text control.
> > >>
> > >> Thanks again,
> > >> Mark
> > >
> > >>
> >
>
>
Re: Why is this so hard - or am I just a little slow [message #457245 is a reply to message #457177] Wed, 22 June 2005 16:54 Go to previous message
Mark Victory is currently offline Mark VictoryFriend
Messages: 133
Registered: July 2009
Senior Member
Thanks for all the suggestions, etc.

I did not find an elegant solution for this.
The brute force solution was to do the delete manually via the action who's
accelerator is the <del> key.
This all may be just a confusion on my part as I was an MFC developer in my
previous life. That framework would route the event from the control that
had focus on up to the application frame giving each layer a chance to
process the event.

Thanks again. The help and activity on this forum is much appreciated,
Mark


"Grant Gayed" <grant_gayed@ca.ibm.com> wrote in message
news:d972b4$2k0$1@news.eclipse.org...
> Actually the problem on gtk is not a Display.post() issue after all, but a
> widget inconsistency. On gtk setting focus to a Text selects all of its
> contents (unlike the other platforms), so then posting a Delete
> KeyDown/KeyUp event predictably clears everything.
>
> "Grant Gayed" <grant_gayed@ca.ibm.com> wrote in message
> news:d96h3n$aom$1@news.eclipse.org...
>> Mark, there are a couple of possibilities here:
>>
>> First, if you use a StyledText then you can simulate a Delete keypress
> with
>> StyledText.invokeAction(ST.DELETE_NEXT).
>>
>> Alternatively, you can post KeyDown/KeyUp events into the OS as shown in
> the
>> snippet below. However, note that there seems to be a bug here on gtk,
>> so
>> I've logged https://bugs.eclipse.org/bugs/show_bug.cgi?id=100810 .
>>
>> public static void main (String[] args) {
>> final Display display = new Display();
>> final Shell shell = new Shell(display);
>> shell.setBounds(10,10,200,200);
>> final Text text = new Text(shell, SWT.BORDER);
>> text.setBounds(10,50,150,100);
>> text.setText("abcdefghijklmnop");
>> final Button button = new Button(shell, SWT.PUSH);
>> button.setBounds(10,10,90,30);
>> button.setText("Push");
>> button.addListener(SWT.Selection, new Listener() {
>> public void handleEvent(Event event) {
>> Event newEvent = new Event();
>> newEvent.keyCode = SWT.DEL;
>> newEvent.type = SWT.KeyDown;
>> text.setFocus(); // so that key events go to Text
>> display.post(newEvent);
>> newEvent = new Event();
>> newEvent.keyCode = SWT.DEL;
>> newEvent.type = SWT.KeyUp;
>> display.post(newEvent);
>> }
>> });
>> shell.open();
>> while (!shell.isDisposed()) {
>> if (!display.readAndDispatch()) display.sleep();
>> }
>> display.dispose();
>> }
>>
>> Grant
>>
>> "Mark Victory" <mvictory@us.ibm.com> wrote in message
>> news:d8v9hi$lv7$1@news.eclipse.org...
>> > Thanks Jeff,
>> >
>> > Cut( ) is not the way to go as it alters what is on the clipboard.
>> >
>> > getSelection( ) allow me to do what I want, I believe.
>> >
>> > This all seems ridiculously complicated.
>> > If I could just get the Delete key event to go to my Text control
>> > rather
>> > than to the action that has Delete as it's accelerator then life would
> be
>> > good.
>> >
>> > Thanks,
>> > Mark
>> >
>> >
>> > "Jeff Myers" <myersj@gmail.com> wrote in message
>> > news:d8v44t$fd8$1@news.eclipse.org...
>> > > Mark,
>> > >
>> > > If you're trying to delete the selected text, try calling the cut()
>> method
>> > > on the Text control. If you want to get the selection see the
>> > > getSelection(), getSelectionCount() and getSelectionText() methods.
>> > >
>> > > Hope this helps,
>> > > - Jeff
>> > >
>> > > Mark Victory wrote:
>> > >> Thanks Rich,
>> > >>
>> > >> That seems a little odd.
>> > >>
>> > >> That would require me to duplicate all the "delete" processing that
> is
>> > >> already built into the Text control.
>> > >> Not that the code is onerous but why not let the Text control "do
> what
>> it
>> > >> does"?
>> > >>
>> > >> Also, maybe I just missed it but I didn't see a method that would
> tell
>> me
>> > >> what characters are selected in the Text control.
>> > >>
>> > >> Thanks again,
>> > >> Mark
>> > >
>> > >>
>> >
>>
>>
>
>
Previous Topic:SWT with CrEme on WindowsCE
Next Topic:Seeking non-Eclipse SWT/JFace filding XML viewer/editor
Goto Forum:
  


Current Time: Thu Apr 25 09:43:51 GMT 2024

Powered by FUDForum. Page generated in 0.03517 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top