Getting Selected Text From iOS Table

Hi there,

In Xojo iOS, how do you get the selected text from a Table??? In a regular Xojo Desktop app the code would be this:


If the Table is suppose to be the iOS version of a Listbox (sort of), what is the equivalent code? I tried:

Dim cell As iOSTableCellData txtSelection.Text=Table1.(0, Cell)
That does not work. I don’t see any example Table app with the code, and I don’t see anything in the Docs. I don’t understand how to do this.

Any help would be appreciated.

Use the RowData method.$RowData
You can then get the text from the returned iOSTableCellData object.$Text

Hi Jason,

Thanks for your help. I saw that and I tried using the code below taking out the Changed line:

Dim cell As iOSTableCellData cell = Table1.RowData(0, 0) //cell.Text = "Changed" Table1.ReloadRow(0, 0) txtSelection.text=cell.Text

All I get is the first text listed on the table. Its going after Table1.RowData(0, 0) so it lists the first item. I don’t see how you actually get the selected item.

Oh, you need to use the Action event (it is called whenever the selection changes) to get the row which is selected. You could save it in a property for later use.

The code I have listed above is in the Action Event. But I still only get the first row listed in the txtSelection textbook. The code looks like it is asking for just the first row, but how do you ask for the currently displayed row?

RowData(0,0) will always return the first row in the first section. What you want to do instead is use the two parameters, section and row, passed into the Action event. You would get the currently selected row in the Action event like this:

dim cell as iOSTableCellData = Table1.RowData(section,row)

Hey Thank You SO…oooo Much Jason!!! That was it!! This code works:

dim cell as iOSTableCellData = Table1.RowData(section,row)

I really appreciate you taking the time to help. I have been sitting here for hours trying to figure this out. Thanks so much again. :slight_smile:

You’re welcome. Glad I could help!