discuss-gnustep
[Top][All Lists]
Advanced

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

problems with NSMatrix insertColumn and GS vs Mac difference


From: Riccardo Mottola
Subject: problems with NSMatrix insertColumn and GS vs Mac difference
Date: Wed, 29 Jul 2015 12:31:00 +0200
User-agent: GNUMail (Version 1.2.2)

Hi,

I want to display a sort of "list" using a single-row NSMatrix. I add all cells at once.

On Mac, I have the following code, each time I update the list:


  [legendMatrix removeColumn:0];
<...>
[legendMatrix renewRows:[legendCellArray count] columns:1]; /* This is needed on Mac to resize the matrix before inserting the new column */
  [legendMatrix insertColumn:0 withCells:legendCellArray];
  [legendMatrix sizeToCells];

"renewRows" is absolutely needed, or insertColumn will crash. Do you think this code is correct? It appears to work fine

On GNUstep, this gives me second, empty column at the right of the column with the legendCellArray items.
On gnustep I can remove renewRows and everything works fine.

Before saying this is a bug, I ask if the code looks sound to you.

"insertColumn" always confuses me. The Doc says:
f column is greater than the number of columns in the receiver, enough columns are created to expand the receiver to be column columns wide. newCells should either be empty or contain a sufficient number of cells to fill each new column. If newCells is nil or an array with no elements, the call is equivalent to calling insertColumn:. Extra cells are ignored, unless the matrix is empty. In that case, a matrix is created with one column and enough rows for all the elements of newCells.

If I have none, I'd expect it to insert one (like GNUstep) and not to crash, perhaps 0 is a special case?


Thank you - Riccardo




reply via email to

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