Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7809 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

This is actually a re-post of an old message from the old days before we could attach sample files

A few people have posted questions to FMforums about how to use multiple buttons to trigger a single script and then have that script take different actions according to which button was clicked.

Currently, there is no Status(CurrentButtonName) function to determine which button triggered the script, but here is another possibility. You can use the following concept to create a dynamic vertical tool bar on your layouts. It's based on the idea of putting buttons in a portal. It's simple. Create a related file with a key field, a button name field and/or a button icon field, other parameter fields, etc. Create a relationship in your main file to the dynamic button file based on MainFile::KeyField = ButtonFile::KeyField. Then, create a portal on the layout in the main file. Insert the button name/icon field from the related file. Create an invisible button over the portal row.

Link the portal button to a script that begins by setting a global field to the key field in the related file. Then the script can perform various actions based on the parameters stored in the dynamic button file.

The key field in the main file can either be a regular text field or a global. The field will have multiple items (one for each button to be displayed) separated by returns, like this:

NewRecord

ButtonBar.zip

Posted

That's a neat example, Bob. Good job.

Posted

Hi Bob

I really like your idea for buttons.

In fact I am in process of changing on of my files.

I reduced the portal to 2 rows w/scroll bar to save real estate.

I am not using only one portal I have 3 different portals.

1- Layout navigation

2- File navigation

3- General FM commands

I would like to reduce portal rows to one and

install buttons

Go to portal row [next

Go to portal row [previous]

Now here's the dumb question. I should know it.

With more than 1 portal , How do you tell it which portal to go to?

Duh ;-(

Posted

Hi Chopper,

You can do this by having a goto field (Portal1::Somefield) script step before doing the goto portal row step. Two remarks on this method: 'Somefield' should be a field that's actually used in the portal (could be the graphic) and every portal will need a global to store the last portal row you were in, in that particular portal.

So going to the next portal row in portal 1 would require a script like:

set [gPortalRow1, gPortalRow1 + 1]

goto field [ Portal1::Somefield ]

goto portal row [ gPortalRow1 ]

But maybe somebody has an easier method?

Regards,

Ernst.

Posted

Hello Ernst

This is what I did to reduce portal rows to one.

The problem I had is it was not resetting the counter.

Fields =

gLayout_portal row number =number

gLayout_portal row = count(Relationship,somefield)

Script =

Up_Layout Portal_Rows

If gLayout_portal row number > gLayout_portal row or gLayout_portal row number < 1

Set Field gLayout_portal row number , 1

Else

Set Field gLayout_portal row number, gLayout_portal row number + 1

Go to Portal row (by field value) gLayout_portal row number

Go to Field (relationship, somefield)

For Down_Layout Portal_Rows (script)

changed

Set Field gLayout_portal row number, gLayout_portal row number -1

See the screen shot attached

ScreenShot17.jpg

Posted

Hi Robert,

Nice layout. Did I see correct that you built a routeplanner in Filemaker? Or is it pasted data?

About the script, are you sure you have:

>>Go to Portal row (by field value) gLayout_portal row number

>>Go to Field (relationship, somefield)

In that order? I would expect the order to be reversed...

Anyway, if it ain't broken, don't fix it!

Regards,

Ernst.

Posted

Thanks for nice on layout 8-)

Yes Script is as is have 5 different for 5 different portals.

key is checking counter against calc = count(Somefield)

About Map planner

got a files from DB Pros called Maps.fp5

Incorporated his idea with mods to get maps and directions from mapquest.

(had to modify his fields , some did not work.)

anyway I can get map only, Map to address or map from address. work great.

Thanks again to Bob Weaver

See the Developr Layout Attached

ScreenShot18.jpg

Posted

Nice Chopper,

Did you solved your issue about which portal to go to. I tried this also and seems to work naturally for me, even with 7 portals in the layout.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.