Initial sizing/layout of split pane/divider

9 views
Skip to first unread message

Luke

unread,
Jan 20, 2023, 3:29:09 AM1/20/23
to Cappuccino & Objective-J
My app currently won't layout quite right when it initially displays a vertical split pane.
The divider isn't drawn the whole height on first drawing.

BadLayout.png
However, if (in this case), I flip between the tabs of the parent view, then the split pane and its vertical divider _do_ size and draw correctly:

GoodLayout.png

I suppose I could hack in a programmatic switch between the tabs when the app first loads and displays, but perhaps there are other ideas about what might fix this discretely, or some other trick to more elegantly force the resize/layout of the view hierarchy once the cib has been loaded and initialized?  

As far as I can tell, all the sizes of the views are correct in the original xib, and as noted, the sizing does behave correctly once you've 'poked' it (and continues to behave well after that as you move dividers, switch tabs or resize the whole window).  Therefore, it does seem to be an initialization/first sizing thing.  

Martin Carlberg

unread,
Jan 20, 2023, 4:31:51 AM1/20/23
to Cappuccino & Objective-J
Hi!

I have not seen this before. It might be the combination of a tab view along with a split view.

Do you get the same if you just use one of them?

Also, have you tried to manually tell the view to resize with:

    [view sizeToFit];


or

    [view setNeedsLayout];

 

- Martin

20 jan. 2023 kl. 09:29 skrev Luke <luke....@gmail.com>:

My app currently won't layout quite right when it initially displays a vertical split pane.
The divider isn't drawn the whole height on first drawing.

<BadLayout.png>
However, if (in this case), I flip between the tabs of the parent view, then the split pane and its vertical divider _do_ size and draw correctly:

<GoodLayout.png>

I suppose I could hack in a programmatic switch between the tabs when the app first loads and displays, but perhaps there are other ideas about what might fix this discretely, or some other trick to more elegantly force the resize/layout of the view hierarchy once the cib has been loaded and initialized?  

As far as I can tell, all the sizes of the views are correct in the original xib, and as noted, the sizing does behave correctly once you've 'poked' it (and continues to behave well after that as you move dividers, switch tabs or resize the whole window).  Therefore, it does seem to be an initialization/first sizing thing.  


--
You received this message because you are subscribed to the Google Groups "Cappuccino & Objective-J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objectivej+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/objectivej/22a83064-18b0-476c-b646-83348883a5acn%40googlegroups.com.
<GoodLayout.png><BadLayout.png>

Luke

unread,
Jan 20, 2023, 1:27:07 PM1/20/23
to Cappuccino & Objective-J
It does seem to be the combination of the TabView as a parent to the vertical split view.

When I strip out the TabView and just have what was the left content be lifted up to the parent the TabView was in (and then reassert the container be taking full width/height), then everything works well.

I tried [view sizeToFit]; and  [view setNeedsLayout];  in an applicationDidFinishLaunching handler, which didn't work.
However, if I do [tabView selectLastTabViewItem:self];  [tabView selectFirstTabViewItem:self];  in applicationDidFinishLaunching, then that dirty hack does work, and everything is forced to correct size. 

Keary Suska

unread,
Jan 20, 2023, 2:39:16 PM1/20/23
to objec...@googlegroups.com
Sizing and placement of subviews in tab views—when using XcodeCapp--have been broken for as long as I can remember. To get around this, I always have subviews as separate views in the xib and add them on -awakeFromNib. It’s the only thing that I have found that works consistently.

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business”
> To view this discussion on the web visit https://groups.google.com/d/msgid/objectivej/a2e71b45-9ff7-4857-9a5a-1bc5acc84c05n%40googlegroups.com.

Luke

unread,
Jan 20, 2023, 2:48:14 PM1/20/23
to Cappuccino & Objective-J
Thanks for the confirmation and suggestion Keary
Reply all
Reply to author
Forward
0 new messages