DockManager LoadFromStream 不工作
我正在创建 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需在保存之前清除内存流,否则我最终会得到 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.