Something I was trying to figure out over the weekend in FM GO and couldn't come up with a way to address everything. I'm wondering if anyone else has come up with a way of tackling this. Here's the specs:
Consider a list view layout in portrait mode in FM Go on an iPhone. Say a list of contacts.
We have a header part with just a text label saying what layout you're on.
Then we have the list of contacts that scrolls down to the bottom of the list. Clicking on a contact name takes you to the form view showing the detail about the contact.
Finally we have a footer that contains a button which uses Go To Object to display a menu in a popover to navigate to other parts of the solution.
From a user perspective, here's what was happening.
User is on the list view layout as above.
User clicks the menu button and the popover appears.
User decides not to navigate away from the list view and taps away from the popover to dismiss it.
But they actually tap on one of the contacts, and the popover goes away but they are then taken to that contact's detail because they hit the contact name (which is a button).
This wasn't what they intended so they have to navigate back to where they were.
Solution (so far):
So, if the popover is open we don't want any of the other buttons on the layout to perform their actions when clicked, as the user is just dismissing the popover.
And we know that clicking anywhere outside the popover will dismiss the popover first and then perform any next action if it was a button.
If where you click is not a button then the popover still goes away but of course nothing further happens.
So, I put an OnObjectExit trigger on the popover to set a global variable $$PopoverJustClosed = "Yes".
Then, on my contact name button that takes you to the detail, I test if this variable is set, if so then clear the variable and exit without doing anything. If it's not set then the action continues as it should.
This works great if you click on something that is a button. It does mean a lot of careful scripting to keep track of this global and ensure it is cleared out.
The remaining problem:
Aside from the amount of effort it will take to keep track of this global variable, there's one remaining issue.
If the user clicks in the header part where there is no button, the popover closes and the global gets set as it always does.
So now the global is set and the popover has gone.
The user clicks on a contact name and nothing happens because the first part of the script tests the global as above.
If the user clicks the name again, then they get taken to the contact detail because the first click cleared the global.
The only idea I have thus far is to place a button in the background of the header (and any other area that does not have a button), which simply runs a script to clear the global. The header area gets clicked, the popover closes and sets the global, and the header button runs the script to clear the global. Then when the user clicks the contact name, the global is not set and the detail view is shown on the first click. This effectively means that every part of the layout is a button and I have to keep track of this global.
Possible - yes. Ideal - probably not.
And a down side to this is that I've not found a way of stopping a button from 'going grey' if you click and hold it - I've checked the states in the inspector and they don't appear to have any attributes that make it go grey when 'active' or 'hover' etc. I'm thinking this is just built in.
I wondered about using a script result, but I don't think this will work because the action of the popover closing is not being called by a script. If I set a script result in the OnObjectExit script, it's not passed to the 'go to contact detail' script because that didn't call it.
Hope this all makes some sense. Anyone come up with a way of dealing with this? Thanks.