[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] 5.2.0r4b2 Bug? - icon/control dialog items



The following may indicate that there's a bug in the Mac-specific
dialog code in 5.2.0r4b2 (and 5.1.9r4)

OTOH it may be just me. If it's me, could someone point out my error(s)
to set me right as I need a way to add a popup menu to a dialog.

Thanks,

Les


#!perl -w
#
# Illustrates that something isn't quite right in the
# the item list code in dialogs.pm.
# 
# I discovered this when trying to add a popup to
# a dialog using kResourceControlDialogItem()
# Neither type of item will work for me!
#
# I've omitted the code which opened my resource file
# and substituted the system resource kCautionIcon()
# for this illustration.
#
# Tested on Duo 230, Quadra 800/68K and Quadra 800/PowerPC
# using MacPerl 5.1.9r4 and MacPerl 5.2.0r4b2
# under System 7.1, System 7.6.1 and System 8.1

use strict;
use Mac::Windows;
use Mac::QuickDraw;
use Mac::Events;
use Mac::Dialogs;

my $dlg = MacDialog->new(
    Rect->new(15, 50, 410, 130),
    "Why won't the icon display?",
    1,
    movableDBoxProc(),              # window style
    0,                              # has go away box?
    # 1
    [ kButtonDialogItem(),
        Rect->new(300, 30, 380, 50), 'Exit' ],
    # 2
    [ kIconDialogItem(),
        Rect->new(8, 8, 40, 40), kCautionIcon() ]
);

SetDialogDefaultItem ( $dlg->window(), 1 );
$dlg->item_hit ( 1 => \&hit_exit_btn );

while ($dlg->window()) {
    # neither form changes the behavior
    #$dlg->modal();
    WaitNextEvent();
}

END {
    $dlg->dispose() if (defined($dlg));
}

sub hit_exit_btn {
    my ( $dlg ) = @_;

    $dlg->dispose();
    return(1);
}



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch