Hi, I think you can typecast the sender variable to a tmenuitem then access the properties and methods (or whatever you want from there) ie..
procedure TForm1.MiMenuItemClick(Sender: TObject); begin // Your codes will go here Showmessage(TMenuItem(Sender).Caption); // shows the caption of the menuitem clicked end; Chris Albert, Innovative Technologies. -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of soonhuat ong Sent: Monday, July 18, 2005 1:12 PM To: [email protected] Subject: RE: [delphi-en] PopupMenu Events How am i going to identified which MenuItem that i click at then ?? Let's say in your example: MyPopUpItems[i].OnClick := MiMenuItemClick; How am i goin to get the value [i] cos there's 4 items in the Popupmenu . Vahan Yoghoudjian <[EMAIL PROTECTED]> wrote: You should write a procedure on what you want to do and assign it to the OnClick event of that menu item For example in your case MyPopUpItems[i].OnClick := MiMenuItemClick; procedure TForm1.MiMenuItemClick(Sender: TObject); begin // Your codes will go here end; -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] Behalf Of soonhuat ong Sent: Monday, July 18, 2005 11:13 AM To: [email protected] Subject: [delphi-en] PopupMenu Events procedure TForm1.BtnCreateMenuClick(Sender: TObject); var i: Integer; MyPopUpItems: array[0..3] of TMenuItem; MyPopUpItems: array[0..3] of TMenuItem; MyPopUpMenu : TMyPopUpMenu; begin for i := 0 to 3 do begin MyPopUpItems[i] := TMenuItem.Create(Self); MyPopUpItems[i].Caption := 'New item ' + IntToStr(i); MyPopUpMenu.Items.Add(MyPopUpItems[i]); end; MyPopUpMenu.Popup; end; The code above will create 3 menuitems into myPopUpMenu and display the menu item. Now how am i goin to write the events/action when the users click on either one of the menu item ? I know this can be done easily by using the TPopupMenu component, but for certain reason i need to code it manually. Any idea? Thanks in advance. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com [Non-text portions of this message have been removed] ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] ---------------------------------------------------------------------------- ---- YAHOO! GROUPS LINKS a.. Visit your group "delphi-en" on the web. b.. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. ---------------------------------------------------------------------------- ---- [Non-text portions of this message have been removed] ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] --------------------------------- YAHOO! GROUPS LINKS Visit your group "delphi-en" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --------------------------------- __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com [Non-text portions of this message have been removed] ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

