Re: NSBrowser question

2005-11-26 Thread Sašo Kiselkov
Quoting Andreas Höschler [EMAIL PROTECTED]:

 Hello all,

 I have done the following

 [browser setMatrixClass:[FinderBrowserMatrix class]];

 in order to implement dragging in a browser so I get a call to

   - (void)mouseDown:(NSEvent *)event

 on an instance of FinderBrowserMatrix. Any idea how I  get back to the
 browser in this method? Via superview I got to the ScrollView and
 expected the documentView of the NSScrollView to be the browser (like I
 set it up), but the documentview is an instance of FinderBrowserMatrix!?

No, it behaves correctly. Your problem is that NSBrowser creates a scroll view
for each of it's columns and puts an instance of your view's class inside such
a scroll view. Therefore, the right (though a bit dirty) way is the following:

@implementation NSView (FindingMyBrowserAdditions)
// finds the nearest enclosing browser view and returns it
- (NSBrowser *) enclosingBrowser
{
  NSView * view;

  for (view = [self superview]; view != nil; view = [view superview])
{
  if ([view isKindOfClass: [NSBrowser class]])
{
  break;
}
}

  return (NSBrowser *) view;
}
@end


 Thanks a lot!

 Regards,

Andreas


You're welcome ;-)

--
Saso




___
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnustep


NSBrowser question

2005-11-24 Thread Andreas Höschler

Hello all,

I have done the following

   [browser setMatrixClass:[FinderBrowserMatrix class]];

in order to implement dragging in a browser so I get a call to

- (void)mouseDown:(NSEvent *)event

on an instance of FinderBrowserMatrix. Any idea how I  get back to the 
browser in this method? Via superview I got to the ScrollView and 
expected the documentView of the NSScrollView to be the browser (like I 
set it up), but the documentview is an instance of FinderBrowserMatrix!?


Thanks a lot!

Regards,

  Andreas




___
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnustep