用于取消(浮动)客户端表单的 Delphi JvDockServer JvDockClient 通知
使用 Delphi 中的 JEDI VCL 库,我在主窗体上放置了一个 JvDockServer, 在另一个应该停靠到主窗体上的情况下,我有使用停靠样式 JvDockVIDVCStyle 的 JvDockClient。
虽然停靠效果很好,但我希望在客户端表单从停靠模式更改为非停靠(浮动)模式时收到通知。
Using the JEDI VCL library with Delphi, I put a JvDockServer on the main form,
and on another that should be docked to the main form, I have JvDockClient using dock style JvDockVIDVCStyle.
While Docking works great, I would like to be notified when a client form changes from docked to undocked (floating) mode.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新 JVCL 现已修改为包含此内置功能!当您停靠表单时,现在会触发 TForm 的内置事件。查看 JEDI JVCL 中的 DockingInCode 演示,该演示现在(截至 2012 年 3 月 27 日)包含触发对接和取消对接事件的示例。现在,在对接时会触发 TForm.OnEndDock,在取消对接时也会触发
TForm.OnUnDock
。对这些名称感到抱歉,这些区域已经在TForm
中,但我没有选择它们!出于历史原因的旧答案:
您希望在表单浮动时收到通知。 TForm 已经具有
OnUnDock
和OnEndDock
,但是(遗憾的是)当您使用 Jedi VCL Dock Manager 停靠和取消停靠时,它们不会被触发。我能想到的最好方法是修改 JVCL。
修改JvDockSupportControl.pas,方法TJvDockCustomControl.WndProc:
不幸的是,这是组件设计中的疏忽,如果您将其记录在Jedi Bug Tracker,并在此处发布链接。遗憾的是,JvDocking 的内部结构很复杂,但上面的技巧可能会让您从今天开始就可以继续使用。
编辑 JVCL 的替代方法是根据您喜欢使用的 Dock 样式创建您自己的样式,并向其中添加 OnDock 和 OnFloat 事件。例如,如果您使用的是 VID (Visual Interdev) 停靠样式,请将 JvDockVIDStyle.pas 复制到您自己的单元,并将其重命名为其他名称。
在代码中找到这个过程:
将现有代码保留在该函数中,并在底部添加以下内容:
我认为我应该编写上述内容的更好版本并将其放入 JVCL JvDocking 中,因为它是一个直观的东西。此外,也许应该使 OnEndDock 发挥作用。 OnStartDock 与 JvDocking 不兼容,因此我无法添加它。
Update The JVCL is now modified to contain this feature built in! The TForm's built in events is now fired when you dock a form. Check out the DockingInCode demo in the JEDI JVCL, which now (as of March 27 2012) contains samples of Docking and Undocking events firing. TForm.OnEndDock is now fired when docking, as is
TForm.OnUnDock
on undocking. Sorry about the names, those area already inTForm
and I didn't choose them!OLD ANSWER for historical reasons:
You would like a notification when a form has been made to float. TForm already has
OnUnDock
andOnEndDock
, but these are (sadly) not fired when you dock and undock using the Jedi VCL Dock Manager.The best method I can think of to do this is to modify the JVCL.
Modify JvDockSupportControl.pas, method TJvDockCustomControl.WndProc:
Unfortunately this is an oversight in the design of the components, and if you log it in the Jedi Bug Tracker, and post the link to it here. JvDocking internals are complex, sadly, but the above hack might get you going as of today.
Alternative to editing JVCL is to make your own Style, based on the Dock Style that you prefer to use, and add OnDock and OnFloat events to it. For example, if you are using the VID (Visual Interdev) dock style, copy JvDockVIDStyle.pas to your own unit, and rename it to something else.
Find this procedure in the code:
leave the existing code in that function and add the following at the bottom:
I think that I should write a better version of the above and put it into the JVCL JvDocking, since it's an intuitive thing. In addition OnEndDock should probably be made to function. OnStartDock is incompatible with JvDocking, so I can't add that.