<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-NZ" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">No worries. I didn’t actually try it, just a thought…<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">“</span><span style="font-size:10.5pt;font-family:"Verdana",sans-serif;color:black">If an action band contains a TCustomizeBandAction standard action, the user of the application can change this property. Because the
caption can be changed at runtime, the default caption that will be used, should be set in the action itself and not in the
</span><a href="http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/ActnMan_TActionClientItem.html"><span style="font-size:10.5pt;font-family:"Verdana",sans-serif">TActionClientItem</span></a><span style="font-size:10.5pt;font-family:"Verdana",sans-serif;color:black">
object.”<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="mso-fareast-language:EN-NZ">From:</span></b><span lang="EN-US" style="mso-fareast-language:EN-NZ"> delphi-bounces@listserver.123.net.nz [mailto:delphi-bounces@listserver.123.net.nz]
<b>On Behalf Of </b>Errol Anderson<br>
<b>Sent:</b> Thursday, 21 December 2017 2:01 pm<br>
<b>To:</b> 'NZ Borland Developers Group - Delphi List' <delphi@listserver.123.net.nz><br>
<b>Subject:</b> Re: [DUG] How to find parameters of an Action Menu created at runtime<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Hi David<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks for your suggestion. Unfortunately it raises the following error:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-NZ"><img border="0" width="541" height="39" style="width:5.6354in;height:.4062in" id="Picture_x0020_1" src="cid:image001.png@01D37A7E.7858CD70"></span><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">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.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Best regards<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Errol<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"></a><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="mso-fareast-language:EN-NZ">From:</span></b><span lang="EN-US" style="mso-fareast-language:EN-NZ"> David O'Brien [<a href="mailto:Dave@iccs.co.nz">mailto:Dave@iccs.co.nz</a>]
<br>
<b>Sent:</b> Thursday, 21 December 2017 9:58 AM<br>
<b>To:</b> NZ Borland Developers Group - Delphi List <<a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a>><br>
<b>Subject:</b> Re: [DUG] How to find parameters of an Action Menu created at runtime<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">The Sender will be the menu item. Try TAction(</span><span style="font-size:10.0pt;font-family:"Courier New"">TActionClientItem</span>
<span lang="EN-US">(Sender).Action).Caption.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="mso-fareast-language:EN-NZ">From:</span></b><span lang="EN-US" style="mso-fareast-language:EN-NZ">
<a href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a> [<a href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>]
<b>On Behalf Of </b>Errol Anderson<br>
<b>Sent:</b> Thursday, 21 December 2017 9:47 am<br>
<b>To:</b> <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
<b>Subject:</b> [DUG] How to find parameters of an Action Menu created at runtime<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p>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.
<o:p></o:p></p>
<p>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):<o:p></o:p></p>
<p><span style="font-size:10.0pt;font-family:"Courier New"">sCaption := TActionClientItem(Sender).Caption;<o:p></o:p></span></p>
<p>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.<o:p></o:p></p>
<p>I presume I am doing something wrong here, but cannot figure out what. Any help appreciated.
<o:p></o:p></p>
<p class="MsoNormal">Regards<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:red;mso-fareast-language:EN-NZ">Errol Anderson
<o:p></o:p></span></p>
</div>
</body>
</html>