What data in the current record or a global field/variable determines that this button should be disabled or disappear?
Let's say a field, yourTable::Field is set to "DisableOrder" if the button is to be disabled.
You can set a conditional format on the button
YourTable::Field = "DisableOrder"
and specify a grey text color to give the button a disabled "look".
Then you can put the button's script inside an If block so that nothing happens if the button is to be "disabled":
If [YourTable::Field ≠ "DisableOrder" ]
#put all script steps here
The only negative to this method is that the button still highlights when you click it.
You can make the button disappear through several methods:
- If you used text objects instead of the graphic objects that you have here, a conditional format can make the button disappear completely by specifying a font size of 500.
- If you put the button inside a one row portal, (portal borders can be invisible), a change in a value used in the relationship to the portal table or a portal filter can control whether or not a related record exists in the portal. If there's a related record in the portal, the button is visible. If it is not, it's not visible.
- If you put an invisble two panel tab control on your layout, (Make panel borders transparent or zero width. Make fill color match background. Make the panel labels zero width ), you can give each panel an object name. Then a script, controlled by the appropriate script triggers, can use go to object to select a tab panel. Select the Panel with a button and it appears, select the panel with out the button and it disappears.
Thank you for such a speedy response! The answer to your first question is When the user clicks on the Button labelled 'Order' I want a script to run - in this script ideally I would like:
THe "order' button to disappear/lock
or to be replaced with the invoivce button ( in this case I would remove the invoice button as wouldnt want two invoice buttons).
Basically, an order has to be created before it can be converted to an invoice. The "make order from button' Script that I have on the order button does specify the "Staus' field to display "order"
Hope this clears things up. But looking over your first repsonse seems that you may have provided the answer..unless you can suggest anything else..?
Thank you again
Your script can set a field or global variable to a value that makes the appearance of the button change or make it disappear. This same basic script step will make any of the methods possible.
You can also include a text field or global variable (FileMaker 11 only) as part of your button and then change the text from order to invoice and vice versa. The script would then check the text in this field to determine what happens when the button is clicked.
I will test all that out tomorrow!
Thanks Again Phil...