[Quoting Mattia Barbon, on March 23 2008, 18:33, in "Re: Stupid question "]
>      $self->SetAcceleratorTable
>        ( Wx::AcceleratorTable->new
>          ( [ wxACCEL_CTRL, 'W', wxID_CLOSE ],
>            [ wxACCEL_ALT,  'W', <some id> ],
>            ...
>            );
> 
>      EVT_MENU( $self, <some id>, sub { <close window> } );
> 
>    Should work.  You can use accelerators with both existing
> menu items/event and "fictional" ones that only exixt to be
> used by the accelerator.

I tried this:

        my $cc = Wx::NewId();
        $self->SetAcceleratorTable
          ( Wx::AcceleratorTable->new
            ( [ wxACCEL_ALT,  'Z', $cc ] ) );

        Wx::Event::EVT_MENU($self, wxID_CLOSE, \&OnClose);
        Wx::Event::EVT_MENU($self, $cc, \&OnClose);

Now, Ctrl-W works (due to the EVT_MENU on wxID_CLOSE). But Alt-Z does
not work. What am I overlooking?

-- Johan

Reply via email to