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

[MacPerl] Problem using Mac::Dialogs



I've still not been able to find a solution to a problem that has
been bothering me since April.

I want to use Mac::Dialogs to display a dialog box which contains a
popup menu. This would involve using a resource-based control which
would be one one of the items in the dialog item list.

To experiment, I created the following dialog which simply tries to
create a dialog with a resource-based icon item. It should display
a caution icon but doesn't.

If anyone has any tips for me it would really be appreciated.

Thanks,

Les


#!perl -w
#
# Illustrates that something may not be quite right in
# 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!
#
# Tested on G3, Duo 230, Quadra 800/68K and Q800/PowerPC
# using MacPerl 5.1.9r4, 5.2.0r4b2, and 5.2.0r4
# 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(),
    0,
    # 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 visual behavior
    #$dlg->modal();
    # or
    WaitNextEvent();
}

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

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

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

__END__



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