• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Checkbox in an NSTable, not getting right selectedObject()...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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____________________________
Harald E Brandt     http://bragit.com

 _______________________________________________
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

  • Follow-Ups:
    • Re: Checkbox in an NSTable, not getting right selectedObject()...
      • From: Jeff Dyck <email@hidden>
References: 
 >Checkbox in an NSTable, not getting right selectedObject()... (From: Jeff Dyck <email@hidden>)

  • Prev by Date: Checkbox in an NSTable, not getting right selectedObject()...
  • Next by Date: Re: Checkbox in an NSTable, not getting right selectedObject()...
  • Previous by thread: Checkbox in an NSTable, not getting right selectedObject()...
  • Next by thread: Re: Checkbox in an NSTable, not getting right selectedObject()...
  • Index(es):
    • Date
    • Thread