Clicking on a button to display a menu would be the same as a pop up menu wouldn't it? (Displaying a menu on rollover is not possible in FileMaker.)
Yes but I want the menu items to be scripts which run reports?
You can set a script trigger on the menu's field to run when a value is selected. Use OnObjectModify for pop up menus.
Not sure what you mean by the menu's field? The field which contains the variable list? Is that a global field? How do I enter the values into that field?
Sorry for being so dense on this? Do you have the time to elaborate or can you point me in the direction to read about how I can do this.
Any pop up menu is a format assigned to a specific field on your layout. Selecting a value in the menu's value list enters that value into the field. It can be a global field, but doesn't have to be. I suggest looking up "Setting up a field to display a pop-up menu, checkbox set, or other control" to see how this works.
Once you can set up a pop-up menu or drop down list of values, you can set up a script trigger that performs a script when a value is selected.
Say you have a value list with these values:
Set up on a global text field (called gReport), as a pop-up menu.
You can use the OnObjectModify Script trigger to run a script like this:
If [YourTable::gReport = "Monthly Report"]
//put steps here to produce monthly report
Else IF [YourTable::gReport = "Quarterly Report"]
//put steps here to produce quarterly report
// put steps here to produce yearly report
To specify a script trigger for this field, enter layout mode, right click it and choose Script Triggers.
This works great. Thanks so much.
The only question I have left is:
I made the pop up menu like this:
Choose a report...
how to I make the pop-up menu return to the top (choose a report) after a selection is made.....?
I'd put "Choose a Report" as label text on the layout rather than as a value in the value list if I were to do this. Use Set Field to set the value of this field back to either nothing (use "") or the first value of the value list. Put this step at the end of your script if the field is a global field. If it is not, you'll need to modify the value before you change layouts.
You can also use an OnLayoutLoad script trigger to reset the field's value whenever you return to the layout.
I did a text label for "Choose a report..." and did a setField of "". But I get a ZERO (not nothing) after making the selection and when I go to another layout with the same global field the ZERO is there?
That's truly odd. With
Set field [ Table::GlobalField ; "" ]
The field will be empty, even if the global field is of type number.
I have no idea what is going on that would put a number in the field instead of just clearing it.
Does this look right?
setField [invoice::gReports;invoice gReports=""]
Thats at the end of the if/else script.
As soon as I go into Browse Mode after setting the script trigger i get the ZERO.
you are entering an expression: invoice gReports=""
Since the value of that expression is False, (gReports does not equal ""), a zero is entered. Just use "" like I did in my example.
ok works fine now thank you