The Original FileMaker Community
Business Templates - Demo Apps - Video Tutorials -Samples - Help - 46000 Member Forum

The Leading Filemaker Developer Tools

Swipe and delete in FileMaker Go – FileMaker Today

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” and “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.

[yee_row ex_class=””][yee_column width=”1/1″ ex_class=””][yee_text_block css_animation=”no” ex_class=”” widget_padding=”eyJwYWRkaW5nLXRvcCI6IjAiLCJwYWRkaW5nLXJpZ2h0IjoiMCIsInBhZGRpbmctYm90dG9tIjoiMCIsInBhZGRpbmctbGVmdCI6IjAifQ==” widget_margin=”eyJtYXJnaW4tdG9wIjoiMCIsIm1hcmdpbi1yaWdodCI6IjAiLCJtYXJnaW4tYm90dG9tIjoiMzAiLCJtYXJnaW4tbGVmdCI6IjAifQ==”]

 

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.

SlideControl

Select the slide control object to turn all the “Padding” to 0 in the inspector.

Padding

Give the slide control panel one (of three) an object name in the inspector tab “Position”. Call it “Invisible”.

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.

OnRecordLoad

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.

OnPanelSwitch

Select the button and set the object name to “Button”. Write

$$RecordNumber ≠ Get ( RecordNumber )

as calculation to hide object:

HideObject

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.

NoBackground

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:

 

Good luck!

Download example file: SwipeDeleteInGo.zip

Read More Great FileMaker Tips at: http://www.filemakerbloggen.se/

[/yee_text_block][/yee_column][/yee_row]

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy