I've pretty much managed to convert an Android app into monotouch but I am
completely stuffed on this one= I am really desperate
Clearly having a senior moment
It's probably the way I've constructed my code and having a tendency to
functional programming J
I've got a viewcontroller and view (actually one of s series of tabs) - on
this there is simply a button (add persons) and a table crewTable
I've implemented my own tablesource as per tutorials
User presses 'Add Person' subview added and lots of detail is then added
for that name
Press save on nav bar - the Edi Dialog disappears and the name alone is
added to the TableSource
So far so good
If the user taps on a row in the table - Alert comes up and displays what
was selected
This takes place in the tablesource.rowselected method
What I want is to present user with choice to edit or delete the item
The table item is a name - that's all thats displayed in the tableview - but
there is a public class holding a load more info which was created in a
dialog view
What I want is to get back from the table view the row - that's all but I
just cant see how to do it - the rowselected is a void and I cant understand
how to trap the user tap in the main code
- Example
- List<string>cl = new List<string>();
- Cl = myCrew.getcrewlist();
- myTableViewSource clist = myTableViewSource(cl);
- crewTable.Source= clist;
//===========above code is in finished launching where all my controls
created in IB are visible
// a snippet of myTableViewSource
public class myTableViewSource :UITableViewSource
{
private List<string> rows;
public MyTableViewSource(List<string> list)
{ rows= list;
}
//========other methods
// === such as rows in section
// ====get cell
Public override void RowSelected(UITableView tableview,NSIndexPath
indexpath)
{
ShowAlert("row selected ","you selected
"+rows[indexPath.Row].tostring());
}
//=======
Great, the show alert works but I can't put anything into the
myTableViewSource.RowSelected method which references the EditDialog in my
main code because it is a class and EditDialog is not visible at this level
and therefore I can't fire up the EditDialog on this touch event even
though I can fire a showalert
In the main view which contains the table there is an 'add person' button
which when clicked - it pulls up this EditDialog view - when that is saved
the data is saved and the new name is added to the crewTable and the
EditDialog is dismissed.
What I want is to intercept the event which happens in the rowselected
method of the tablesource class - as above and does the showalert() but to
recall the EditDialog this time populated with the relevant selected persons
data
I am sure there is a straightforward was but I've trawled everywhere and I
cannot find anything helpful all the examples seem to stop at flashing up a
messagebox or something
I would be really grateful for some help even if I am being stupid here
Tia
John Murray
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch