Re: without buttons
Re: without buttons
- Subject: Re: without buttons
- From: John W Baxter <email@hidden>
- Date: Tue, 10 Jul 2001 22:50:18 -0700
Robert Poland <email@hidden> wrote
>
Wizards,
>
>
I watched and tried the scripts using
>
>
Display Dialog "Text" giving up after 2 without buttons
>
>
Am I mistaken in thinking that "without buttons" should yield a
>
window without buttons?
>
>
All I get is a single button labeled "False".
1. I don't see without buttons in the dictionary entry for the display
dialog scripting addition (part of Standard Additions).
display dialog: Display a dialog box, optionally requesting user input
(from User Interaction) (defined in: Standard Additions)
display dialog string -- the text to display in dialog box
[default answer string] -- the default editable text
[buttons list] -- a list of up to three button names
[default button number or string] -- the name or number of the
default button
[with icon stop/note/caution] --
or one of these system icons
[giving up after integer] -- number of seconds to wait before
automatically dismissing dialog
Result: dialog reply -- a record containing the button clicked and
text entered (if any)
There is indeed a parameter named buttons. But what it expects is a list
of (one, two, or three) strings...it will take 0 strings and make a blank
button...it should probably treat a list of no strings the same as the
absence of the buttons parameter: Cancel and OK buttons.
What I get (Mac OS 9.1, AppleScript 1.6) is an error message about can't
make some data into the expected type. Perhaps the scripting addition has
been "fixed."
>
>
Display Dialog "Text" buttons "" giving up after 2 buttons ""
>
>
will at least give a blank button.
>
>
OR
>
>
Do I need one more OSAX to make this work?
You can't do it with display dialog...you probably can with Dialog Director
(which I've never used).
>
>
It occurs to me if I was able to create a window "without buttons"
>
and if I didn't give up, the script wouldn't either.
Yes. Although there are likely ways to force it to, short of rebooting.
But since you can't create such a dialog (using display dialog) it's not a
major worry.
Now let's look at why you get a button named false.
without buttons
gives the buttons parameter the value false (a constant).
It looks as if the version of display dialogs asks for the buttons
parameter as a list. No problem...the Apple Event Manager obligingly
coerces the
false
into the list
{ false }
Now (your) display dialog (version) asks for the first item in the list as
a string. It's not: it's a constant...but no problem: Apple Event
Manager is quite willing to coerce the true and false constants into the
strings "true" and "false" so it does, and display dialog believes that
what it got was { "false" } so it makes a button labeled "false."
The version I have seems to protect against that...probably by checking the
type(s) of the list item(s) for the buttons parameter and rejecting the
constant false.
--John
[For extra credit, note that while AE Manager provides the true and false
constants (codes 'true' and 'fals' unless my memory is gone*), it also
provides a data type which represents a boolean by means of the values 1
(true) and 0 (false).]
*...'true' and 'fals' it is.
--
John Baxter email@hidden Port Ludlow, WA, USA