如何设置PhosphorJS Widget的(初始)大小
问题描述:
如何设置PhosphorJS Widget的(初始)大小,特别是DockPanel内的小部件?如何设置PhosphorJS Widget的(初始)大小
您可以手动调整它们的大小,但我想以编程方式设置它们的大小。
答
一些小部件,如SplitPanel,有一个setSizes()
方法。
在问题联的示例中,面板CodeMirror能像这样被调整大小(其它板将需要更多的通过层次挖掘):
// First, find the parent widget:
stackedLayout = panel.layout
dockSplitPanel = stackedLayout._children[0]
// OR directly: panel.layout._children[0]
// Then set the relative sizes so the CodeMirror panel takes 60% of the width:
dockSplitPanel.setSizes([6,4])