Главная страница
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.032 c
14-1095509530
Тупой:)
2004-09-18 16:12
2004.10.10
Где скачать FAQ по Delphi ???


3-1095243691
Viper
2004-09-15 14:21
2004.10.10
Результат TQuery и TCombobox


3-1094733398
Zlod3y
2004-09-09 16:36
2004.10.10
ADO и BDE ---> dbExpress


1-1096112153
debuger
2004-09-25 15:35
2004.10.10
закрытся на TForm.Close


8-1090167181
Wistful
2004-07-18 20:13
2004.10.10
WaveOutWrite???