In an iPad app with a Split View
On the left I have a mobiletable.
On the right pane, other stuff.
If I SelectRow on the mobiletable, the selected row shows as selected, but ONLY while the pointer is being used on the right hand pane.
Lift the pointer, the mobile table looks like no row is selected.
Ive tried SetFocus and Clear Focus at various code points, to no avail.
Table cells stay selected as long as the table isn’t “refreshed”. A refresh can be initiated by the system or when calling one of the iOSMobileTable.Reload… methods.
If you are using iOSDesignExtensions you could change the background color of a cell when it is selected.
If you are using a Datasource (which I highly recommend), don’t forget to keep the selected state somewhere in the datasource to set the correct background color when the table is refreshed.
EDIT
You can also use this code to select a row by code:
//Be VERY careful, it might crash if row and section are out of table bounds
Dim row As Integer = 5
dim section As Integer = 0
Dim position As Integer = Integer(iOSMobileTable.ScrollPositions.None)
Dim animated As Boolean = True
declare sub selectRowAtIndexPath_animated_scrollPosition_ lib "UIKit.framework" selector "selectRowAtIndexPath:animated:scrollPosition:" (id as Ptr, row as Ptr, animated as boolean, scrollPosition as integer)
Declare Function NSClassFromString Lib "Foundation" (className As CFStringRef) As Ptr
Declare Function init Lib "UIKit" selector "indexPathForRow:inSection:" (id As ptr, row As Integer, section As Integer) as ptr
Dim idxPath As ptr = init(NSClassFromString("NSIndexPath"), row, section)
selectRowAtIndexPath_animated_scrollPosition_(table.Handle, idxPath, animated, position)
Thanks. I’ll give these a try.
Right now, I have Selectrow statements after every (?) possible place when a refresh can occur.
The row is selected , but stops LOOKING selected until I pointer down somewhere.
I started changing the text color of the selected customcell , which works.
Maybe the background color would be more prominent (its background color that I xpect to change on selection anyway)