The other day I wrote: “I never want a dialog to draw attention to itself: a simple title, clear wording, no jokes, no strange button names.” Today I’d like to share a few other opinions on the topic of FileMaker custom dialogs, and as usual, I consider these to be general guidelines, not holy writ.
1. Life is too short to waste time thinking up fancy titles for your dialogs. I use the word “Message” 99.99% of the time.
2. As a general rule, the “non-active” choice should be button #1. If your dialog asks, “This may take several minutes. Would you like to continue?” then button #1 should be No, and #2 should be Yes.
However, if it’s an input dialog, then the active choice will need to be button #1, because currently FileMaker only accepts input via that button. And bear in mind that on the PC (but not on the Mac) hitting the Esc key always chooses button #1. (I know, that doesn’t seem quite right, does it?)
3. Set Get(LastMessageChoice) into a $variable, that way a) you can comment it, b) you can save some wear and tear on the calc engine, and c) very occasionally you will have multi-dialog scenarios and want to know which button was clicked on a dialog prior to the most recent one (in that case, of course, you’d want to use different named $variables for each dialog).
In case it’s not clear, the comment following Get(LastMessageChoice) tells the developer what action is associated with each button. Normally you can’t see that information when working with a script, unless you open up the custom dialog settings.
In the above example, I used an “If/Else If” construction to test the $button variable because I was planning to add more steps to each branch. If I didn’t need to add any further steps, then I could do away with the “If/Else If” steps and replace them with a single Set Variable step:
Set Variable [ $layout id ; Choose ( $button - 1 ; 383 ; 217 ; 288 ) ]
(If you’re not familiar with the Choose function, you can read about it here.)