objective c - Limiting NSTableView to two selections -
i wondering if has method limiting number of selections allowed in nstableview 2 concurrent selections. trying calculate delta between 2 selected values , select 2 @ time.
i thinking of trying keep track of has been selected can programmatically unselect if selection expands above two, seems kludgy , possibly not easy sounds.
implement delegate method tableview:shouldselectrow:
, return no if don't think user should allowed select row. reason decide - instance because number of selected rows 2.
to number of selected rows @ given time, call selectedrowindexes
on table view (not delegate, nor data source). give nsindexset
, has count
method information looking for.
the index set holds information other row indexes selected, in case want deselect them.
not knowing app, user experience sounds bit... strange. easy enough implement, though, no harm done in trying out.
Comments
Post a Comment