Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » enable overwrite in text widget
enable overwrite in text widget [message #435743] Mon, 03 May 2004 23:01 Go to next message
Chris Gross is currently offline Chris Gross
Messages: 471
Registered: July 2009
Senior Member
I'm using a verify listener to check the input on a text widget (date mask).
I'd like the text to work in overwrite mode. In other words, when the user
types, the keyed character overwrites the character at the caret position.
I'm not sure how to accomplish that.

I tried modifying the keyevent fields but it seems there is only support for
adding to the text field. I tried changing the start and end positions of
the event but that didn't seem to have any effect on the text inserted (but
changing the text field does effect the text added).

Any help is appreciated.

-Chris
Re: enable overwrite in text widget [message #435788 is a reply to message #435743] Tue, 04 May 2004 03:22 Go to previous messageGo to next message
Robert Bacs is currently offline Robert Bacs
Messages: 165
Registered: July 2009
Senior Member
Hi,

Try to modify the text field in the verify event.

Boby

"Chris" <schtoo@schtoo.com> wrote in message
news:c770mv$e9k$1@eclipse.org...
> I'm using a verify listener to check the input on a text widget (date
mask).
> I'd like the text to work in overwrite mode. In other words, when the
user
> types, the keyed character overwrites the character at the caret position.
> I'm not sure how to accomplish that.
>
> I tried modifying the keyevent fields but it seems there is only support
for
> adding to the text field. I tried changing the start and end positions of
> the event but that didn't seem to have any effect on the text inserted
(but
> changing the text field does effect the text added).
>
> Any help is appreciated.
>
> -Chris
>
>
Re: enable overwrite in text widget [message #435794 is a reply to message #435788] Tue, 04 May 2004 09:05 Go to previous messageGo to next message
Chris Gross is currently offline Chris Gross
Messages: 471
Registered: July 2009
Senior Member
I've tried that as well. The problem with ths solution is that, because I
have to refuse the edit through event.doit = false and then set the new text
directly, the caret doesn't change position.

-Chris

"Robert Bacs" <boby@zerosoft.ro> wrote in message
news:c77fvc$rpa$1@eclipse.org...
> Hi,
>
> Try to modify the text field in the verify event.
>
> Boby
>
> "Chris" <schtoo@schtoo.com> wrote in message
> news:c770mv$e9k$1@eclipse.org...
> > I'm using a verify listener to check the input on a text widget (date
> mask).
> > I'd like the text to work in overwrite mode. In other words, when the
> user
> > types, the keyed character overwrites the character at the caret
position.
> > I'm not sure how to accomplish that.
> >
> > I tried modifying the keyevent fields but it seems there is only support
> for
> > adding to the text field. I tried changing the start and end positions
of
> > the event but that didn't seem to have any effect on the text inserted
> (but
> > changing the text field does effect the text added).
> >
> > Any help is appreciated.
> >
> > -Chris
> >
> >
>
>
Re: enable overwrite in text widget [message #720551 is a reply to message #435794] Tue, 30 August 2011 15:48 Go to previous messageGo to next message
David L is currently offline David L
Messages: 3
Registered: August 2011
Junior Member
I have exactly the same need. This seems so simple to add to the Text.java class using native code, at least
for the gtk2 interface. Have you found a workaround using pure Java?
Re: enable overwrite in text widget [message #721369 is a reply to message #720551] Thu, 01 September 2011 11:20 Go to previous message
David L is currently offline David L
Messages: 3
Registered: August 2011
Junior Member
A solution is to use instead org.eclipse.swt.custom.StyledText:

display = new Display();
shell = new Shell(display);
text = new StyledText(shell, SWT.MULTI | SWT.WRAP);
text.invokeAction(ST.TOGGLE_OVERWRITE);
Previous Topic:Why is there a limit on no of widgets, based on no of handles?
Next Topic:Layout problem when resizing shell
Goto Forum:
  


Current Time: Thu Aug 28 07:33:45 EDT 2014

Powered by FUDForum. Page generated in 0.01676 seconds