使用 Pharo 1.4 夏季进行测试。我认为最好使用屏幕截图来解释它,代码如下。
这是我的初始状态(我现在用我的代码得到什么):
我希望组框变形在打开时水平填充,如下所示:
调整大小后,我希望组框变形保持边界,即:
这是我尝试过的代码:
| s morph1 morph2 row groupBox scroller |
s := ScrollPane new.
morph1 := BorderedMorph new.
morph2 := BorderedMorph new.
row := UITheme builder newRow: {morph1 . morph2}.
groupBox := UITheme builder newGroupbox: 'Group Box Test' for: row.
groupBox
layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 0.8));
vResizing: #spaceFill;
hResizing: #spaceFill;
layoutChanged.
scroller := s scroller.
scroller
addMorph: (groupBox position: 0@0)
fullFrame: (0 @ 0 corner: 0.8@0.5).
s scroller color: Color white.
s
extent: 250@150;
openCenteredInWorld
容器必须是 ScrollPane。
我已将 Bert 的代码调整为不使用 Polymorph UIBuilder,从而导致:
morph1 := Morph new.
morph2 := Morph new.
row := ScrollPane new.
row
color: Color white; borderColor: Color gray; borderWidth: 1;
layoutPolicy: ProportionalLayout new.
row scroller
addMorph: morph1 fullFrame: (LayoutFrame fractions: (0@0 corner: 1@0) offsets: (5@5 corner: -60@45));
addMorph: morph2 fullFrame: (LayoutFrame fractions: (1@0 corner: 1@0) offsets: (-50@5 corner: -5@45)).
row
extent: 250@150;
openInHand
但也不起作用,因为内部蓝色变形重叠并且没有填充指定的帧。我尝试了许多使用框架的组合,但到目前为止没有任何效果。你知道我错过了什么吗?