It's an implementation issue with NSTableView. Feel free to log a bug (there already are bugs logged for this issue). You'll have to work around it. Keep track of the fact that you are showing the dialog, and keep returning the same index set to avoid changing the selection.

corbin

On Sep 10, 2008, at 3:18 PM, Robert Kukuchka wrote:

Hello,
I'm trying to handle some selection switching of an NSTableView, but I'm getting double the calls I "expect". Why is this, or have I done something wrong?
Cheers,
Rob

BT #1
#1 0x92a2400f in -[NSTableView _sendDelegateSelectionIndexesForProposedSelection:] () #2 0x927fe124 in -[NSTableView _userSelectRowIndexes:withNewSelectedRow:] ()
#3  0x927fe08c in -[NSTableView _userSelectSingleRow:] ()
#4  0x927fbc9c in -[NSTableView mouseDown:] ()
#5  0x927b388b in -[NSWindow sendEvent:] ()
#6  0x92780431 in -[NSApplication sendEvent:] ()
#7  0x926dde27 in -[NSApplication run] ()
#8  0x926ab030 in NSApplicationMain ()
#9 0x00002ce3 in main (argc=1, argv=0xbffff724) at /Users/ robertkukuchka/CodeDev/SoftBank MWL/main.m:25

I return the same index in this call..

BT #2
#1 0x92a2400f in -[NSTableView _sendDelegateSelectionIndexesForProposedSelection:] () #2 0x927fe408 in -[NSTableView _userSelectableRowIndexesForProposedSelection:] ()
#3  0x927fefd2 in -[NSTableView _userCanSelectSingleRow:] ()
#4  0x927fbeba in -[NSTableView mouseDown:] ()
#5  0x927b388b in -[NSWindow sendEvent:] ()
#6  0x92780431 in -[NSApplication sendEvent:] ()
#7  0x926dde27 in -[NSApplication run] ()
#8  0x926ab030 in NSApplicationMain ()
#9 0x00002ce3 in main (argc=1, argv=0xbffff724) at /Users/ robertkukuchka/CodeDev/SoftBank MWL/main.m:25

I'm not sure why I get the delegate call twice. I can see that (obviously) _userSelectableRowIndexesForProposedSelection and _userSelectRowIndexes:withNewSelectedRow must both call _sendDelegateSelectionIndexesForProposedSelection, but why is this happening twice. Does returning the old value cause the second call?

For context I'm trying to mimic the behaviour within Apple Mail's Preferences->Account dialog. I want to prevent a user from switching items in an NSTableView (Accounts) unless they respond to a modal panel (Save, Don't Save, Cancel). I'm trying to use NSBeginAlertPanel + store the next and current selections (since NSBeingAlertPanel doesn't block) within a selection delegate method.

Am I doing this in a convoluted way?

Cheers,
Rob




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to