Unselect an iOSTable row

Is there a way to unselect a row after a user made it gray by selecting it?

Yes, through a declare to DeselectRowAtIndexPath. I have looked into it, but am stuck on NSIndexPath I do not know how to set and pass to the method. Maybe a more knowledgeable member will assist.

I did create a Declare for selectRowAtIndexPath which also uses NSIndexPath. You can look at the source in the XojoNotes example download included with this week’s webinar on deploying iOS apps. I’m sure it’s similar to deselectRowAtIndexPath.

On Feb 10 I’ll be doing a webinar on Creating Simple iOS Declares (register here) where I’ll cover how to go through the Apple docs to translate selectRowAtIndexPath to a Xojo Declare. I’ll also cover a few other declares as well. I’m no Declare expert, but this hopefully will help get people started with some of the “easier” ones. :slight_smile:

Sub UnselectTableRow(table as iOSTable)

declare sub selectRow lib "UIKit" selector "selectRowAtIndexPath:animated:scrollPosition:" (id as Ptr, row as Ptr, animated as boolean, scrollPosition as integer)
selectRow(table.Handle, nil, false, 0)
 
End Sub

Thanks Paul!

[quote=163114:@Paul Lefebvre]I did create a Declare for selectRowAtIndexPath which also uses NSIndexPath. You can look at the source in the XojoNotes example download included with this week’s webinar on deploying iOS apps. I’m sure it’s similar to deselectRowAtIndexPath.

On Feb 10 I’ll be doing a webinar on Creating Simple iOS Declares (register here) where I’ll cover how to go through the Apple docs to translate selectRowAtIndexPath to a Xojo Declare. I’ll also cover a few other declares as well. I’m no Declare expert, but this hopefully will help get people started with some of the “easier” ones. :)[/quote]

Splendid. Thank you so much Paul. It will be great study :slight_smile:

It is indeed very similar, and it was easy to modify for deselect. Thank you :slight_smile:

It also contains scrollToRow which auspiciously provides a solution to my recent feature request for a ScrollTo method. Now I see that VisibleCells provide the equivalent of ListBox.ScrollPosition but it will take more work to deal with the returned array.