detachableWindowForPopover

I’ve been struggling to get a popover to detach to a window. Any tips?

Thanks so much!!!



script AppDelegate
	property parent : class "NSObject"
	
	-- IBOutlets
	property theWindow : missing value
    property popOver : missing value
    property popoverTriggerButton : missing value
    property popoverWindow : missing value
    
	on applicationWillFinishLaunching_(aNotification)
		-- Insert code here to initialize your application before any files are opened
        popOver's popoverShouldDetach:true
        popOver's detachableWindowForPopover:popoverWindow
	end applicationWillFinishLaunching_
	
    on togglePopover:sender
        if sender's state() is 1 then
            popOver's showRelativeToRect:(sender's |bounds|()) ofView:sender preferredEdge:(current application's NSMinYEdge)
        else
            popOver's performClose:sender
        end if
    end togglePopover:

	on applicationShouldTerminate_(sender)
		-- Insert code here to do any housekeeping before your application quits 
		return current application's NSTerminateNow
	end applicationShouldTerminate_
	
end script


By the look of things you need to declare a delegate of your popover, and in that have a -detachableWindowForPopover: method. When this is called, it should return a window, and the popover will then animate to appear as though it morphs into the window. IOW, there’s a fair amount of work involved.

Thanks for the reply!!! Earlier today, after a lot of trial & error, I finally got it to work and it looks so simple . I guess I didn’t quite grasp how the delegate method worked.

I had to connect the app delegate to be the delegate for the popover, and set a function for the popoverShouldDetatch method, returning true. Then just call the function in the finished launching function.

I need to brush up on your teachings.

Thanks again!!!