Hi,
I couldn't get it to work using the binding.
There may be a better way of doing it, but I got it working by setting to kBindNone and moving the button on panel resize events:
Firstly, make sure you have a custom class for your panel's control view.
Mark it up in the fr file for the panel's widget boss class with:
IID_ICONTROLVIEW, kMyPanelViewImpl,
Add to the ID definitions, factory list etc and set up a MyPanelView class (or whatever you want to call it...), derived from PanelView, for this implementation
Then in your MyPanelView class, setup the Resize function as below:
void MyPanelView::Resize(const PMPoint& dimensions, bool16 invalidate)
{
PanelView::Resize(dimensions, invalidate);
InterfacePtr<IPanelControlData> panelData(Utils<IPalettePanelUtils>()->QueryPanelByWidgetID(kMyPanelWidgetID));
if(panelData == nil) return;
IControlView *myWidget = panelData->FindWidget(kMyButtonWidgetID);
if (myWidget == nil) return;
PMRect theFrame = myWidget->GetFrame();
PMReal left = (dimensions.X() - theFrame.Width()) / 2;
PMReal right = left + theFrame.Width();
theFrame.Left(left);
theFrame.Right(right);
myWidget->SetFrame(theFrame, kTrue);
}
You will need these includes:
#include "Utils.h"
#include "IPalettePanelUtils.h"
Hope that helps