changeset 2804:deefe6f5d716

iOS: Implement dw_listbox_select() for comboboxes. Not sure how I missed that this wasn't implemented, but it became very obvious when using Interface builder.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 19 Jul 2022 15:56:11 +0000
parents 708bcef0ce6b
children ebe139dc16dd
files ios/dw.m
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ios/dw.m	Tue Jul 19 11:21:17 2022 +0000
+++ b/ios/dw.m	Tue Jul 19 15:56:11 2022 +0000
@@ -3378,6 +3378,14 @@
 -(void)insert:(NSString *)item atIndex:(int)index { if(item) [dataArray insertObject:item atIndex:index]; }
 -(void)clear { [dataArray removeAllObjects]; }
 -(int)count { return (int)[dataArray count]; }
+-(void)selectIndex:(int)index
+{
+    if(index > -1 && index < (int)[dataArray count])
+    {
+        selectedIndex = index;
+        [self setText:[dataArray objectAtIndex:index]];
+    }
+}
 -(NSString *)getTextAtIndex:(int)index
 {
     if(index > -1 && index < [dataArray count])
@@ -5779,6 +5787,11 @@
                           animated:NO
                     scrollPosition:UITableViewScrollPositionNone];
     }
+    else if([object isMemberOfClass:[DWComboBox class]])
+    {
+        DWComboBox *combo = handle;
+        [combo selectIndex:index];
+    }
     DW_FUNCTION_RETURN_NOTHING;
 }