Notice
  • Please enter your DISQUS subdomain in order to use the 'Disqus Comments (for Joomla)' plugin. If you don't have a DISQUS account, register for one here

Core FileMaker Blog

Keep up to date with CoreSolutions

FileMaker Portal Row Click Handler

Image of an old typewriter

Confessions of a FileMaker Developer

I have a confession to make.

I’ve been working with FileMaker software for about a decade now and sometimes I still do things the old fashioned way.

I caught myself doing this the other day when I discovered a new use for an old feature that I didn’t know could be used like this.

How I Used To Handle Row Click Events

Like most FileMaker developers I know, when I wanted to handle a row click event, I was creating a transparent button that hid in the background of the portal, taking up the entirety of the portal row. When a user clicked it, it performed its necessary button action/script and life was good.

The problem with this approach is that it’s somewhat clunky. You’ve got an extra layout object (the button) that exists solely to wait for a user to push it. Users don’t even see it, but know that something should happen if they click on a portal row – so that tells me that this kind of functionality should be inherent to portals, and that we shouldn’t have to create a workaround for this. This line of thinking is what caused me to do a bit of experimenting. It didn’t take me long to figure out a more elegant solution either, and as it turns out, my suspicions were correct.

How I Now Handle Row Click Events

Quite simple actually.

Add an OnObjectEnter script trigger to your entire portal. You can even pass the primary key of the related Table Occurrence (the one that the portal is based on) as a parameter.

That’s it!

Now, you don’t need to worry about that extra layout object getting in the way when you’re trying to multi-select objects within the portal.

I think the explanation that I provided here should probably suffice for most, but in case any of you want to see this in action (sometimes reverse engineering is more fun than reading about a technique), I’ve provided a demo… as usual.

Download the Portal Row Click Handler Solution

If you enjoy our FileMaker blogs, be sure to subscribe to our Core FileMaker Newsletter!

And as always, Thanks for Reading!

Matt Leering

Leave a comment

6 comments

  • JT
    JT 01 May 2017 Report

    Even simpler, instead of the find use GTRR to Arbitrary_SELF. No parameter is needed in this case.

    Comment Link

  • Matthew Leering
    Matthew Leering 17 January 2017 Report

    Hi Arnvid;
    If I understand your question properly, then yes... it's actually quite easy.

    All you need to do is:
    A) Make sure that your portal uses an active row state,
    B) Trigger a script/button action that will 'Go To Portal Row'.

    There's a gotcha with this technique though -- if you try to do it when you've implemented this blog post's topic as well, it will actually emulate the user clicking on that portal row too

    Comment Link

  • Arnvid Moholt
    Arnvid Moholt 17 January 2017 Report

    Thanks for that tip. Just one question; is there any way get that row marked even if you click in another field on the layout? (Without setting conditional formatting on the field in the row...)

    Comment Link

  • Mark
    Mark 11 January 2017 Report

    Thanks, that is a great tip. I would suggest in the demo file to make the ID field even smaller instead of stretching it across the entire portal row. Then you really get the idea that you are in fact clicking on the portal row and not a field/button. awesome!

    Comment Link

  • Bruce Drake
    Bruce Drake 11 January 2017 Report

    I m amazed at the simple elegance of this. I, too, have used the invisible button but tried it on 2 portals in a layout I use constantly. Works like a charm. Not sure how FM knows which portal row is clicked on but it seems to get it right. Old invisible buttons are gone now. Many thanks for this tip.

    Comment Link

  • Philip
    Philip 11 January 2017 Report

    Nice Matt - thanks!

    Comment Link