I was wondering if anyone could help me with a little issue I am having.

I am writting an application however when I try to click on some buttons 
that I have defined, it just hangs the script.  I have no idea why it does 
this, it just does.

Anyway, I decided to do away with the buttons and just go with a 
Right-Click menu, however I am having problems getting that to work.  The 
following is my code which I would expect to print out some statements, 
however when I select either Item 1 or Item 2 nothing happens.

Can someone please help me out.

Also, I have tried this on two machines, one running 5.6.1 with .588 and 
the other running 5.8.6 running 1.0, however because of the RichEdit crash 
on exit I would really like this to run on .588.

Thanks.

Len.

--------------------------[ Begin Code ]-------------------------------

use strict;

use Win32::GUI;

my $mainwindow;

create_mainwindow ();

$mainwindow -> Show();

Win32::GUI::Dialog;

sub create_mainwindow  {

        my $window_width = 400;
        my $window_height = 400;

        $mainwindow = Win32::GUI::Window -> new (
                -title          => "Foo",
                -name           => "Main",
                -width          => $window_width,
                -height         => $window_height,
        );

        $mainwindow -> AddListView  (
                -name           => "ListView",
                -top            => 0,
                -left           => 0,
                -width          => $window_width - 10,
                -height         => $window_height - 30,
                -style          => WS_CHILD | WS_VISIBLE | WS_VSCROLL | 1,
                -fullrowselect  => 1,
        );

        $mainwindow -> ListView -> InsertColumn (
                -index          => 0,
                -width          => 150,
                -text           => "Column 1",
        );

        $mainwindow -> ListView -> InsertColumn (
                -index          => 1,
                -width          => 150,
                -text           => "Column 2",
        );

}

sub ListView_RightClick  {

        my $popup_menu = Win32::GUI::MakeMenu (
                "Foo"           => "Foo",
                " > Item 1"     => "Item1",
                " > Item 2"     => "Item2",
        );

        my ( $x, $y ) = Win32::GUI::GetCursorPos ();

        $mainwindow -> TrackPopupMenu ( $popup_menu -> {Foo}, $x, $y );

}

sub Item1_Click  {

        print "DEBUG - Item 1\n";

}

sub Item2_Click  {

        print "DEBUG - Item 2\n";

}

sub Main_Terminate  {

        return -1;

}

--------------------------[ End Code ]-------------------------------
------------------------------------------------------------------------------
Electronic Privacy Notice. This e-mail, and any attachments, contains 
information that is, or may be, covered by electronic communications privacy 
laws, and is also confidential and proprietary in nature. If you are not the 
intended recipient, please be advised that you are legally prohibited from 
retaining, using, copying, distributing, or otherwise disclosing this 
information in any manner. Instead, please reply to the sender that you have 
received this communication in error, and then immediately delete it. Thank you 
in advance for your cooperation.
==============================================================================

Reply via email to