Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.10.10;
Скачать: CL | DM;

Вниз

Подскажите плз, есть динамически формируемые TMenuItem   Найти похожие ветки 

 
Mar gel   (2004-09-28 09:33) [0]

Как можно узнать, на какой Item кликнул пользователь? Код ниже:
for i:=1 to 20 do
begin
MyPopUpItem := TMenuItem.Create(Self);
MyPopUpItem.Caption:="Item"+IntToStr(i);
MypopUpItem.OnClick := N5Click;
end;



procedure Tmf.N5Click(Sender: TObject);
begin
 Showmessage(N5.Items.Caption); //ес-но не работает :(
end;


 
Cobalt ©   (2004-09-28 09:36) [1]

а что такое N5?
P.S. Конечно не работает. Оно, наверняка, даже не компилируется?
Items property (TMenu)
Because Items is the default property of TMenuItem, the Items property of TMenu can be treated as an indexed array of menu items that describe the individual items in the menu. That is, instead of writing
FirstItem := Menu1.Items.Items[0];
you can use
FirstItem := Menu1.Items[0];

P.P.S.
Вообще-то, рекомендуется использовать свойство Tag


 
VMcL ©   (2004-09-28 09:54) [2]

>>Mar gel  (28.09.04 09:33)

if Sender is TMenuItem then
 ShowMessage(TMenuItem(Sender).Caption);


 
Mar gel   (2004-09-28 10:08) [3]

Спасибо!!!
Showmessage(TMenuItem(Sender).Caption+"  "+IntToStr(TMenuItem(Sender).Tag));



Страницы: 1 вся ветка

Текущий архив: 2004.10.10;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.053 c
14-1095948626
Nikolay M.
2004-09-23 18:10
2004.10.10
Масяня вернулась!


1-1095660056
П7
2004-09-20 10:00
2004.10.10
TTreeNode.Data - как правильно использовать?


6-1091401082
VVL
2004-08-02 02:58
2004.10.10
Ссылки


14-1095859186
kaZaNoVa
2004-09-22 17:19
2004.10.10
Скорость доступа к диску, или как ускорить HARD


14-1096002016
080D:07BBh
2004-09-24 09:00
2004.10.10
Caliber RM