DockManager LoadFromStream 不工作

发布于 2024-09-30 18:55:33 字数 690 浏览 4 评论 0原文

我正在创建 5 个表单,并在运行时将它们停靠到一个名为 DockTarget 的面板,使用类似

procedure TManager.InitChild;
begin
    Child := TChildWindow.Create(Self);
    Child.ManualDock(DockTarget);
end;

在创建所有五个子项并停靠后我正在调用的内容

Settings.DockSettings.Seek(0,soBeginning);
DockTarget.DockManager.LoadFromStream(Settings.DockSettings);

,但它似乎没有执行任何操作,所有子项都停靠,无论发生什么我在关闭表单之前对布局进行的处理与打开的表单完全相同,就好像 LoadFromStream 不存在一样。

Settings.DockSettings 是之前创建设置时从文件加载的 TMemoryStream。

和 onFormClose 我知道

DockTarget.DockManager.SaveToStream(Settings.DockSettings);
Settings.Save;

为什么布局没有被恢复吗?或者我可以使用另一种方法来保存/加载停靠布局?

I'm creating 5 forms and docking them to a panel called DockTarget during run time using something like

procedure TManager.InitChild;
begin
    Child := TChildWindow.Create(Self);
    Child.ManualDock(DockTarget);
end;

after all five children are created and docked I'm calling

Settings.DockSettings.Seek(0,soBeginning);
DockTarget.DockManager.LoadFromStream(Settings.DockSettings);

but it doesn't seem to do anything, all children are dock and no matter what I do to the layout before closing the form it opens exactly the same as if LoadFromStream wasn't there.

Settings.DockSettings is a TMemoryStream Loaded from file when the settings are created earlier.

and onFormClose I have

DockTarget.DockManager.SaveToStream(Settings.DockSettings);
Settings.Save;

Any idea's why the layout isn't being restored? Or an alternative I could use for saving/loading a docked layout?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乖乖哒 2024-10-07 18:55:33

只需在保存之前清除内存流,否则我最终会得到 2 组 Docking 数据,其中仅加载了第一个数据。

Simply need to clear the in memory stream before saving, otherwise I ended up with 2 sets of Docking data of which only the first one was loaded.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文