[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSBrowser resizing weirdly
From: |
Fred Kiefer |
Subject: |
Re: NSBrowser resizing weirdly |
Date: |
Fri, 29 Nov 2013 23:03:53 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
On 23.11.2013 18:26, Sebastian Reitenbach wrote:
>
> On Saturday, November 23, 2013 18:08 CET, Fred Kiefer <fredkiefer@gmx.de>
> wrote:
>
>> On 23.11.2013 16:29, Sebastian Reitenbach wrote:
>>>
>>> I have an NSBrowser in a NSWindow in Gorm, and set its autosizing, so that
>>> it should resize properly when the window is resized. However, when I first
>>> resize the window in the application, then the bottom of the NSBrowser
>>> jumps over the buttons below it, and produces the GAP on top of the
>>> NSBrowser. Later resizes are fine, and the NSBrowser expands/shrinks
>>> following the window, but staying on top of the buttons, and keeping the
>>> gap on top.
>>> See attached screenshot, left is the Browser in action in the application,
>>> right side shows how its setup in Gorm.
>>> I use latest releases of gnustep libraries.
>>>
>>> Is there anything I should have a look at? Maybe I'm missing something.
>>>
>>> Sebastian
>>
>> Could you please provide the Gorm file for this application? The
>> interesting question is whether the buttons live in a separate view and
>> how that view has been set up for autoresizing. You could also try to
>> save the Gorm file as a NIB and test the behaviour on a Mac.
>>
>> For me currently Gorm isn't working. It isn't possible to drag anything
>> into a window. I need to resolve this issue before being able to try to
>> build a similar situation in Gorm.
>
> I've just seen, the NSBrowserTest from gnustep-examples, also has a
> large gap on top like I see with that CollectionBrowser. This NSBrowserTest
> is not using .gorm, and gets created programatically, but as far as I can see
> there,
> there shouldn't be such a large gap.
I think the gap in the NSBrowserTest is intentional. And this code
doesn't even use the autoresize code.
More relevant to your problem might be the code we have in GSTest. There
the browsers cannot be reduced below the original height.
I cannot compile MPDCon as I don't have SQLClient installed. And I
cannot build up a simple example myself as for me Gorm is still broken,
D&D isn't working. I think this is caused by a fancy KDE window manager
behaviour where two X windows get inserted into the window hierarchy.
What I still don't understand is why I cannot find the GNUstep windows
in the window hierarchy reported by xwininfo.
I already wrote that you should put your buttons in a separate view
and make that resizeable. That way the autoresize mechanism would have
two views to split up the resizing. But looking at the Gorm file I
already see an NSBox around the buttons. I checked from gdb, as sadly
there is no way to display the view hierarchy within Gorm:
gdb) po [self->_contentView _subtreeDescription]
h=-&- v=-&- <GormInternalViewEditor: 0x10775f0> f={x = 3; y = 4; width
= 498; height = 345} b={x = 3; y = 4; width = 498; height = 345}
h=-&- v=-&- <NSView: 0xd1b210> f={x = 3; y = 4; width = 498; height =
345} b={x = 0; y = 0; width = 498; height = 345}
h=--& v=&-- <GormBoxEditor: 0xda26a0> f={x = 0; y = -6; width =
498; height = 35} b={x = 0; y = -6; width = 498; height = 35}
h=-&- v=--& <NSBox: 0xf71370> f={x = 0; y = -6; width = 498;
height = 35} b={x = 0; y = 0; width = 498; height = 35}
h=--- v=--- <GormInternalViewEditor: 0xde5360> f={x = 7; y = 7;
width = 484; height = 21} b={x = 7; y = 7; width = 484; height = 21}
h=--- v=--- <NSView: 0xe626b0> f={x = 7; y = 7; width = 484;
height = 21} b={x = 0; y = 0; width = 484; height = 21}
h=--& v=&-- <GormButtonEditor: 0xe78040> f={x = 0; y = 0; width =
58; height = 24} b={x = 0; y = 0; width = 58; height = 24}
h=--& v=--& <NSButton: 0x1107950> f={x = 0; y = 0; width = 58;
height = 24} b={x = 0; y = 0; width = 58; height = 24}
h=--& v=&-- <GormButtonEditor: 0xf63770> f={x = 442; y = 0; width =
56; height = 24} b={x = 442; y = 0; width = 56; height = 24}
h=&-- v=--& <NSButton: 0x1137bd0> f={x = 442; y = 0; width = 56;
height = 24} b={x = 0; y = 0; width = 56; height = 24}
h=--& v=&-- <GormControlEditor: 0xd96f40> f={x = 0; y = 29; width =
498; height = 316} b---Type <return> to continue, or q <return> to quit---
={x = 0; y = 29; width = 498; height = 316}
h=-&- v=-&- <GormNSBrowser: 0x10a4270> f={x = 0; y = 29; width =
498; height = 316} b={x = 0; y = 0; width = 498; height = 316}
h=--- v=--- <NSScroller: 0xde6100> f={x = 2; y = 1; width =
494; height = 18} b={x = 0; y = 0; width = 494; height = 18}
h=--- v=--- <NSScrollView: 0xc70f90> f={x = 0; y = 23; width =
163; height = 270} b={x = 0; y = 0; width = 163; height = 270}
h=-&- v=-&- <NSClipView: 0xf38700> f={x = 21; y = 2; width =
140; height = 266} b={x = 0; y = 0; width = 140; height = 266}
h=--- v=--- <NSMatrix: 0x10a3a00> f={x = 0; y = 0; width =
140; height = 100} b={x = 0; y = 0; width = 140; height = 100}
h=--- v=-&- <NSScroller: 0xc0b440> f={x = 2; y = 2; width =
18; height = 266} b={x = 0; y = 0; width = 18; height = 266}
h=--- v=--- <NSScrollView: 0xcf7b00> f={x = 167; y = 23; width
= 163; height = 270} b={x = 0; y = 0; width = 163; height = 270}
h=-&- v=-&- <NSClipView: 0xb498d0> f={x = 21; y = 2; width =
140; height = 266} b={x = 0; y = 0; width = 140; height = 266}
h=--- v=-&- <NSScroller: 0xb3fcc0> f={x = 2; y = 2; width =
18; height = 266} b={x = 0; y = 0; width = 18; height = 266}
h=--- v=--- <NSScrollView: 0xe4e430> f={x = 334; y = 23; width
= 164; height = 270} b={x = 0; y = 0; width = 164; height = 270}
---Type <return> to continue, or q <return> to quit---
h=-&- v=-&- <NSClipView: 0x117f090> f={x = 21; y = 2; width =
141; height = 266} b={x = 0; y = 0; width = 141; height = 266}
h=--- v=-&- <NSScroller: 0xdd0d50> f={x = 2; y = 2; width =
18; height = 266} b={x = 0; y = 0; width = 18; height = 266}
This looks correct to me. So I started to check the actual source code
and there I found this in CollectionBrowser.m:
- (void)windowDidResize:(NSNotification *)aNotification
{
NSRect rect = [[self window] frame];
rect.origin.x = rect.origin.y = 10;
rect.size.width -= 20;
rect.size.height -= 150;
[browser setFrame: rect];
[browser sizeToFit];
[[[self window] contentView] setNeedsDisplay: YES];
}
Looks to me as if the browser gets positioned manually. You should try
and comment out this code first before thinking about resizing issues in
gui.
Hope this helps,
Fred