0

Is there any way to suppress/disable the Cancel button in a list selection dialog - in other words, force a response? Here's what I came up with (I'm forcing a response by displaying an error message and taking the user back):

try
    with timeout of 3600 seconds -- Wait up to an hour before timing out.
        tell application "Finder"
            activate
            repeat
                set theChoice to choose from list {"yes", "no", "maybe"} with title "Choose from list" with prompt "Pick one" OK button name "Select" cancel button name "Quit"
                if theChoice is false then
                    beep
                    display alert "Noo!"
                else
                    exit repeat
                end if
            end repeat
            theChoice
        end tell
    end timeout
end try

, but I'd rather do right by the user, instead of hinting the selection to be optional.

1

I had the same problem today and found this way out:

set theChoice to choose from list

is returning the list's choice or "false" when the user clicks "Cancel"

So I used it for a loop – honestly quite a bit dirty, but it works.

repeat until endloop is true
    set theChoice to choose from list
    if goTo is not false then
        beep
        display alert "Noo!"
    else
        set endloop to true
    end if
end repeat

I hope I was helpful with my first post in here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .