[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GWorkspace issues

From: Nicola Pero
Subject: Re: GWorkspace issues
Date: Sun, 28 Jan 2001 16:38:52 +0000 (GMT)

>>>>> "Enrico" == Enrico Sersale <address@hidden> writes:

    Enrico> On Sun, 28 Jan 2001, Enrico Sersale wrote:

    >> On Sun, 28 Jan 2001, Philippe C.D. Robert wrote:
    >> > Hi Enrico, > > two issues (latest GS code, GWorkspace 0.1.5):
    >> > > A) When selecting different views in the inspector's popup
    >> the app > crashes when the same view gets selected for the
    >> second time. This can > be reproduced easily (check Attributes
    >> and Access Control).
    >> This bug was already reported... Unfortunately, I can't
    >> reproduce it.  Please, send me a trace.
    >> > B) The shelf is now at the bottom of the window.... hmm
    >> ...;-) I > really think the position on top was better suited,
    >> since you had to > move the mouse less to access the icons I'd
    >> say.
    >> I've not moved the shelf at the bottom ;-) This comes from the
    >> recent changes in NSSplitView.

    Enrico> I'm having some problems in fixing this.  Or I can't see
    Enrico> where the error is, or a bug was added in NSSplitView.

Hi Enrico, 

I looked at your code - I could send you it updated for the new
library code if you want - in practice you would need to use:
[browserView setPostsFrameChangedNotifications: YES];
[[NSNotificationCenter defaultCenter] addObserver: self 
                            selector: @selector(shelfResized:) 
                            name: NSViewFrameDidChangeNotification
                            object: (id)browserView];

rather than the same using shelf.

This because now the shelf and the browserView have exchanged their
roles, due to flipping the coordinates, so when you before looked for
the shelf changing its size to tile your splitview, now you need to
look for the browserview.  Why the order is important ?  Well - the
problem is you are using a hack :-) to get what you want - your code
depends on the specific order in which the library internally resizes
the splitview's subviews - I don't blaim you for this - it's rather
the library's fault - the library didn't provide you with an API to
constrain the divider position.

So - I implemented for you the Apple extension

- (float)splitView:(NSSplitView *)splitView

and added it to NSSplitView - so you can use a standard API
independent on the library internals to do what you need.  You can now
implement this method in your NSSplitView's delegate as follows:

- (float) splitView: (NSSplitView *)sender
constrainSplitPosition: (float)proposedPosition
        ofSubviewAt: (int)offset
  if (proposedPosition < 35) 
      return 2;
  else if (proposedPosition <= 75) 
      return 75;
      return 150;

to constrain the splitview divider to the positions of your choice
during dragging - it is also much nicer for the user since he/she sees
the divider only going to where he/she can move it.

This should constrain the splitview divider where you want it.  Then,
rearranging positions/sizes inside each splitview subview should be
done by code belonging to the subview - and you should not need to use
notifications for frame changes - just use the standard ways of
rearranging the subviews inside a view when it's resized - for
example, to resize the lower views, you can either try with
autoresizing masks, or embed them into a view in which you implement
resizeWithOldSuperviewSize: to position them at your wish.  

Please mail me directly in Italian if you have any problems.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]