Re: Dragging Transparent NSWindow with parent NSOpenGLView

NickMtl <[email protected]> Fri, 2 Jul 2010 02:28:21 -0400
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
OK, here's the code I use to allocate the SearchField's window:

    // Allocate SearchFieldWindow Controller
    if ( [SearchFieldWindowController
sharedSearchFieldWindowController] == nil ) // allocate and show
    {
	[SearchFieldWindowController allocSharedSearchFieldWindowController];
	if ( [SearchFieldWindowController sharedSearchFieldWindowController] == nil )
	{
	    wcout << L"Failed to allocate search field";
	    return;
	}
	
	// Add as child window -- so they move together -- FAILED
	NSWindow*	    nsMainWindow	    = [[AppController getAppController]
getMainWindow];
	SearchFieldWindow*  nsSearchFieldWindow	    =
[[SearchFieldWindowController sharedSearchFieldWindowController]
getWindow];
	[nsMainWindow	    addChildWindow:nsSearchFieldWindow ordered:NSWindowAbove];
	
	[[SearchFieldWindowController sharedSearchFieldWindowController]
showWindow:nil];
	
	// Resize Text view
	[[SearchFieldWindowController sharedSearchFieldWindowController]
resizeSearchFieldWindow];
	
    }


> Hrm? This is precisely the situation child windows are designed for.
> We use them all over the place to keep overlays on top of windows as
> they are dragged about.
>
> You'll need to post your code. Maybe you set up the relationship in
> the wrong direction?
>
> Also, *please* do not autorespond to list postings. And it's
> beneficial to keep discussions on-list, for the benefit of the
> archives.
>
> --Kyle Sluder