[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GORM and NSCollectionView
From: |
Fred Kiefer |
Subject: |
Re: GORM and NSCollectionView |
Date: |
Sat, 07 Mar 2015 23:50:40 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
I made a little progress on this. If I call
[self setAutomaticallyRearrangesObjects: YES];
in the method initWithCoder: of the NSArrayController and use a separate
setStudents: method on the AppController I finally get all the new
students in the array. What still isn't working is the display of the
NSCollectionViewItem, but then nothing has been set for these views. I
will need to test your code in my Mac to have a clearer understanding of
what to expect from it.
Fred
Am 07.03.2015 um 11:57 schrieb Fred Kiefer:
> You should forget about converting your NIB file to gorm format, there is no
> reason for doing so, now that GNUstep supports NIB and XIB format. Just stick
> with .nib files and try to get these working with GNUstep, which will be hard
> enough.
>
>
> I did a few more changes and the error messages you reported as item 3.
> should be resolved now. But this wont help with the fourth issue. There are a
> lot of different problems here and I am not sure whether I will be able to
> resolve them all.
>
> The first is that you connect to the arranged elements of the
> NSArrayController, in GNUstep we did not, up to now, prearrange the array
> elements. I will have to check whether Apple does that, but have added this
> as the default already. This new code will not be used for objects loaded
> from a NIB file, I will have to add more code here. The next problem is that
> you are using bindings heavily, the array controller is bound to the studends
> ivar of the AppController and now we have an order issue. This ivar only gets
> set in the awakeFromNib method and then the value gets past on over two
> separate bindings, which need to be instanciated in the correct order to
> work. GNUstep wont be able to send change notifications for instance
> variables, Apple may be able to do so.
>
> Another internal issue is that the content of the NSViewController now gets
> set to NSNull instead of nil, which is what I would expect as long as we
> cannot resolve the issue with the studends ivar. Somewhere in the depths of
> KVB we seem to have a conversion going on.
>
> As you can see, I am still on this problem but don't expect any fast
> solution. Any help in working on these separate issues will be highly
> appreciated.
>
> Fred
>
> On the road
>
> Am 06.03.2015 um 10:16 schrieb Alessandro Sangiuliano <alex22_7@hotmail.com>:
>
>> 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
- GORM and NSCollectionView, Alessandro Sangiuliano, 2015/03/03
- Re: GORM and NSCollectionView, Fred Kiefer, 2015/03/05
- Re: GORM and NSCollectionView, Alessandro Sangiuliano, 2015/03/06
- Re: GORM and NSCollectionView, Fred Kiefer, 2015/03/07
- Re: GORM and NSCollectionView,
Fred Kiefer <=
- Re: GORM and NSCollectionView, Fred Kiefer, 2015/03/08
- Re: GORM and NSCollectionView, Alessandro Sangiuliano, 2015/03/09
- Re: GORM and NSCollectionView, Fred Kiefer, 2015/03/10
- Re: GORM and NSCollectionView, Alessandro Sangiuliano, 2015/03/12
- Re: GORM and NSCollectionView, Fred Kiefer, 2015/03/12
- Re: GORM and NSCollectionView, Alessandro Sangiuliano, 2015/03/16
- Re: GORM and NSCollectionView, Fred Kiefer, 2015/03/16
- Re: GORM and NSCollectionView, Riccardo Mottola, 2015/03/17
- Re: GORM and NSCollectionView, Alessandro Sangiuliano, 2015/03/17
- Re: GORM and NSCollectionView, Fred Kiefer, 2015/03/19