【问题标题】:How to re-open a closed wxAuiManager pane in wxPHP?如何在 wxPHP 中重新打开关闭的 wxAuiManager 窗格?
【发布时间】:2016-04-01 12:19:23
【问题描述】:

我正在使用 wxPHP 对 wxAuiManager 进行试验,以了解如何在可停靠窗口中围绕中心固定元素排列窗格元素。 documentation is rather sparse here 所以我正在使用自动完成功能!

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

似乎默认关闭窗口会破坏它,但我相信这可以通过使用DestroyOnClose() 来防止。我正在做这样的初始化,在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 扩展。

【问题讨论】:

    标签: php wxwidgets wxphp


    【解决方案1】:

    我想通了——真的很容易。 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();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-25
      • 1970-01-01
      • 2013-12-28
      • 2020-03-19
      • 1970-01-01
      相关资源
      最近更新 更多