PDA

View Full Version : Display bug with the header on a NSOutlineView




phjo
Mar 23, 2008, 11:19 AM
At least it looks like a bug...

I have put a NSOutlineView in my window, which is embedded in a NSScrollView, with one column.

The data is displaying fine, with collapsible parts etc, but I have this strange problem with the header as soon as I scroll horizontally the outline view column : the header is shifted some 10 or 15 pixels to the left, and the title is then missing a few chars... Things go back to normal when I make the window large enough to get rid of the horizontal scroller...

That's quite ugly, and the problem seems quite the same as the one discussed in this mailing list : http://lists.apple.com/archives/Cocoa-dev/2001/Nov/msg00803.html except that my window is simpler as I do not have two scrollviews embedded in each other, just one containing the NSOutlineView...

Here is the normal header :
http://img219.imageshack.us/img219/7060/image1oo2.png

And the header such as it appears after expanding one item and playing with scroller (to the right and back to the left) :

http://img329.imageshack.us/img329/7014/image2bo9.png

Has anyone seen this ? and is there a fix for it ?

phjo

P.S. : it looks like there is a display bug in the items as well, as when the bug appears, if I collapse every item from the root, then the header goes back to normal, but the items are shifted to the right somewhat... (and move again to the left as soon as I expand one of the items...)

P.P.S : I am using XCode+IB 3



Eraserhead
Mar 23, 2008, 11:23 AM
Try in a new window in a different file to check its not just a weird corruption with that nib file.

Also are you currently using any code to control the UI or are you just using Interface Builder?

phjo
Mar 23, 2008, 11:50 AM
Try in a new window in a different file to check its not just a weird corruption with that nib file.


I'm not sure how I can do that... redoing the nib from scratch, only keeping the code ?

Well, I might try it, but I don't suppose it will change a thing, and if it did, it would be even worse and weirder to think that the bug is in interface builder rather than in NSOutlineView (or in my understanding of it, of course...)


Also are you currently using any code to control the UI or are you just using Interface Builder?

There is of course some code, but right now there is not much more than the data initialization and datasource methods (for one NSTableView and one NSOutlineView side by side)... (No bindings.)

phjo

Eraserhead
Mar 23, 2008, 11:52 AM
I'm not sure how I can do that... redoing the nib from scratch,

Well just to include the troublesome elements yes, not the whole thing. Just to see if its repeatable. i.e. a bug or just a file corruption.


There is of course some code, but right now there is not much more than the data initialization and datasource methods (for one NSTableView and one NSOutlineView side by side)... (No bindings.)

phjo

That shouldn't cause a problem like this.

phjo
Mar 23, 2008, 12:29 PM
Well, it looks like you're just right, Eraserhead, as by redoing the window nib in a different project, I can't reproduce the display bug it seems...

It raises some stability issues with interface builder though if one has to cope with such random and weird behaviour at times...

phjo

kainjow
Mar 23, 2008, 02:50 PM
I've had weird issues like this before where controls just go funky on you. Rebuilding the control in the NIB has fixed it every time for me.

phjo
Mar 23, 2008, 03:42 PM
Yes, removing and adding back the NSOutlineView has fixed it in my original project... Better than to redesign the window from scratch obviously...

I'll need quite a bit of time to get used to interface builder though... I had some trouble obtaining a button resting under the NSOutlineView to stay left-aligned to it when resizing the window... (I could only get it to work with small square button, and couldn't figure out why...)

phjo

Eraserhead
Mar 23, 2008, 06:16 PM
Look at this page (Size Inspector), the moving graphic shows how the object moves with resizing.

109109

phjo
Mar 24, 2008, 02:01 AM
Well, of course I do know about the size inspector, and played a lot with it !

How do you figure I finally got what I wanted?

The problem is I had a million of trial and fail sessions before it worked, and I have no idea why it finally worked, and why it failed previously...

You can try it yourself :
put a NSTableView and a NSOutlineView side by side, and one square button under each, left aligned with the two views. (The button will be a + button to add one row.)

The tableview on the left is configured to resize on both directions, sticking to the top, left and bottom on the window

The outlineview on the right is configured to resize on both directions, sticking to the top, right and bottom on the window

The two buttons are not resizable, and stick only to the bottom, and finally by selecting the left tableview and its associated button, I tried to declare them left-aligned, ditto for the outlineview and its button.

Now when I test the resizing in the cocoa simulator, most of the time, one of the two buttons at least do not stay left-aligned with its view, and I have no idea why sometimes it works (and then I try not to touch anything from that moment !) and the rest of the time it doesn't...

The fact that I got it to work lead me to think my understanding of the size inspector is correct, but please correct me if I am wrong...

EDIT : A split view is better for what I want to achieve as far as UI goes. I am going this route now...

phjo

Eraserhead
Mar 24, 2008, 06:30 AM
The problem is I had a million of trial and fail sessions before it worked, and I have no idea why it finally worked, and why it failed previously...

What I was trying to point out is that the moving graphic on the blue background, shows how the object should move around with resizing ;).