discuss-gnustep
[Top][All Lists]
Advanced

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

NSMatrix woes


From: Christopher Culver
Subject: NSMatrix woes
Date: Fri, 20 Jun 2003 14:49:53 +0300

The latest difficulty in my Charmap application relates to the NSMatrix class. Charmap is organised in such a way that clicking on an NSBrowser entry (representing a Unicode block, e.g. Greek Extended, CJK Unified Ideographs, etc) calls a Controller method that redraws the charmap. That is, the Controller removes all cells, adds only the number of cells necessary for that Unicode block, and fills the cells each with one character.

Here's how I remove the cells:
 // Remove all cells
 int numRows = [charmapMatrix numberOfRows];
 int numColumns = [charmapMatrix numberOfColumns];
 for (i = numRows; i > 0; i--)
   [charmapMatrix removeRow: i];
 for (j = numColumns; j > 0; j--)
   [charmapMatrix removeColumn: j];

This works just fine, and if that's all there is to it then the result is an empty NSMatrix. However, the problem lies in adding new rows and columns. This is an oversimplification, but this is what I'm doing that doesn't work:
  //  Add the necessary cells
 [charmapMatrix addRow];
 [charmapMatrix addRow];
 [charmapMatrix addColumn];
 [charmapMatrix addColumn];

Though this should result in two columns and two rows, i.e. four cells, it doesn't. No matter how many times I call addRow and addColumn, in the end the NSMatrix displays only one row and one column, i.e. one cell.

I have been sure to call [charmapMatrix setNeedsDisplay: YES] before this method returns, but it doesn't make a difference. So, what am I doing wrong with this NSMatrix? How do I add rows and cells in a way that actually works?

If anyone wants to see the code, you can checkout charmap from Savannah. The current CVS commit has the problem which I'm asking about here. Be aware the application doesn't actually do anything yet.

Christopher Culver





reply via email to

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