确定父组件
我们在工具栏上有 TToolbarButton,每个按钮都有自己关联的 TPopupMenu。 弹出菜单都是相同的,因此我们希望所有工具栏按钮只有一个菜单。 我遇到的问题是确定哪个 ToolbarButton 调用了弹出菜单。
我已尝试以下操作,但不断出现访问冲突。
...
with (Sender as TPopupMenu) do
ShowMessage((GetParentComponent as TPopupMenu).Name);
...
有什么想法如何获取弹出菜单的父级吗?
谢谢,彼得。
We have TToolbarButton(s) on a toolbar, each with it's own associated TPopupMenu. The popup menus are all the same so we would like to have only one menus for all the toolbar buttons. The problem I have is determining which ToolbarButton invoked the popup menu.
I've tried the following, but I keep getting an access violation.
...
with (Sender as TPopupMenu) do
ShowMessage((GetParentComponent as TPopupMenu).Name);
...
Any ideas how to get the parent of the popup menu?
Thanks, Pieter.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
一下应该会给你按下的 TToolButton 。
Try
That should give you the TToolButton that was pressed.