Hi,

    When you use a string as an accelerator function name, it's call
<name>_Click event.
    It's not try to call an "S3" sub but an "S3_Click" Sub.

    Just change :
sub S3 { $W->Caption("Shift-3"); }
    By :
sub S3_Click { $W->Caption("Shift-3"); }
    And it's work ;o)

Laurent.

PS : From last documentation :
  ... when an accelerator is used, a corresponding <name>_Click event is
fired.

> The docs suggest "Shift-3" should work but in fact you need a reference!
>
> snip--->
>
> use Win32::GUI;
>
> $A = new Win32::GUI::AcceleratorTable(
> "Shift-1" => \&S1,
> "Shift-2" => sub { $W->Caption("Shift-2"); },
> "Shift-3" => "S3",
> );
>
> $W = new Win32::GUI::Window(-accel => $A, -width => 200);
> $W->Show(1);
> Win32::GUI::Dialog;
>
> sub S1 { $W->Caption("Shift-1"); }
> sub S3 { $W->Caption("Shift-3"); }
>


Reply via email to