Il 05/03/2015 22:58, Fred Kiefer ha scritto:
I used gdb to get the full stack trace form Gorm. The problem happens
when line 161 in NSCollectionView.m tries to get the item 0 while there
isn't any item in the subview list.
The issue that causes this strange behaviour seem to be the MIN macro.
I added the following line before the loop:
NSLog(@"first %d last %d %d %d %d", firstIndexInRect, lastIndexInRect,
[_items count] - 1, [self _indexAtPoint: oppositeOrigin], MIN(-1, 12));
This prints:
2015-03-05 22:40:31.307 Gorm[2624:2624] first 0 last 12 -1 12 -1
lastIndexInRect is 12 while it should be -1, but doing the same MIN call
with constants gives the correct result. When I extract the count to a
variable first and use that it also works. This definitely seems to be
compiler magic, most likely it gets the type of the count method as
NSUInteger and uses [_items count] - 1 also as unsigned.
I fixed this and hope that your application now works on GNUstep.
Fred
Am 03.03.2015 um 13:30 schrieb Alessandro Sangiuliano:
Hello, some days ago I wrote a little App to practice with
NSCollectionView.
I wrote it on OS X 10.6.8 XCode 3.2.2 and the relative IB; I ported the
App on GNUstep and when I try to open the nib or the xib file with GORM,
it is saying that:
"Problem Loading
Failed to load file. Exception: Index 0 is out of range 0 (in
'objectAtIndex:')
"
Last GORM update from the svn: Today.
I need this little App on GNUstep because I'll switch my little Calendar
App to NSCollectionView as soon as I can and I'd like to have it on
GNUstep, because I need specifically on GNUstep.
However, if I try to run the App without modify the nib file, it runs, but:
1) If I try to resize the window, it becomes totally black and the App
is not usable.
2) If i click on the button "Add Student", it adds nothing. (It should
add a view)
To implement the GUI, I used IB facilities for Cocoa bindings.
On OS X (10.6.8 and 10.10 too) the App behaves as expected.
The code is on github if you want to give a look. It's possible to try
it with XCode (3.2.2, and probably it also works for XCode 6 because I
have the same implementation on 10.10 and I did not remember differences
on the implementation) or with GNUstep.
https://github.com/AlessandroSangiuliano/NSCollectionView.git
Best regards,
Alex.
_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
First thing, thanks for the fix;
now I split the problem in 2 pieces, what fixed and and works, what still
doesn't work.
What the fix, fixed:
1) I can open the nib file with GORM regurarly now, so it works.
2) If I run the CollectionViewApp targetin the nib file in the GNUmakefile, now
I can resize regurarly w/o getting the window to become black and not usable.
So it works
What still doesnt work (On all this passages I don't modify the internal nib
elements like views and buttons):
1) If I open the nib file with GORM and then I save it as .gorm file, w/o any
modification, when I try to open the .gorm file with GORM what I get is:
"Problem Loading.
Failed to load file. Exception: Range: (28496, 1) Size: 28496"
Does GORM know about bindings?
2) If I target the .gorm file in the GNUmake file (and I do al the necessary
configurations to get the .gorm loaded at startup) what I get is:
"Is not possible to load the main model file "MainMenu" (the translation could
be not precise)
3) If I target the nib file in the GNUmake file, what I get running the app is:
"2015-03-06 10:09:16.487 CollectionView[7953]
[NSConstantString-stringByAppendingPathExtension:] cannot append extension 'gorm' to
empty string
2015-03-06 10:09:16.487 CollectionView[7953]
[NSConstantString-stringByAppendingPathExtension:] cannot append extension
'gmodel' to empty string
2015-03-06 10:09:16.487 CollectionView[7953]
[NSConstantString-stringByAppendingPathExtension:] cannot append extension
'nib' to empty string
2015-03-06 10:09:16.487 CollectionView[7953]
[NSConstantString-stringByAppendingPathExtension:] cannot append extension
'xib' to empty string
2015-03-06 10:09:16.536 CollectionView[7953] No binding exposed on h=-&- v=-&-
<NSCollectionView: 0x1a22e00> f={x = 0; y = 0; width = 474; height = 300} b={x = 0; y = 0;
width = 474; height = 300} for content"
Ignoring the "[NSConstantString-stringByAppendingPathExtension:]" output , the
interesting one is :
"2015-03-06 10:09:16.536 CollectionView[7953] No binding exposed on h=-&- v=-&-
<NSCollectionView: 0x1a22e00> f={x = 0; y = 0; width = 474; height = 300} b={x = 0; y = 0; width
= 474; height = 300} for content"
4) While the App is running clicking on the Add Student Button, nothing
happens, it should add an item view to the NSCollectionView, I think this is a
consequence og the third point.
Thank You again,
Best Regards,
Alex