How can I get the row and column of an edited cell from NSTableView using Xamarin.Mac? -


i building xamarin.mac application, , 1 of viewcontrollers contains nstableview. have been able populate table view, user able edit of cell contents.

functionally, able cell editable. however, cannot extract row , column edited cell. is possible?

i have nstableviewdelegate code:

public override nsview getviewforitem(nstableview tableview, nstablecolumn tablecolumn, nint row) {     // data     var data = this._datasource.datarecords[(int)row];      nstextfield view = (nstextfield)tableview.makeview(cellidentifier, this);     if (view == null)     {         view = new nstextfield();         view.identifier = cellidentifier;         view.backgroundcolor = nscolor.clear;         view.bordered = false;         view.selectable = true;         view.editable = true;         view.editingended += this.editingended;     }      // setup view based on column selected     if(tablecolumn.title.equals(string.empty)) {         view.intvalue = convert.toint16(row);     }     else {         view.stringvalue = data.get(tablecolumn.title).tostring();     }      return view; }  void editingended(object sender, eventargs e) {     // can reference correct, edited, nstextfield      //   following line.     var textfield = ((nsnotification)sender).object nstextfield;      // however, here, know row , column edited      //  can update source data user-made change. } 

does know how use logic edited cell's position in nstableview?

i using xamarin.mac, assume same logic/question apply if using swift or objective-c app. i'd happily take answer in either of languages well.

you can column , row nsview in nstableview using nstableview's:

  • rowforview
  • columnforview

example:

var textfield = ((nsnotification)sender).object nstextfield; var row = sometableview.rowforview(textfield); var column = sometableview.columnforview(textfield); 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -