I want to delete object from canvas if press "DELETE" key from
keyboard, how to do this. I tried but it seems not working . i have
attached piece of code , please help me on that.
rectangle.addDomHandler(new KeyDownHandler() {
@Override
public void onKeyDown(KeyDownEvent event) {
if(event.getNativeKeyCode()==KeyCodes.KEY_ENTER)
Window.alert("Rectangle Clicked");
}
},KeyDownEvent.getType());
On Dec 1, 6:53 pm, "$unil" <er.sunilkha...@gmail.com> wrote:
> *plz provide me the samplee*
>
>
>
>
>
>
>
>
>
> On Thu, Dec 1, 2011 at 7:12 PM, $unil <er.sunilkha...@gmail.com> wrote:
> > *I tried but m not able to solve , could you please provide me the
> > sample code.*
>
> > On Thu, Dec 1, 2011 at 6:38 PM, Jovan Perovic <j.perovi...@gmail.com>wrote:
>
> >> I think you'll have to wrap the whole canvas with FocusPanel which can
> >> receive key events. However, this way, you'll need to mark selected objects
> >> somehow (e.g. separate class FocusableRactangle that extends Rectangle) in
> >> order to known which object are to be deleted within keyDown event.
>
> >> Maybe there is another way, but I'm sure this one will work...
>
> >> On Thu, Dec 1, 2011 at 1:20 PM, sunil <er.sunilkha...@gmail.com> wrote:
>
> >>> Hi,
>
> >>> I want to delete object from canvas if press "DELETE" key from
> >>> keyboard, how to do this. I tried but it seems not working . i have
> >>> attached piece of code , please help me on that.
>
> >>> rectangle.addDomHandler(new KeyDownHandler() {
>
> >>> @Override
> >>> public void onKeyDown(KeyDownEvent event) {
>
> >>> if(event.getNativeKeyCode()==KeyCodes.KEY_ENTER)
> >>> Window.alert("Rectangle Clicked");
>
> >>> }
> >>> },KeyDownEvent.getType());
>
> > --
> > *Thanks & Regards*
> > Sunil Khanna
> > Mob - +91 7387425988
>
> > * My Believe--*
> > *"The future belongs to those who believe in the beauty of their Dreams*"
> > * $Thought Become Things*$
>
> --
> *Thanks & Regards*
> Sunil Khanna
> Mob - +91 7387425988
>
> * My Believe--*
> *"The future belongs to those who believe in the beauty of their Dreams*"
> * $Thought Become Things*$