Hi,

I've got a problem with popup menus for TabStrip-controls, demonstrated
in the following lines of code.
The same popup menu which works perfectly for the main-window doesn't
work
for the TabStrip-control. The menu is tracked, but the Click-event
handlers
of the MenuItems aren't called.

Any help to get around this problem would be very appreciated.

------------------------------------------------------------------------
---

#!perl -w

use Win32::GUI ();

my $mw  =   new Win32::GUI::Window
    (   -name             =>  'mw',
        -left             =>  100,
        -top              =>  100,
        -width            =>  150,
        -height           =>  100,
        -title            =>  'PopupTest',

        -onMouseRightDown =>  \&popup,
    );
    
my  $ml = $mw ->AddLabel
    (   -name             =>  'ml',
        -left             =>  50,
        -top              =>  38,
        -width            =>  90,
        -height           =>  20,
    );

my $ts  = $mw -> AddTabStrip
    (   -name             =>  'ts',
        -left             =>  0,
        -top              =>  0,
        -width            =>  $mw -> ScaleWidth (),
        -height           =>  21,

        -onMouseRightDown =>  \&popup,
    );

( $ts -> InsertItem
    (   -index            =>  $_,
        -text             =>  "Test_0$_",
    )
) for ( 0 .. 1 );

my $pm = Win32::GUI::MakeMenu
    (   'tabstrip_menu'     =>  'tabstrip_menu',    
        '> Test_00'
            => { -name        =>  'menu_item_00000',
                 -onClick     =>  sub { $ml -> Text ( 'Test_00' ) },
               },
        '> Test_01'         
            => { -name        =>  'menu_item_00001',
                 -onClick     =>  sub { $ml -> Text ( 'Test_01' ) },
               },
    );

$mw -> Show ();
Win32::GUI::Dialog ();

sub popup
{
    my $self = shift ();

    $self -> TrackPopupMenu ( $pm -> { 'tabstrip_menu' },
                              Win32::GUI::GetCursorPos ()
                            );
    return ( 0 );
}

------------------------------------------------------------------------
---

Thanks in advance,
Uwe

Reply via email to