开发者

SWT: Problem with sashform children's width

My application's got one horizontal SashForm with two children. The leftmost one should always be, at least, 200 pixels width. So I added a ControlListener to the left component. In its controlResized event I ch开发者_JAVA技巧eck the component's width. When it's smaller than 200, I set its bounds' width to 200. It apparently works as the component gets resized to that width, but the sashform stops working - the sash is no longer visible, it remains under the component.

Does anybody know what am I missing?

I've tried:

component.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
if (component.getBounds().width < 200) {
Rectangle bounds = component.getBounds();
bounds.width = 200;
component.setBounds(bounds);
}
}
});


here is an example


Just a guess, but maybe you need to call pack() or layout() on the SashForm after you programatically resize the inner component.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜