Board index » delphi » Popup Menu

Popup Menu

I use a popup menu for 3 edit box,
this popup menu has 2 items : new and edit.

Three edit boxes :
Name
Suburb
State

When the user right click one of the boxes and select new, another form will
be shown with labels according to the edit boxes on which right clicked.

How do I know which edit box the user clicked to determine the labels of the
form being shown.

That is :
If user right click the Name edit box, and select the new, a label on the
form will show "Enter the name".
If user right click the Suburb edit box, and select the new, a label on the
form will show "Enter the State"
If user right click the State edit box, and select the new, a label on the
form will show "Enter the Suburb"

 

Re:Popup Menu


Quote
In article <3a9c9881_1@dnews>, Alan wrote:
> I use a popup menu for 3 edit box,
> this popup menu has 2 items : new and edit.
> How do I know which edit box the user clicked to determine the labels of the
> form being shown.

Look at the PopupComponent property of the popup menu.
Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.

Re:Popup Menu


I have another question:

After the selection of one of the menu items, an action has to be done. A
value or variable is to be passed back to the calling controls (one of the
edit box).
eg. a value 10.
How do I display the value 10 into the calling edit box ?

"Peter Below (TeamB)" <100113.1...@compuXXserve.com> wrote in message
news:VA.00006a91.008901ee@antispam.compuserve.com...

Quote
> In article <3a9c9881_1@dnews>, Alan wrote:
> > I use a popup menu for 3 edit box,
> > this popup menu has 2 items : new and edit.
> > How do I know which edit box the user clicked to determine the labels of
the
> > form being shown.

> Look at the PopupComponent property of the popup menu.

> Peter Below (TeamB)  100113.1...@compuserve.com)
> No e-mail responses, please, unless explicitly requested!
> Note: I'm unable to visit the newsgroups every day at the moment,
> so be patient if you don't get a reply immediately.

Re:Popup Menu


Quote
In article <3aa2e8cd_2@dnews>, Alan wrote:
> After the selection of one of the menu items, an action has to be done. A
> value or variable is to be passed back to the calling controls (one of the
> edit box).
> eg. a value 10.
> How do I display the value 10 into the calling edit box ?

In a handler for a menuitems OnClick event the Sender parameter refers to the
menuitem. From that you can find the popup menu the item belongs to using the
GetParentMenu method. But usually you know which popup the menuitem belongs
to, unless you share event handlers between items in several submenus. Lets
assume you know the menu item belongs to Popupmenu1, then the code would look
like this:

   If popupmenu1.PopupComponent Is TEdit Then
     Tedit(popupmenu1.PopupComponent).Text := '10';

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.

Other Threads