1

我正在使用 wxPHP 对 wxAuiManager 进行试验,以了解如何在可停靠窗口中围绕中心固定元素排列窗格元素。这里的文档相当稀少,所以我感觉自己在使用自动完成!

默认情况下,我的窗格元素有一个关闭图标,单击它会成功关闭窗格,但我现在对恢复关闭的窗格感兴趣。这似乎并不像人们想象的那么微不足道。

似乎默认关闭窗口会破坏它,但我相信这可以通过使用DestroyOnClose(). 我正在做这样的初始化,在 a 的上下文中wxFrame

$this->manager = new wxAuiManager($this, wxAUI_MGR_DEFAULT);

$textCtrl = new wxTextCtrl($this, -1, "Pane");
$paneInfo = new wxAuiPaneInfo();
$info->Top(); // Dock in the top direction
$info->PinButton(); // Give the pane a pin (or "undock") icon
$info->DestroyOnClose(false);
$info->Name('auiPane'); // Make this item individually addressable

$this->manager->AddPane($textCtrl, $paneInfo);

关闭窗格后,要恢复我正在执行此操作,在相同的wxFrame上下文中:

$info = $this->manager->GetPane('auiPane');
echo "Is shown: " . ($info->IsShown() ? 'yes' : 'no') . "\n";

// These two are probably unnecessary - grasping at straws here!
$info->Top();
$info->TopDockable();

// Show the pane again
$info->Show();

文本输出在关闭后最初指示“否”,然后再次运行此代码会产生“是”。因此,Show()似乎确实有效果,但它并没有重新回到 wxAuiManager 排列中——我完全看不出框架内容有什么不同。

我错过了什么?我在 Ubuntu 14.04 上运行 PHP 5.5.9,wxwidgets扩展名是自定义编译的。

4

1 回答 1

0

我想通了——真的很容易。该wxAuiPaneInfo方法Show()是正确的,但在此之后,经理需要Update()强制它立即重绘:

// Show all available panes
for($i = 0; $i <= 7; $i++)
{
    $info = $this->manager->GetPane('auiPane' . $i);
    $info->Show();
}

// Redraw the managed window
$this->manager->Update();
于 2015-12-27T12:54:35.683 回答