After upgrading from 0.0.558 -> 0.0.670, the right click-menu seems broken in TGL. The right-click menu displays alright, but the event handlers never receive any calls. The normal menus attached to a normal window works fine.

Actually I just installed the 0.0.665 version and it seems it is already broken in that version.

I briefly diffed 558 and 665 but couldn't find anything obvious.


The following minimal example works in 0.0.558, but not in later versions:

#!/usr/local/bin/perl -w

use strict;
use Data::Dumper;
use lib "..";
use Win32::GUI;

my $mnuMain = Win32::GUI::MakeMenu(
                "&File"                                           => "mnuFile",
                " > &New\tCtrl+N"                      => "mnuFileNew",
                );


my $winMain = new Win32::GUI::DialogBox(
      -left   => 700,
      -top    => 50,
      -width  => 300,
      -height => 100,
      -name   => "winMain",
      -text   => "",
      -menu => $mnuMain,
      );

my $btnMenu = $winMain->AddButton(
                -name => "btnMenu",
                -text => "Popup Menu",
                -left => 10,
                -top => 10,
                -height => 20,
                -width => 100,
                );



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


sub ::mnuFileNew_Click {
        print "New selected\n";
        return(1);
        }


sub ::btnMenu_Click {
        print "Popup menu\n";
        my $mnuPopup = Win32::GUI::MakeMenu(
                        "popup"                                               => 
"popup",
                        " > &Left"                                     => 
"mnuEditAlignLeft",
                        );

        $winMain->TrackPopupMenu($mnuPopup->{popup},
                        $winMain->Left + $btnMenu->Left + 20,
                        $winMain->Top + $btnMenu->Top + 20,
                        );

        return(1);
        }


sub ::mnuEditAlignLeft_Click {
        print "align left selected\n";

        return(1);
        }


__END__


Is this not the way to do popup-menus? Are there any examples working with 0.0.670 I could try instead of my approach?

Any reports of other applications that broke popup-menus? Any ideas from the developers?


* reading code *

- The %Win32::GUI::Menus hash, should the value really be the menu object? Should it not be the handle? the XS function GetMenuFromID indicates that. But MenuItem::new and MenuButton::new assigns $self as the value if -name is passed, which it is when called from the sub MakeMenu(). Is that really right?

I tried fixing it in the Perl code, but it didn't help so maybe I'm just not thinking straight... and now I have to go to work :)


/J
-------- ------ ---- --- -- --  --  -    -     -      -         -
Johan Lindström    Sourcerer @ Boss Casinos     [EMAIL PROTECTED]

Latest bookmark: "Assembly Language Windows Applications"
http://grc.com/smgassembly.htm
dmoz (1 of 3): /Computers/Programming/Languages/Assembly/ 66


Reply via email to