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

Re: [MacPerl] Using Mac:: '...' Modules



Chris,

I have just discovered what .t files are (test files, DUH...I'm reasonably
new to Perl/MacPerl), and discovered that the ChooseFiles.t file that is
included with the Mac::Navigation package answers a couple of my questions,
namely how to define a variable of type NavTypeListHandle to feed to the
TYPELIST parameter of NavGetFile, and how to modify the dialogOptionFlags
field.

> Note that I never got the NavTypeList stuff to work, so I just constructed
> my own object from scratch of type NavTypeList and provided a subroutine to
> do the work.

<snip>

> And TYPELIST is, from all I can do, simply an empty hashref object of type
> NavTypeListHandle.  There isat least one a bug in NavTypeListHandle()
> anyway ... it tries to bless a nonreference value.  But I can't get it to
> work if I fix that.

This works:
$typeList = new NavTypeListHandle "R*ch", ["TEXT"];
$inputFiles = NavGetFile($defaultLocation, $dialogOptions, $typeList);

Using the above solves some problems that I noticed $typeList = bless({},
'NavTypeListHandle') was causing, namely, the Show pop-up menu now appears,
the "Shortcuts" button icon now appears, and the cursor is a standard
pointer, instead of a "jittery" MacPerl "processing script" icon.

> So I provide the optional FILTERPROC to do the file filtering "by hand", as
> it were.  This is more flexible anyway ... if you want to open any TEXT
> file, you need to use the FILTERPROC method, I think.  I think the other
> method will only open files of type TEXT for a given application.

This is true, but the "All Readable Documents" Show pop-up menu is always
available, and can be selected as the default with:

$dialogOptions = NavGetDefaultDialogOptions;
# Set the default Show pop-up menu item to "All Readable Documents"
$dialogOptions->dialogOptionFlags($dialogOptions->dialogOptionFlags |
                                  kNavSelectAllReadableItem);

The ChooseFiles.t shows the use of bit-wise AND (&) for the above, but this
is an error.  In order for things to works properly by bit-toggling the
dialogOptionFlags constants, you must use bit-wise OR and XOR (| and ^).

I don't know how you would supply a $typeList NULL value so that a
FILTERPROC could be used, independent of application signature AND not
create the dialog problems mention above, perhaps this is related to the
bug(s) you mention above.

Mark

----------------------
Mark J. Yannuzzi
myannuzzi@aya.yale.edu

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org