jeffEngland Posted November 8, 2006 Posted November 8, 2006 Is there a way to exectue a script when a one of the "cancel" "continue" "Modify Find" buttons are pressed. I know how to continue the script when the continue button has been pressed. (ie If[ Get(Last Error) =400] etc). Essentially I would like all my buttons to work the same way the continue works, or just being able to disable them all. If anyone has any insight it would be appreciated. Thx Jeff England
ThatOneGuy Posted November 8, 2006 Posted November 8, 2006 There sure is, Jeff! It involves the Get ( LastMessageChoice ) function. Per FM's online help, Get ( LastMessageChoice ) returns a number corresponding to the button clicked in an alert message that is displayed by the Show Custom Dialog script step: • 1 for the first button (by default, labeled OK) • 2 for the second button (by default, labeled Cancel) • 3 for the third button You'll work this into your script by inserting an If statement just below your Show Custom Dialog step. With this new structure in place, you can decide where any error-trapping should be included. Let us know how it works out!
jeffEngland Posted November 8, 2006 Author Posted November 8, 2006 I am aware that the steps you just told me work great for custom dialog boxes, but i am having no luck implementing it for this solution. Because this dialog box is a filemaker dialog box, not a custom dialog box. I tried disabling modify find in custom menus, but no such luck. Please tell me if im being too vague. Thx Jeff England
Ender Posted November 8, 2006 Posted November 8, 2006 You should try disabling the dialog altogether, since you don't really want to allow the choices anyway. Insert the Set Error Capture [ On ] step before the Perform Find [], then add branching to deal with the no records found error.
jeffEngland Posted November 8, 2006 Author Posted November 8, 2006 Thx Soo much, runs beautifully now, such an easy solution, to a problem driving me nuts, im reading up on the script step now to make sure I don't make this same mistake in the future. Thx Jeff England
ThatOneGuy Posted November 8, 2006 Posted November 8, 2006 (edited) Oh! My bad! I get it now. Okay, two things ... • Do you have a Set Error Capture [On] step in your script ... somewhere preceding your "Find" routine? This will suppress FM's internal dialog in this instance. • It then becomes advisable to "roll your own" dialog box to apprise users of results. After your Get ( LastError ) trap, consider inserting a Show Custom Dialog step where you can tailor-fit any message (or series of buttons) you deem necessary. If "nothing" follows, the script can leave users with a set of zero records found. You may already have a default step or routine in place, something like Show All Records, but it should be mentioned here for all readers. I hope I'm on track this time! Edit ... but I'm clearly late to post. Glad Ender's response worked for you. Edited November 8, 2006 by Guest to acknowledge Ender's post
Recommended Posts
This topic is 6647 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now