tags:

views:

201

answers:

3

I am looking to make a Application and each row of the table view will have a column with a check box. What i am looking to do is... make the row that the checkbox is on go slightly see through if the check box on that row is checked (this should be implemented on every row of the table as every row has a checkbox) .

A: 

Do you really mean "opaque"? ("Slightly opaque" is a lot like "slightly pregnant.")

If you mean change the color, add javascript to the checkbox to change the background of the div containing the checkbox. Here's an example.

Charlie Martin
From his tags it looks like he's working on a Cocoa program, not a webapp.
Marc Charbonneau
By opaque i meant to say slightly see-through.
Joshua
Opaque means the opposite. Completely solid, zero transparency.
Quibblesome
Yes i know, stupid me.
Joshua
A: 

I would make a javascript function that changes the style of the row. You could call it when the checkbox is checked.

Cory Walker
Sorry, I didn't notice the cocoa tag and assumed you were talking about Javascript. Perhaps you should mention this in the main body?
Cory Walker
+2  A: 

In your table view delegate, implement this method:

tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex

From there you can get the checkbox button cell at the given row, and change the cell's drawing style based on it's state. Keep in mind though that cells are re-used, so you'll have to set the cell style for both checked and unchecked states.

I'm not too clear on what sort of drawing style you're aiming for. Try with a basic NSTextFieldCell first and if you can't accomplish what you're trying to do, create an NSCell subclass and handle the drawing code yourself.

Marc Charbonneau
I'm using core data so where would i add that?
Joshua
Your table view's delegate methods are called regardless of whether you're feeding it data with bindings or a data source object. If you don't know how delegation works in Cocoa yet it might be a good idea to hold off on using bindings and stick with data source methods. It's really important to understand the basics well, or you're going to run into problems with things like bindings.
Marc Charbonneau