Re: NSMatrix Questions (was: Re: Another Table View Question)
Re: NSMatrix Questions (was: Re: Another Table View Question)
- Subject: Re: NSMatrix Questions (was: Re: Another Table View Question)
- From: "Lizardo H. C. M. Nunes" <email@hidden>
- Date: Wed, 10 Oct 2001 00:24:38 -0200
Hi, Sam
I'm working on something similar, so take a look at a simple version of it.
(Unfortunately I have little time to expend with it, that's why it's hard to
make any progress...). Since I'm a newbie, list folks here can take a look
and say what's wrong... Bear in mind that I'm not concerned about memory
allocation yet.
Anything I shall do (if usable ) should be GPL, I hope you follow the same
philosophy. Anyway,
MyMatrix.m:
@implementation MyMatrix
-(BOOL)isOpaque{ return YES; }
- (BOOL)drawsBackground{ return YES; }
- (BOOL)drawsCellBackground{ return YES;}
- (id)initWithFrame:(NSRect)frameRect
{
id aCell = [ self prototype ]; <--- look at the method below.
/* prototype sets cells attributes */
// iniates matrix:
[ self initWithFrame:frameRect
mode:aMode <--- Choose a Mode here
prototype: (id) aCell
numberOfRows: integer <--- Give an integer
numberOfColumns: integer <--- Again another integer
];
// appearance:
/* You may place here a bunch of stuff... <----- */
[ self setScrollable: YES ]; /* That makes cell scrollable */
return self;
}
/* Notice it's overridden: */
-( id )prototype
{
// This sets cells attributes:
id aCell = [ [ NSTextFieldCell alloc ] init ]; <--- Choose your cell
type
/* You may place more stuff here */
[ aCell setBordered: YES ]; <--- Here is where you get a bordered cell
!!
return aCell;
}
(...)
Have fun,
Lizardo H. C. M. Nunes
...But we preach Christ crucified, to the Jews a stumbling block, and to the
Greeks foolishness;(...)but God has chosen the foolish things of the world
to confound the wise, and God has chosen the weak things of the world to
confound the things which are strong;(I Cor.1:23&27)
----------
>
From: email@hidden
>
To: email@hidden
>
Subject: NSMatrix Questions (was: Re: Another Table View Question)
>
Date: Tue, Oct 9, 2001, 5:42 AM
>
>
Cooooooool. After playing around with NSMatrix, I got a bunch of stuff
>
working, but I don't get how to have my cells bordered. Do I have to
>
make my own NSTextCellType subclass and then use NSMatrix's setPrototype
>
method? I don't really get tons, but I will try to understand the header
>
files a little more.
>
>
The major question for me here is this: is the functionality of the
>
cells in the matrix controllable from the matrix, or do I have to
>
subclass NSCell to be more to my liking.
>
>
This is sort of new to me, so I might be asking the wrong questions.
>
Answer me in anyway you see fit.
>
>
Thanks,
>
Sam
>
>
P.S. I plan to post all of these remedial examples (once I understand
>
them) on the web for others.
>
>
On Monday, October 8, 2001, at 09:54 PM, Erik M. Buck wrote:
>
>
Try NSMatrix instead of NSTableView
>
>
----- Original Message -----
>
From: <email@hidden>
>
To: <email@hidden>
>
Sent: Monday, October 08, 2001 9:08 PM
>
Subject: Another Table View Question
>
>
>
OK, thanks for the feedback on my last question. Now I have one of a
>
different nature.
>
>
The only object beside NSObject (for controllers) that I have ever
>
subclassed was an NSView and I didn't really succeed. I do, however,
>
understand the principals behind it.
>
>
When I use the TableView, I really hate the way that it tabs through
>
cells when the user presses return. I would prefer to have the cell (and
>
all cells) to lose focus and have nothing be highlighted. Also, I would
>
like to have only one cell be highlighted at a time, as opposed to the
>
entire row. Overall, I want it to respond like a spreadsheet application.
>
>
Question: How would I go about doing this. I looked into the
>
documentation, but still don't know what to modify to make the table
>
view respond the way I want it to.
>
>
Thanks,
>
Sam
>
_______________________________________________
>
cocoa-dev mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
_______________________________________________
>
cocoa-dev mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev