Autor Beitrag
thaflo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

Zeta, Mandrake 9.1,Windoof XP
DELPHI 5
BeitragVerfasst: Mo 07.06.04 10:41 
Hallo!

Ich hab mal eine frage:
ich generiere ein dynamisches submenu von einem pupmenü. wie kann ich prüfen, auf welches der untermenüs geklickt wurde?
Ich habe ein Auto-Popupmenu:
Untereinträge werden aus einer textdatei geladen (fiat, lancia, alfa...).
was muss ich machen um einen klick auf "fiat" abzufangen?

vielen dank,
florian

_________________
Jeder braucht die Zeit, die Zeit zum Lernen, man kommt nicht auf die Welt und sieht die Dinge wie sie sind....(onkelz)
MartinPb
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 698



BeitragVerfasst: Mo 07.06.04 11:31 
Was ich schon gemacht habe war z.B. jedem TAG in einem dynamisch generiertem Menü einen Integerwert zuzuweisen. Auf diese Weise kann man sehr leicht die Punkte unterscheiden. Man kann aber auch Captions prüfen. Obwohl das eher die letzte Möglichkeit sein sollte.

_________________
Gruß
Martin
thaflo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

Zeta, Mandrake 9.1,Windoof XP
DELPHI 5
BeitragVerfasst: Mo 07.06.04 11:40 
das habe ich schon, Tags erstellt.
aber es läuft nicht, ich bekommen mit folgenden code eine ShowMessage('0');, wenn ich mit der maus auf das popupmenu komme, deren untereinträge fiat, vw u.ä. sind.
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TMainForm.puEmailClick(Sender: TObject);
begin
     case (Sender as TMenuItem).Tag of
          0: Showmessage('0');
          1: Showmessage('1');
          2: Showmessage('2');
     end;
end;


gruesse,
florian

_________________
Jeder braucht die Zeit, die Zeit zum Lernen, man kommt nicht auf die Welt und sieht die Dinge wie sie sind....(onkelz)
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 07.06.04 11:43 
Hallo

wie sieht denn die Erstellung der items aus?

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
thaflo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

Zeta, Mandrake 9.1,Windoof XP
DELPHI 5
BeitragVerfasst: Mo 07.06.04 11:47 
so:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TMainForm.AddCars(const count:integer);
var item:TMenuItem;
    loop:integer;
begin
     for loop:=0 to count-1 do begin
         item := TMenuItem.Create(Self);
         item.Tag:=loop;
         item.Caption:= Copy(lbCars.Items[loop],0,Pos(',',lbCars.Items[loop])-1);
         puCars.Add(item); //popupmenu
     end;
end;


danke

_________________
Jeder braucht die Zeit, die Zeit zum Lernen, man kommt nicht auf die Welt und sieht die Dinge wie sie sind....(onkelz)
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 07.06.04 11:50 
da fehlt die zuweisung der ereignis behandlung.

ausblenden Delphi-Quelltext
1:
item.onclick:=puEmailClick;					


such auch mal im forum Suche in: Delphi-Forum, Delphi-Library BUTTON LAUFZEIT, ist das gleiche thema
Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
thaflo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

Zeta, Mandrake 9.1,Windoof XP
DELPHI 5
BeitragVerfasst: Mo 07.06.04 11:52 
dankeschön!

_________________
Jeder braucht die Zeit, die Zeit zum Lernen, man kommt nicht auf die Welt und sieht die Dinge wie sie sind....(onkelz)