PDA

View Full Version : Titlebar won't display children


EndlessLine
03-18-2009, 10:31 PM
I've extended the Panel class to allow for buttons in the top of the panel, like in os x , windows etc. When I add the buttons directly to the titleBar in the panel they show up (although poorly laid out) so I decided why not put all 3 of them in an HBox for convenience. Flex said hells no and didn't display anything. What gives?

Here is my titlebar class


package com.neph.view.UI
{
import mx.containers.HBox;
import mx.controls.Button;
import mx.core.UIComponent;

public class SuperTitleBar extends UIComponent
{
private var _closeBtn:Button;
private var _restoreBtn:Button;

public function SuperTitleBar()
{
super();
initButtons();
}
private function initButtons():void
{
_closeBtn = new Button;
_restoreBtn = new Button;
_closeBtn.width = _restoreBtn.width = 16;
_closeBtn.height = _restoreBtn.height = 16;
_closeBtn.styleName = "closeBtn";
_restoreBtn.styleName = "restoreBtn";
_closeBtn.buttonMode = _restoreBtn.buttonMode = true;
_closeBtn.useHandCursor = _restoreBtn.useHandCursor = true;
var hBox:HBox = new HBox;
hBox.percentWidth = 100;
hBox.percentHeight = 100;
hBox.addChild(_restoreBtn);
hBox.addChild(_closeBtn);
this.addChild(hBox);
}
}
}

mastermind81
03-20-2009, 12:27 PM
you have to increase you panel title bar height.