Re: AS Studio - How - CkBoxes in Table View Column ?
Re: AS Studio - How - CkBoxes in Table View Column ?
- Subject: Re: AS Studio - How - CkBoxes in Table View Column ?
- From: Bill Hernandez <email@hidden>
- Date: Mon, 25 Dec 2006 00:57:18 -0600
On Dec 24, 2006, at 11:25 PM, Bill Hernandez wrote:
All,
I have a scrollable area "Table View" that has 4 columns.
The first column is 20 pixels wide, and I would like that column to
contain checkboxes that reflect some boolean field.
I tried using AS Studio, and FaceSpan both, and was not able to
find a way to this, but I have seen for example "PSyncX" uses
checboxes in the first column of its table view.
I would be grateful for any insights,
Bill Hernandez
Plano, Texas
Here's what I have so far.
I created a 5th column and set the identifier to "completed", and
added the field to each record below, however the column only
displays ("0", or "1") but no checkbox
property tableData : {{as_name:"Bart Simpson", as_city:"Springfield",
as_zip:"19542", as_age:12, completed:true}, {as_name:"Ally McBiel",
as_city:"Chicago", as_zip:"91544", as_age:28, completed:true},
{as_name:"Joan of Ark", as_city:"Paris", as_zip:"53255", as_age:36,
completed:false}, {as_name:"King Tut", as_city:"Egypt",
as_zip:"00245", as_age:45, completed:true}, {as_name:"James Taylor",
as_city:"Atlanta", as_zip:"21769", as_age:42, completed:true}}
on awake from nib theObject
-- Create the data source
set theDataSource to make new data source at end of data sources
with properties {name:"as_names"}
-- Create each of the data columns, including the sort information
for each column
make new data column at end of data columns of theDataSource with
properties {name:"as_name", sort order:ascending, sort
type:alphabetical, sort case sensitivity:case sensitive}
make new data column at end of data columns of theDataSource with
properties {name:"as_city", sort order:ascending, sort
type:alphabetical, sort case sensitivity:case sensitive}
make new data column at end of data columns of theDataSource with
properties {name:"as_zip", sort order:ascending, sort
type:alphabetical, sort case sensitivity:case sensitive}
make new data column at end of data columns of theDataSource with
properties {name:"as_age", sort order:ascending, sort type:numerical,
sort case sensitivity:case sensitive}
make new data column at end of data columns of theDataSource with
properties {name:"completed", 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 "as_name" data column as the sort column
set sort column of theDataSource to data column "as_name" of
theDataSource
-- Set the data source of the table view to the new data source
set data source of theObject to theDataSource
-- Add the table data (using the new "append" command)
append theDataSource with tableData
-- I FOUND THIS BELOW
-- http://lists.apple.com/archives/applescript-studio/2002/Sep/
msg00105.html
-- http://search.lists.apple.com/?q=checkboxes+in
+tableview&cmd=Search%
21&form=extended&m=all&ps=10&fmt=long&wm=wrd&wf=2221&sp=1&ul=
-- BUT GET AppleScript ERROR : The variable CompletedColumn is not
defined (-2753)
-- Add the data columns
-- Create a button cell object
set prototypeCell to call method "alloc" of class "NSButtonCell"
set prototypeCell to call method "initTextCell:" of prototypeCell
with parameter ""
-- Use the small size of the button cell
set control size of prototypeCell to small size
-- Set the button type to a check box
call method "setButtonType:" of prototypeCell with parameter 3
-- Get the "completed" table column
set completedColumn to call method "tableColumnwithIdentifier:" of
theObject with parameter "completed"
-- Set the data (prototype) cell for the column
call method "setDataCell:" of completedColumn with parameter
prototypeCell
show window "main"
end awake from nib
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden