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

Re: [MacPerl] Dialogs?



On 2/10/1999 at 10:01, g.ann@lagrangenews.com (G. Ann Campbell) wrote:

> Hi all,
> 
> I'm curious about whether it's possible/how to do dialog boxes from MacPerl?
> I'm interested in more than the standard 'where is the file' GetFile boxes;
> I'm thinking of radio buttons for run options.
> 
> I'm sure that if this is doable it's probably covered somewhere, so could you
> point me in the right direction?

The correct way to do this is to use the Mac GUI toolbox modules that come with
MacPerl. I would also recommend that you purchase a copy of the ever popular
"MacPerl Power And Ease" and take a look at Chapter 14.

Alternatively, If you are running OS8.5.x, know some AppleScript, and are lazy
like me, the Standard Additions OSAX includes the Choose From List event and you
could use something like:

set theList to {"blue", "green", "red", "yellow"}
set theChoice to choose from list theList with prompt Â
    "Pick A Color:" default items ("blue") Â
    OK button name "Done" cancel button name Â
    "Later" multiple selections allowed false Â
    without empty selection allowed
if theChoice = false then
    error number -128
else
    display dialog "You chose " & result with icon note buttons Â
    "Yep" default button 1
end if

[note that email usually screws up the soft returns that AS uses for line
continuation, so if any characters look weird, they are supposed to be
Option-Returns.]

No radio buttons, but you could set up your choices as strings in the pick list
and use the results in MacPerl via Do Script.


Richard Gordon
Gordon Consulting & Design
Voice: 770-565-8267  Fax: 770-971-6887



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