- Moves and swipes
- Fast scrolling
- Moving rows
- Action during a swipe
Looper: moves and gestures
In a mobile application, several options can be handled with the fingers, by performing specific movements.
For the Looper controls, WINDEV Mobile proposes several options used to manage these moves and gestures. These options can be configured in the "Details" tab of the description window of Looper control.
If "Fast scrolling" is selected, scrolling through the Looper control can be done more quickly thanks to a specific scrollbar track on the side of the control.
If "Alphabetical indexing on" corresponds to an attribute of a Looper control, an alphabet scrollbar will allow the user to quickly reach the lines whose attributes start with the chosen letter.
Caution: If this option is selected, the Looper control must be sorted in alphabetical order on the specified attribute.
- Fast scrolling is only available for Looper controls populated programmatically or with in-memory data source.
- Fast scrolling is not available for horizontal and multicolumn Looper controls.
It is possible to allow the user to move the rows in a Looper control ("Move rows"). In this case, you have the ability to choose a move:
- via a grip on the left,
- via a grip on the right.
To perform a move by gesture, all you have to do is remain pressed on the element and move this element.
If the user is allowed to move rows, new events are associated with the Looper control:
|Beginning of source Drag/Drop||This event is run at the beginning of Drag/Drop for the element. This event is used to run different tests for example. If this event returns False the movement is not performed.|
|Drop in target Drag/Drop||This event is run when the user finishes the element Drag/Drop. If this event returns False the movement is not performed.|
- This feature is only available for Looper controls populated programmatically or with in-memory data source.
- This feature is not available for horizontal and multicolumn Looper controls.
Action during a swipe
On the Looper controls, an action can be performed during a horizontal swipe of a row (drag the element from right to left or from left to right).
You have the ability to perform:
- an automatic deletion.
- an action by programming.
- a customizable swipe.
If the "Automatic deletion" option is selected, new events are associated with the Looper control:
|Before automatically deleting a row by swipe||This event is run before the automatic deletion of the record displayed in the row. This event is used to run different tests for example. If this event returns False the deletion is not performed.|
|After automatic deletion of a row by swipe||This event is run after the actual deletion of the record. This event is used, for example, to re-display the data.|
|This event is run BEFORE the event "Before automatically deleting a row". If this event returns False, the event "Before automatically deleting a row" is not run and the record is not deleted.|
Remark: Only the data file record linked to the row of the Looper control is deleted. The linked records found in the other data files are not automatically deleted.
Action through programming
If the "Action through programming" option is selected, a new event is associated with the Looper control:
|Row swipe||This event is run when the user swipes the row. This event allows you to program the desired action.|
Remark: You can get the direction of the swipe gesture with the Gesture variable.
- Row swipe actions are only available for Looper controls populated programmatically or with in-memory data source.
- Swipe actions are not available for horizontal and multicolumn Looper controls.
- Swipe actions are available in the simulator.
This option is used to display a specific internal window during the swipe. This internal window proposes the actions to perform after the swipe. An example of internal window is supplied in standard but you also have the ability to use an internal window of project.
The parameters of the custom swipe are as follows:
- Same actions for the left and right swipe/Different actions according to the orientation of the swipe: These options are used to define whether the swipe is managed the same way regardless of its direction. You can use:
- the same internal window for the swipe to the right and to the left.
- a different internal window for the swipe to the right and to the left.
Remark: If an orientation is not associated with an internal window, the swipe cannot be performed in this direction.
- Internal window on left and right swipe: You can use:
- the default internal window. If this option is selected, you will be automatically prompted to import of the corresponding window (IW_Swipe) into the project..
- a specific internal window. In this case, the global declaration code of the window must respect the following prototype:
PROCEDURE <Window name>(<Looper control>, <Index of swiped row>)
- <Looper control> represents the name of the Looper control on which the swipe is performed.
- <Index of swiped row> represents the number of the swiped row.
- Respect the width of the internal window: Used to specify whether the internal window keeps its edit width (option checked) or whether the width of the internal window occupies the entire width of the Looper control (default option).
- Run the swipe process:
- Immediately: The "Row swipe" event of a Looper control is run when displaying the internal window (when the internal window has covered Looper control row).
- During the next scroll of the looper: The "Row swipe" event of the Looper control is run during the next action on the Looper control. This option is recommended if the internal window contains buttons used to perform specific processes. Therefore, the "Row swipe" event will be run when the user handles the Looper control (the internal window will be closed).
If the "Customizable swipe" option is selected, a new event is associated with the Looper control:
|Row swipe||This event is run when the user swipes the row. The conditions for running this event depend on the "Run the swipe process" option in the customizable swipe settings. |
- The internal swipe window can be closed by LooperCancelSwipe. The Cancel button found in the internal window supplied in standard is using this function.
- The internal window is loaded (execution of declaration and initialization codes) as soon as the swipe is started.
- The internal window is unloaded (execution of closing code) when the internal window disappears.
- SwipeEnabled is used to temporarily disable the swipe on a row found in the Looper control.
Cross-platform examples (WINDEV Mobile): WM ToDo List
[ + ]
This example is a manager of To-Do Lists.
The project is using the gestures in the loopers in order to move and delete the lists and tasks.
The data is stored in a HFSQL database.