Главная страница
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.036 c
14-1095429384
Sekr
2004-09-17 17:56
2004.10.10
Как устанавливать компоненты под Delphi7


1-1096146359
VAmpiro$
2004-09-26 01:05
2004.10.10
n:= sin(x) - програмно узнать значение x


1-1096271082
malamba
2004-09-27 11:44
2004.10.10
Номер контрола на форме


14-1095630126
123
2004-09-20 01:42
2004.10.10
Автомобили.


1-1096274244
DelphiLexx
2004-09-27 12:37
2004.10.10
Форма поверх всех окон