On Feb 23, 2013, at 10:01 PM, Graham Cox <graham....@bigpond.com> wrote:
>> When a popover is still anchored to its parent window, the popover view's >> window is the parent window -- which makes sense, when you think about it, >> because a popover is just another view in the main window. > > Are you sure about that? I'm not... it would make sense to me if the popover > window was a separate window, a child of the original window. That's how it > acts and behaves. For example if the popover falls outside the bounds of the > original view or window, it has its own shadow etc, and is unclipped by the > original window. The internal pointers to the view's window might return some > other window of course, but I don't think so - I have tried for example, to > attach a sheet to a popover by asking for the view's -window as the sheet's > parent and it attached the sheet to the popover. Turned out to be a bad idea, > but it worked, sort of. You're right in terms of the underlying implementation of NSPopover. In any of the NSPopover delegate methods, log [[[popover contentViewController] view] window] or [[[[notification object] contentViewController] view] window] and you'll get a window object whose iVar is _NSPopoverWindow. You can do essentially the same thing to get the window of a drawer's content. What I was getting at is how the date picker in the popover sees the world. I subclass NSDatePicker in order to intercept the key down event, then I log the window of the event. When the date picker is in the anchored popover, the event window is the parent window, not the private popover window, and the date picker works as expected. When the date picker is in the detached popover window, the event window is, as expected, the newly created detached popover window -- and the date picker doesn't highlight its elements (although it works correctly in every other respect). I assume that the change in window is the source of the problem with the date picker's highlighting behavior after the popover is detached. But I don't understand exactly what's happening, or what I can do about it. >> When the popover is detached, the new, separate popover view's window is the >> detached popover window. > > > Do you need to call -makeKeyAndOrderFront: on the detached window? I tried that and it does nothing. That was expected, because I implement -windowDidBecomeKey: in the parent window controller and it is triggered when I detach the popover -- and the notification object is the detached window. -- Bill Cheeseman - b...@cheeseman.name _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com