• 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
Problem selecting correct row in sorted table
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem selecting correct row in sorted table


  • Subject: Problem selecting correct row in sorted table
  • From: Brian Christmas <email@hidden>
  • Date: Mon, 15 Aug 2011 11:43:44 +1000

G'day Scripters

The problem I've got now is…

I've got a  column with lets say…


D
B
E
A
C


After sorting, it becomes…

A
B
C
D
E


Trouble is using this….

  tell theArrayController to set tempRow1 to  (santasAlarmClockTable's clickedRow()) as integer 
  tell theArrayController to set tempColumn to  (santasAlarmClockTable's clickedColumn()) as integer 
set storeEditRow to tempRow1
   my loadTheFieldsandButtons()


  on loadTheFieldsandButtons()
          set tempRow to storeEditRow 
   try
        set theNSDate to (my theData's objectAtIndex_(tempRow)'s valueForKey_("theStartDateColumn"))
        theStartDate's setDateValue_(theNSDate)
        set theASDate to NSDateToASDate_(theNSDate)
        set thetemphours to (hours of theASDate)
        set thetempAMPM to "AM"
        if thetemphours = 12 then set thetempAMPM to "PM"
        if thetemphours = 0 then
            set thetemphours to 12
        end if
        if thetemphours > 12 then
            set thetemphours to thetemphours - 12
            set thetempAMPM to "PM"
        end if

        

        theHours's setstringValue_(thetemphours)
        theminutes's setstringValue_(minutes of theASDate)
        set theAMPM's title to theTempAMPM
        on error errmsg
           display dialog errmsg
    end try
 --etc, etc,etc

end loadTheFieldsandButtons_  

where the actual selected row is the third row, C, returns the values of E for tempRow in loadTheFieldsandButtons.

Then, using…


   tell theArrayController to removeObjectAtArrangedObjectIndex_(storeEditRow)
   tell theArrayController to insertObject_atArrangedObjectIndex_(anEntry, storeEditRow)

replaces row 3 which is now C, with the contents of E

How do i get the code to actually get row 3 in a sorted column, not row 5?

Obviously the code…

 set theNSDate to (my theData's objectAtIndex_(tempRow)'s valueForKey_("theStartDateColumn"))
     
       
is the problem, as it's getting the index 3  indexed values. But i want the actual rows values, which is index 5


Any suggestions please?

Regards

Santa


 _______________________________________________
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

  • Prev by Date: Re: Lion: querying the current Mission Control Desktop?
  • Next by Date: Re: Problem selecting correct row in sorted table
  • Previous by thread: Re: Lion: querying the current Mission Control Desktop?
  • Next by thread: Re: Problem selecting correct row in sorted table
  • Index(es):
    • Date
    • Thread