Reputation: 1390
I need to change the text of a TMenuItem
in Delphi 7, when the popup menu is already popped up.
My popup menu has
OwnerDraw := true;
I'd like to use:
popupmenu.repaint();
or
popupmenu.refresh();
but they do not exist. How can I do it?
Upvotes: 0
Views: 1397
Reputation: 612914
You can call MenuChanged
on the menu item to force it to be updated. This is a protected member to you need to gain access to that member by the well-known protected member hack.
type
THackedMenuItem = class(TMenuItem);
....
THackedMenuItem(MyMenuItem).MenuChanged(True);//forces redraw of owner drawn item
Upvotes: 1