Prima::MDI how to get reference to active child window

From: David Christensen <dpchrist_at_holgerdanske.com>
Date: Sun, 13 Apr 2008 21:28:14 -0700
To: <prima_at_BSD-Dk.dk>

prima:

I am considering writing an application using Windows XP, ActivePerl,
and Prima::MDI:

    http://search.cpan.org/~karasik/Prima-1.25/Prima/MDI.pm

I have written the following test script:

#! /usr/bin/perl -w
use strict;
use Prima qw(Application Buttons MDI);
my $owner = Prima::MDIWindowOwner-> create(
    menuItems => [
        [ '~File' => [
            [ '~New' => sub { shift->insert('Prima::MDI') } ],
            [ '~Close' => sub { shift->client->close } ],
            [ 'E~xit' => sub { shift->close } ],
        ]],
        [ '~Window' => [
            [ '~Cascade' => sub { shift->cascade } ],
            [ '~Tile' => sub { shift->tile } ],
            [ '~Arrange Icons'=> sub { shift->arrange_icons } ],
        ]],
    ],
    onDestroy => sub { $::application-> close },
);
run Prima;

There is a bug in the above program -- the File -> Close menu item
closes the entire application; it is supposed to only close the active
child window. Apparently, "shift->client" is the wrong incantation for
obtaining a reference to the active child window object. How do I get a
reference to the active child from the point of view of the parent?
Calling close() on such will close the child, right?

TIA,

David
Received on Mon 14 Apr 2008 - 06:28:23 CEST

This archive was generated by hypermail 2.2.0 : Sat 19 Mar 2011 - 18:35:06 CET