discuss-gnustep
[Top][All Lists]
Advanced

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

Re: problems with NSMatrix insertColumn and GS vs Mac difference


From: Fred Kiefer
Subject: Re: problems with NSMatrix insertColumn and GS vs Mac difference
Date: Tue, 11 Aug 2015 00:04:54 +0200

Sorry, I was completely wrong in my first reading of the documentation. There 
is only one small difference between the current GNUstep implementation and 
Apples. When there are no cells at all in the matrix and you insert a new 
column or row with a cell array, Cocoa will complain about the size of the 
array not matching the existing row or column number. Of course this behaviour 
is stupid, but we probably should adopt to it. Or at least print out a warning 
message.

Fred

On the road

Am 08.08.2015 um 00:13 schrieb Fred Kiefer <fredkiefer@gmx.de>:

> I looked at the GNUstep implementation and at the Cocoa documentation
> and the GNUstep code is clearly wrong. Most likely the old documentation
> wasn't as clear as the new one.
> 
> What we should do here is only expand the matrix if the column index is
> bigger (or equal) than the old number of columns. This makes the code a
> lot easier, as we don't need that rotation bit.
> We also shouldn't use the provided cells, if there are too few of them.
> 
> This rewrite is of course also needed for rows and we should figure out,
> if the _renewRows:... method could be simplified given that change. I
> hope to find time to make this change on Sunday, but wouldn't complain
> much if somebody beats me on that.
> 
> Fred
> 
>> Am 29.07.2015 um 12:31 schrieb Riccardo Mottola:
>> 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
> 
> 
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep



reply via email to

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