discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions about NSMatrix and NSTableView


From: Benoit Astruc
Subject: Re: Questions about NSMatrix and NSTableView
Date: Sat, 12 Feb 2005 01:54:30 +0100

In my app I use some NSTableView, on Mac OS X, without coding anything the user can move from one cell to the other simply by pressing the down or up key. But on GNUstep it doesn't work :-(. So my question : will NSTableView in GNUstep one day have this enable by default and if not how can i do enable it ?

Could you please describe in more detail what you would expect pressing the up, down (probably also left, right) key to trigger? Normally an NSTableView is working with rows or columns, cells come only into play when you select or edit one. Are you now talking about the cell selection, which should be moved or about the row/column selection?

Pressing the down key would change the selected row for the next row (the row under the row selected) and the up key would change the selected row for the previous row. I don't have test with right and left key because I use only one row NSTable at the moment.

I wrote a short demo applciation to test the described behaviour and yes,the output on GNUstep does not show the new cells. The I looked up the definition of addRow in the specification:

"This method doesn t redraw the receiver. Accordingly, after calling this method you should send setNeedsDisplay (page 472) to the receiver. Your code may also need to use sizeToCells (page 855) after sending this method to resize the receiver to fit the newly added cells."

When adding these two methods after a call to addRow, my demo application behaves as expected. It may well be that Cocoa no longer follows its own specification and the calls are no longer necessary there, but I think that GNUstep should stick with the old behaviour until the specification changes. What you need to do is add two lines after each call to addRow.

[matrix sizeToFit];
[matrix setNeedsDisplay: YES];

This should do the trick on GNUstep and hopefully doesn't cause any harm on Cocoa, but who knows.

I just test this on Cocoa and it change a lot the behaviour of the NSMatrix. But after reading your comments I think that I was doing things the wrong way and the best thing I have to do is to recode that part using sizeToCells. But the behaviour of NSMatrix is quite strange for me, well I am tired now and I prefer to see that tomorrow.

        Thanks to your help.


@+
Benoit





reply via email to

[Prev in Thread] Current Thread [Next in Thread]