<div dir="ltr">Hi Errol,<div><br></div><div>If the items are on the TActionMainMenuBar component then you can do the following:</div><div><br></div><div><div>type</div><div> TCustomActionMenuBarAccess = class(TCustomActionMenuBar);</div></div><div><br></div><div>In the Action Execute you can then do:</div><div><br></div><div><div> if TCustomActionMenuBarAccess(ActionMainMenuBar1).FSelectedItem <> nil then</div><div> ShowMessage('Selected Item: ' + TCustomActionMenuBarAccess(ActionMainMenuBar1).FSelectedItem.Caption);</div></div><div><br></div><div>where ActionMainMenuBar1 is the name of the TActionMainMenuBar component on the form.</div><div><br></div><div>If the items are created on a toolbar, then you can use the TAction(Sender).ActionComponent property as the TAction is the sender in these cases.</div><div><br></div><div>cheers,</div><div>Jeremy</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 21, 2017 at 7:47 AM, Errol Anderson <span dir="ltr"><<a href="mailto:errol.anderson@gsds.co.nz" target="_blank">errol.anderson@gsds.co.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-NZ" link="#0563C1" vlink="#954F72"><div class="m_9090443731928187400WordSection1"><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. <u></u><u></u></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):<u></u><u></u></p><p><span style="font-size:10.0pt;font-family:"Courier New"">sCaption := TActionClientItem(Sender).<wbr>Caption;<u></u><u></u></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.<u></u><u></u></p><p>I presume I am doing something wrong here, but cannot figure out what. Any help appreciated. <u></u><u></u></p><p class="MsoNormal">Regards<span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></p><span class="HOEnZb"><font color="#888888"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:red">Errol Anderson <u></u><u></u></span></p></font></span></div></div><br>______________________________<wbr>_________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" rel="noreferrer" target="_blank">http://delphi.org.nz/mailman/<wbr>listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.<wbr>net.nz</a> with Subject: unsubscribe<br></blockquote></div><br></div>