dbTalk Databases Forums  

Can a script determine which button was clicked?

comp.databases.filemaker comp.databases.filemaker


Discuss Can a script determine which button was clicked? in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
audleman@quasika.net
 
Posts: n/a

Default Can a script determine which button was clicked? - 07-22-2005 , 01:51 PM






I have a script that goes to a 'find person' layout and enters find
mode[pause], pausing for data entry.

I need two buttons on the layout, Next and Cancel. Is there a way to
have the buttons resume the script and signal which was pressed?

I tried creating a small script called 'Cancel Button Pressed,' which I
wanted to do the following:

1. Set a field called Globals::g_button = "Cancel"
2. Resume the script

....but there doesn't appear to be a way to resume a script from within
a script.

Any better suggestions?

Thanks,
Kevin


Reply With Quote
  #2  
Old   
Lynn allen
 
Posts: n/a

Default Re: Can a script determine which button was clicked? - 07-22-2005 , 02:12 PM






audleman (AT) quasika (DOT) net <audleman (AT) quasika (DOT) net> wrote:

Quote:
I have a script that goes to a 'find person' layout and enters find
mode[pause], pausing for data entry.

I need two buttons on the layout, Next and Cancel. Is there a way to
have the buttons resume the script and signal which was pressed?

I tried creating a small script called 'Cancel Button Pressed,' which I
wanted to do the following:

1. Set a field called Globals::g_button = "Cancel"
2. Resume the script

...but there doesn't appear to be a way to resume a script from within
a script.

Not in versions previous to FM7. There, you have to write a separate
script for each button. :/ However, you can modularize and put the
working "guts" into a second script, called from each of the first ones.

Now, in FM7, there are "script parameters" which can be attached to each
button in the script assignment dialog. So you can attach "Cancel" to
the cancel button, etc, and then test in the script for

Get(ScriptParameter)

and branch accordingly. Script parameters can be hard coded, based on
calculations, and even multi-valued, so they can be parsed out later in
the script. They persist only for the running of the current the script.

So if you have 26 buttons, A-Z, you write one script, attach it to all
of them, but put the correct letter in as the script parameter. Muuuuch
better. Still not perfect, but much better.

Lynn Allen
--
Allen & Allen Semiotics www.semiotics.com
FSA Associate Filemaker Design & Consulting


Reply With Quote
  #3  
Old   
Helpful Harry
 
Posts: n/a

Default Re: Can a script determine which button was clicked? - 07-22-2005 , 04:13 PM



In article <1h03o4n.16s6rawcfpmgwN%lynn (AT) NOT-semiotics (DOT) com>,
lynn (AT) NOT-semiotics (DOT) com (Lynn allen) wrote:

Quote:
audleman (AT) quasika (DOT) net <audleman (AT) quasika (DOT) net> wrote:

I have a script that goes to a 'find person' layout and enters find
mode[pause], pausing for data entry.

I need two buttons on the layout, Next and Cancel. Is there a way to
have the buttons resume the script and signal which was pressed?

I tried creating a small script called 'Cancel Button Pressed,' which I
wanted to do the following:

1. Set a field called Globals::g_button = "Cancel"
2. Resume the script

...but there doesn't appear to be a way to resume a script from within
a script.

Not in versions previous to FM7. There, you have to write a separate
script for each button. :/ However, you can modularize and put the
working "guts" into a second script, called from each of the first ones.

Now, in FM7, there are "script parameters" which can be attached to each
button in the script assignment dialog. So you can attach "Cancel" to
the cancel button, etc, and then test in the script for

Get(ScriptParameter)

and branch accordingly. Script parameters can be hard coded, based on
calculations, and even multi-valued, so they can be parsed out later in
the script. They persist only for the running of the current the script.

So if you have 26 buttons, A-Z, you write one script, attach it to all
of them, but put the correct letter in as the script parameter. Muuuuch
better. Still not perfect, but much better.
The other way in this particular case is not to Pause the script at
all. Simply enter Find Mode and end the script, then you can use a
'Cancel' button script to perform whatever needs to be done when the
user cancels and the 'Next' button script to do whatever is next (which
presumably includes Perform Find at some stage).

You could even not use Find Mode with the user at all. Simply have a
set of Global fields to obtain the find data, and then have your 'Next'
script enter Find Mode, transfer the global data to the normal fields
and then perform the Find.




Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.