开发者

How can I create a context menu for a Delphi component?

开发者 https://www.devze.com 2022-12-23 08:17 出处:网络
I want to create a context menu for Delphi components l开发者_如何学JAVAike TDBGrid, TTreeView or similar. How can I do that?Place a TPopupMenu onto your form and design your menu with it. Then select

I want to create a context menu for Delphi components l开发者_如何学JAVAike TDBGrid, TTreeView or similar. How can I do that?


Place a TPopupMenu onto your form and design your menu with it. Then select the component the popupmenu is meant for (DbGrid, TreeView, ...) and set it's PopupMenu property to the PopupMenu you just designed.

You can have different PopupMenus for different components.


After placing a TPopupmenu control and linking it to the desired control, if you want to change the available items in the popup menu according to the selected cell or node in a treeview use the OnContextPopup event of the control, that gives you a chance to alter the default behaivor of the Popupmenu

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号