You always wished that FileMaker Go was more like real apps in iOS, didn’t you!?
Now with FileMaker 13 I would argue that we have come far closer app feel than ever before. We can use the fantastic layout objects such as “Popover” samt “Slide Control“. We may also use the two-finger swipe to scroll through the items and gain more control of the input with special keyboard for example as number or e-mail.
Here’s a tip to further get that iOS feel, namely the ability to swipe left and bring up a button to delete a row in a list.
Create a new slide control by selecting the tool for Slide Control in toolbar.
Give the slide control panel one (of three) an object name in the inspector tab “Position”. Call it “Invisible”.
Do the same with panel two but call it instead “Visible”.
Create a button that you name “Delete” and connect the following script, “Delete record”:
Set Script Animation [ On ] If [ Get ( RecordNumber ) = $$RecordNumber ] Delete Record/Request [ No dialog ] End If Go to Object [ Object Name: "Invisible" ]
The script deletes the record, though only if the record number corresponds to that found in the global variable, to eventually hide the panel with the button.
Make a script, “Hide button” to hide the button when another record is selected:
Set Script Animation [ On ] Go to Object [ Object Name: "Invisible" ] Refresh Object [ Object Name: "Button" ]
Connect script to script trigger “OnRecordLoad” for the layout.
Create another script, “Switch panel” with the following script steps:
Set Script Animation [ On ] If [ GetAsNumber(Get ( TriggerTargetPanel) ) = 2 ] Set Variable [ $$RecordNumber; Value:Get ( RecordNumber ) ] Refresh Object [ Object Name: "Button" ] End If If [ GetAsNumber(Get ( TriggerTargetPanel) ) = 3 ] Perform Script [ “Hide button” ] Go to Object [ Object Name: "Visible" ] Set Variable [ $$RecordNumber; Value:Get ( RecordNumber ) ] Exit Script [ Result: 0 ] End If
The above script makes sure that the global variable is set to the current record number, and that trying to swipe on another record, the erase button appears on it instead.
Select the slide control and link the script to be run when you switch between panels with the command Set Script Triggers that you find in the menu Format.
$$RecordNumber ≠ Get ( RecordNumber )
as calculation to hide object:
Since the slide control panel is changed for all items if we sweep it, we must ensure that only current posts button is visible. That is what the above part solves.
Double click on the slide control and uncheck “Show navigation dots”.
Customize the slide control so that it is about twice as wide as the button and that it will fit on the body part of the list vertically. Insert button so that it ends up in the right part of the panel number two in the slide control.
Set fill colour to red and line to “None” on the button. Set font color to white.
Also set the fill and line of the slide control panel to “None” so that not the slide control panel itself will be visible.
Make sure that the slide control is the uppermost item in the layout.
Download the database to your iOS device and test! It should work as in the video below:
Download example file: SwipeDeleteInGo.zip