Thanks Sumit for getting back on this ! My scenario is something like
this -
On pressing Ctrl+z/Ctrl+y, browser performs Undo/Redo in RichTextArea,
I want to support this functionality in Buttons, So my intention was
rather than capturing onBrowserEvents(EventPreviews) just generate ctrl
+z/ctrl+y programmatically on clicking on buttons and let them browser
to handle. This will remove javascript quirks too.
And I didn't find any undo/redo implemenations in RichTextArea.

_Anurag

On Jan 7, 1:11 pm, Reinier Zwitserloot <[email protected]> wrote:
> I assume you meant faking the pressing of a key on the keyboard.
>
> You can't do that directly, no, but you can sort-of call the
> keylisteners on any particular object.
>
> For example, let's say you have a TextBox instance called 'textBox',
> and you want to simulate pressing the 'X' button.
>
> You'll need to do two things:
>
> 1) Simulate the effect of the X button on the textBox itself, which
> means updating the text inside by inserting an X at the current cursor
> position.
>
> 2) Call all keyboardlisteners on textBox.
>
> #2 can be done with some technically nonsupported hackery - each
> implementation of SourcesKeyboardEvents in GWT at least has an
> internal private object of type 'KeyboardListeners', called
> 'keyboardListeners'. While its private, you can still get at it via
> JSNI (look that up) which doesn't know about 'private' and thus allows
> it. Once you have the keyboardListeners, which is really just an
> ArrayList, you can loop through them and fire the appropriate call
> (e.g. onKeyPress) on all of them.
>
> The reason GWT doesn't support this directly is because javascript
> doesn't support it either. GWT isn't magic; it cannot make things that
> are impossible on the target platform possible.
>
> On Jan 2, 2:26 pm, Anurag Tripathi <[email protected]> wrote:
>
> > Can we programmatically generate physical keys in GWT ?
>
> > Scenario : I want to generate some key on clicking in Button !
>
> > If anyone has any idea on this, please let me know -
>
> > _Anurag
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to