[DUG] How to find parameters of an Action Menu created at runtime

Errol Anderson errol.anderson at gsds.co.nz
Thu Dec 21 14:01:05 NZDT 2017

Hi David


Thanks for your suggestion.  Unfortunately it raises the following error:


Because there may be multiple items with the same action but different
captions, I figured I had to pick the item caption, not the action caption.


I have tried creating one or multiple items at designtime as a test, but I
get the same results every time - namely TActionClientItem(Sender).Caption
returns a null string, and TAction(TActionClientItem(Sender).Action).Caption
fails.  It appears that TActionClientItem does not act like TMenuItem which
is very disappointing.


Best regards




From: David O'Brien [mailto:Dave at iccs.co.nz] 
Sent: Thursday, 21 December 2017 9:58 AM
To: NZ Borland Developers Group - Delphi List <delphi at listserver.123.net.nz>
Subject: Re: [DUG] How to find parameters of an Action Menu created at


The Sender will be the menu item. Try   TAction(TActionClientItem


From: delphi-bounces at listserver.123.net.nz
<mailto:delphi-bounces at listserver.123.net.nz>
[mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Errol Anderson
Sent: Thursday, 21 December 2017 9:47 am
To: delphi at listserver.123.net.nz <mailto:delphi at listserver.123.net.nz> 
Subject: [DUG] How to find parameters of an Action Menu created at runtime


My program creates Action Menu items at runtime, with the caption of each
item set to a value returned by a database query. The OnExecute procedure is
the same for all items. 

When I click on an item, I need to obtain the item caption for the OnExecute
procedure, to use in another query. I have tried the following (analogous to
TMenuItem for a popup menu):

sCaption := TActionClientItem(Sender).Caption;

However, this always returns an empty string. I have searched the web and
the Delphi Help to no avail. I am aware that Caption is a published
property, but the public property Index also fails.

I presume I am doing something wrong here, but cannot figure out what. Any
help appreciated. 



Errol Anderson 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20171221/4435c056/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 2339 bytes
Desc: not available
Url : http://listserver.123.net.nz/pipermail/delphi/attachments/20171221/4435c056/attachment.png 

More information about the Delphi mailing list