scoony Posted January 22, 2014 Posted January 22, 2014 I have one layout with 3 'Tabs' - Client, Contacts, Achievements. For context, a client can have many contacts (portals used here) and likewise with Achievements. Each of these 3 'Tabs' has a separate layout to create a new record. This is all to be used on an iPad so if anyone has any better ideas I'd be really interested to know your thoughts. I would like to use one '+' button in the HEADER, as opposed to a button on each 'Tab', to add a new record which would go to a specific layout to create the new record. I can't seem to find a script that will give me the 'NAME' of the 'Tab' which I could then have a GoToLayout function. So if I were viewing the Client 'Tab' by clicking the '+' button it would navigate to the layout to enter new 'Client' details and if I were viewing the Contacts 'Tab' by clicking the '+' button it would navigate to the layout to enter a new 'Contact' details. Thanks Zab
pixi Posted January 22, 2014 Posted January 22, 2014 the functions you are looking for is called "LayoutObjectNames(fileName;layoutName)" and returns a list of the names of all named objects on layoutName in fileName, separated by carriage returns. the script could look like this: p.s. of course, you must name the tabs accordingly ;o)
comment Posted January 22, 2014 Posted January 22, 2014 So if I were viewing the Client 'Tab' by clicking the '+' button it would navigate to the layout to enter new 'Client' details and if I were viewing the Contacts 'Tab' by clicking the '+' button it would navigate to the layout to enter a new 'Contact' details. You can use the GetLayoutObjectAttribute() function, in conjunction with the isFrontPanel attribute, to determine which panel is currently the viewed one (you need to test the panels one by one). Alternatively, you could store the viewed panel in a variable, using a script triggered OnTabSwitch and the Get(TriggerCurrentTabPanel) function. Then have the + script consult the variable before deciding on the target layout. the functions you are looking for is called "LayoutObjectNames(fileName;layoutName)" and returns a list of the names of all named objects on layoutName in fileName, separated by carriage returns. I think you are testing whether an object exists - not if it is currently the front tab panel.
pixi Posted January 22, 2014 Posted January 22, 2014 I think you are testing whether an object exists - not if it is currently the front tab panel. heck, you are right… sometimes i shouldn't answer topics in between (my work) ;-)) using "GetLayoutObjectAttribute" is the correct function to determine which tab is visible…
scoony Posted January 22, 2014 Author Posted January 22, 2014 Hi Pixi!  Thanks for your help. I'm afraid I have a few very newbie questions. I don't understand 'oList', 'param' and can I add this script as a perform script under the button setup?  I've added a few screen shops to show what I've tried.  Thank you  Zab  Â
pixi Posted January 22, 2014 Posted January 22, 2014 forget the "oList" and "param" since they were just names for parameters i've choosen. please check enclosed file and in there the "Add" script. scoony.fmp12.zip
scoony Posted January 23, 2014 Author Posted January 23, 2014 Hi Pixi! Thank you very much for the file. I totally understand how you have put it together and the associated code. Zab
Recommended Posts
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