Re: Checkbox in an NSTable, not getting right selectedObject()...
Re: Checkbox in an NSTable, not getting right selectedObject()...
- Subject: Re: Checkbox in an NSTable, not getting right selectedObject()...
- From: Harald E Brandt <email@hidden>
- Date: Mon, 21 Mar 2011 21:51:13 +0100
On 21 mar 2011, at 18.53, Jeff Dyck wrote: My problem is that the selected object seems to be behind by one click - ie: if I have the following items:
[ ] Admin [ ] Teacher [ ] Student [ ] Finance [ ] IT
If I click on Student, the result I get is Admin. If I click on student again, then I get the correct result. If I then click on IT, I get Student. If I click on IT again then I get IT as result. So it seems as if simply clicking on the checkbox doesn't update the selectedObject of the table/NSArrayController.
Any idea of how to make sure I get the right result?
Yes. The problem is that the the NSButton is clicked before the array controller is informed of the currently selected row, so you can't query the array controller for its selected objects because it might be from the previously selected row. Instead, ask for the clicked row of the table and explicitly set the selection:
tell groupController to setSelectionIndex_(theTable's clickedRow())
(Note: you have to bind the variable theTable in IB to the actual table.)
______heb____________________________
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden