Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

table view YEARGH!!! was: search table view revisited



This message was posted to the list several days ago. So sorry for making a mess and taking so long to correct it, I'm having equipment problems too, now.

The message was bounced because of embedded graphics. I've substituted links in their place. Hope it works!

Thanks again, all.

Joshua

===============================================
Begin reposted message:
===============================================



AIIEEEE!!!

Hello friends.

Well, first of all, I just want to say, thank you Philip for all your efforts on my behalf.

Your function works beautifully, but...

Something weird (several somethings, actually...) is happening, but I suspect there is probably a simple answer.

Observe:

below is my app. As you can see, I've told it to search for a playlist called "Clash"

Now, when I did this the log file returned:

2008-05-07 21:02:07.971 RadioKnife 1.0[542] "Clash this is the search item in searchme

"
2008-05-07 21:02:08.013 RadioKnife 1.0[542] "Schedule is the window that was called


"
2008-05-07 21:02:08.070 RadioKnife 1.0[542] {6, " here's theindex!", "
", "
"}
2008-05-07 21:02:08.109 RadioKnife 1.0[542] {7, " This is the selected row's index.", "
", "
"}
2008-05-07 21:02:08.149 RadioKnife 1.0[542] {16, " This is myIDNum", "


Not exactly as we'd expect from this ( I hope I haven't screwed up here somewhere) code:

set columnContents to get contents of data cell thecellvalue of every data row of data source of table view 1 of scroll view 1 of window MyTableView --as list
if columnContents contains theitem then
set theIndex to call method "indexOfObject:" of object columnContents with parameter theitem -- zero-based
log theIndex & " here's theindex!" & return & return
call method "scrollRowToVisible:" of object (table view 1 of scroll view 1 of window MyTableView) with parameter theIndex -- zero-based
set selected row of (table view 1 of scroll view 1 of window MyTableView) to (theIndex + 1)
log (theIndex + 1) & " This is the selected row's index." & return & return
update (table view 1 of scroll view 1 of window MyTableView)
set MyIDNum to get id of the selected data row of table view 1 of scroll view 1 of window MyTableView
log MyIDNum & " This is myIDNum" & return & return
end if


This is what the app does:

(See <a href="http://www.panix.com/~joshua/help1.html";>this link</a> for the image.)

The app searches one of two tables. Here's what happens when the exact same code searches the other table:
(the little chevron thingy is some kind of artifact. It's not there in the actual search text, just in the snapshot)


(See <a href="http://www.panix.com/~joshua/help2.html";>this link</a> for the image.)

Heres the log data:

2008-05-07 21:03:10.453 RadioKnife 1.0[542] "Clash this is the search field content

"
2008-05-07 21:03:10.492 RadioKnife 1.0[542] "Clash this is the search item in searchme


"
2008-05-07 21:03:10.643 RadioKnife 1.0[542] {19, " here's theindex!", "
", "
"}
2008-05-07 21:03:10.688 RadioKnife 1.0[542] {20, " This is the selected row's index.", "
", "
"}
2008-05-07 21:03:10.732 RadioKnife 1.0[542] {30, " This is myIDNum", "
", "


Huh?

Anyway....

That's the first set of weirdnesses. Here's the two sets of code that generate the two different tables:

The first table:

on MakeATable() -- creates the table in tableview 1 of window "main"
try
set theDataSource to data source of table view 1 of scroll view 1 of window 1
tell theDataSource
if (count data columns) = 0 then
make new data column at end of data columns with properties {name:"airtime", sort order:ascending, sort type:numerical, sort case sensitivity:case sensitive}
make new data column at end of data columns with properties {name:"showname", sort order:ascending, sort type:alphabetical, sort case sensitivity:case sensitive}
make new data column at end of data columns with properties {name:"endtime", sort order:ascending, sort type:numerical, sort case sensitivity:case sensitive}
make new data column at end of data columns with properties {name:"fader", sort order:ascending, sort type:numerical, sort case sensitivity:case sensitive}
make new data column at end of data columns with properties {name:"willendat", sort order:ascending, sort type:numerical, sort case sensitivity:case sensitive}

-- Make this a sorted data source
set sorted of theDataSource to true

-- Set the "name" data column as the sort column
set sort column of theDataSource to data column "airtime" of theDataSource
end if
end tell
end try
end MakeATable



on SetTableContent(MyShowData) -- sets the contents of the table created by the makeatable subroutine
try
tell data source of table view 1 of scroll view 1 of window 1
set theNewRow to make new data row at end of data rows
set contents of data cell 1 of theNewRow to (airtime of MyShowData) as date
set contents of data cell 2 of theNewRow to (showname of MyShowData)
set contents of data cell 3 of theNewRow to (endtime of MyShowData)
set contents of data cell 4 of theNewRow to (fadetime of MyShowData)
set contents of data cell 5 of theNewRow to (willendat of MyShowData) as date
return theNewRow
end tell
end try
end SetTableContent



the second table:

set content of table view "playlist" of scroll view "playlist" of window "chooseplaylist" to every text item of ShowList


I should mention that the contents of the first table are subject to frequent reordering. Rows are added, deleted, edited, and sorted constantly.


Okay, Weirdness number two:

Once I search for something, the table view is locked. What I mean by that is this:

In both tables, users can either click an appropriate button or else double click a selection to bring up a schedule & settings dialog. Once the search function has been run, double clicking ceases to function in table 1 for the duration of the session, or in table 2 for the duration of the action (that is, once you've made a choice and dismissed the playlist-picker, the table ceases to be, and doesn't get recreated until you call it again, when it works fine again.

A clue as to how to fix that would be helpful.

So sorry to use so much of the list's time. I'm really grateful for all your help, and look forward to celebrating when I finish this (a few days once this and one other problem are solved).

CU!
TIA,

Joshua


Joshua Whalen email@hidden email@hidden http://www.panix.com/~joshua/resume.html


"Vision without action is a day dream, Action without vision is a nightmare." -- Japanese proverb



_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.