Search code examples
cappuccinoobjective-j

How to center a CPWindow in Cappuccino


I'm interested in having a CPWindow (specifically a CPPanel) be centered and auto-sized much like you might do the same for a CPView as follows:

[view setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];   
[view setCenter:[contentView center]];

However CPWindows seem to not have these same methods.

And while we're at it, how do you prevent a CPPanel from being dragged around? Is such a thing even possible?

Thanks.


Solution

  • CPWindow (and CPPanel) have a center method.

    [aWindow center];