Autor Beitrag
Hux
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 171



BeitragVerfasst: Mo 14.11.05 15:17 
Hi Leutz...,

Ich hab mal so ne Frage an euch:...
Kann ich in nem PopUpMenu während des Programmablaufs ein paar Einträge einfügen?
wenn ja, kann mia eina sagen wie des geht?

Grüsse...
Ich
chrisw
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 439
Erhaltene Danke: 3

W2K
D7
BeitragVerfasst: Mo 14.11.05 15:23 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var MenuItem : TMenuItem;
begin
  MenuItem := TMenuItem.Create(self);
  MenuItem.Caption := 'Hallo';
  PopUpMenu1.Items.Add(MenuItem);
end;

_________________
Man sollte keine Dummheit zweimal begehen, die Auswahl ist schließlich groß genug.
Hux Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 171



BeitragVerfasst: Mo 14.11.05 17:03 
DAnke, aber wie kann ich ihm eine Funktion geben?
OnClick???

danke für die Hilfe
Wollaston
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Mo 14.11.05 18:20 
Hallo Hux,

füge einfach im Quelltext von ChrisW folgendes ein:
ausblenden Delphi-Quelltext
1:
MenuItem.OnClick := MeinOnClick;					


MeinOnClick muss dann eine Prozedur sein die Du geschrieben hast:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure MeinOnClick(Sender: TObject);

...

procedure TForm1.MeinOnClick(Sende: TObject);
begin
  beep;
end;
Hux Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 171



BeitragVerfasst: Mi 16.11.05 17:36 
Hi Wollaston...,

Danke, für deine Hilfe... des is mir irgendwie nicht eingefallen... danke...

Greetz...,
der hux