changeset 2612:4628c8c34125

iOS: Standardize DWContainer behavior part 1. If single selection a single tap on a row will cause ENTER. It multiple selection... single tap will select or deselect. A long tap will cause CONTEXT, a double tap will cause ENTER.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 18 Jul 2021 20:55:45 +0000
parents ed2c4a503666
children 72f1141c07aa
files ios/dw.m
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ios/dw.m	Sun Jul 18 15:56:12 2021 +0000
+++ b/ios/dw.m	Sun Jul 18 20:55:45 2021 +0000
@@ -2078,6 +2078,8 @@
     unsigned long _DW_COLOR_ROW_ODD, _DW_COLOR_ROW_EVEN;
     int iLastAddPoint, iLastQueryPoint;
     int filesystem;
+    NSTimeInterval lastClick;
+    NSInteger lastClickRow;
 }
 -(NSInteger)tableView:(UITableView *)aTable numberOfRowsInSection:(NSInteger)section;
 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
@@ -2432,10 +2434,18 @@
     /* If multiple selection is enabled, treat it as selectionChanged: */
     if([self allowsMultipleSelection])
     {
-        /* Handler for container class */
-        _dw_event_handler(self, (id)params, 12);
+        NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
+        
+        /* Handler for container class... check for double tap */
+        if(lastClickRow == indexPath.row && now - lastClick < 0.3)
+            _dw_event_handler(self, (id)params, 9);
+        else
+            _dw_event_handler(self, (id)params, 12);
         /* Handler for listbox class */
         _dw_event_handler(self, DW_INT_TO_POINTER((int)indexPath.row), 11);
+        /* Update lastClick for double tap check */
+        lastClick = now;
+        lastClickRow = indexPath.row;
     }
     else /* Otherwise treat it as doubleClicked: */
     {