Главная страница
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.022 c
14-1094669161
olookin
2004-09-08 22:46
2004.10.10
We are living in Amerika - Rammstein


1-1095768418
hawkins
2004-09-21 16:06
2004.10.10
Ошибка в пр-ме: ...File access denied...


14-1095850099
dr Tr0jan
2004-09-22 14:48
2004.10.10
Террористы не дремлют, млин


4-1094060806
Belaev Andrey
2004-09-01 21:46
2004.10.10
Запрет на удаление процесса по средвам ACL


1-1095775511
misha123
2004-09-21 18:05
2004.10.10
ООП тип?