Autor Beitrag
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 14.06.07 12:52 
Ich hab in einem Ordner Dateien. diese Dateien sollen einer nach der anderen Ausgelesen werden und für jede datei soll ein menüpunkt in einem Submenü vom Popupmenü erstellt werden. Wenn man dann auf den Menüpunkt draufklickt soll sich die dazugehörige datei öffnen.

wie mann die datei ausliest weiß ich nur ich hab keinen Plan wie ich den rest machen soll. könnt ihr mir helfen?

lg elundril
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: Do 14.06.07 12:58 
Hier ein Beispiel aus meinem Programm

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure Tf_gam.PopupMenu1Popup(Sender: TObject);
var
  NewItem : TMenuItem ;
begin
   f_start.myq_buchungskreis.close;
   f_start.myq_buchungskreis.paramcheck := true;
   f_start.myq_buchungskreis.params[0].value := 2;
   f_start.myq_buchungskreis.open;
   f_start.myq_buchungskreis.first;
    while not f_start.myq_buchungskreis.Eof do
           begin
             NewItem := TMenuItem.create(self);
             NewItem.Caption := f_start.myq_buchungskreis.FieldValues['bkpraefix'] +   f_start.myq_buchungskreis.FieldValues['bksuffix'];
             NewItem.OnClick := DynMenuClick;
             PopupMenu1.Items.Add(NewItem);
             f_start.myq_buchungskreis.next;
           end;
    f_start.myq_buchungskreis.close;
end;


Hier werden die Daten aus einer Tabelle geholt, mußt Dir das also anpassen.

Gruß

Aga

//edit mir ist gerade eingefallen, daß das ja nur die halbe Miete ist. Hier also auch noch Dynmenuklick

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure Tf_gam.DynMenuClick(Sender: TObject);
var  DynBeleg : TMenuItem;

begin
   DynBeleg := Sender as TMenuItem;
   MatchCode := DynBeleg.Caption; //Matchcode ist bei mir eine globale Variable
   f_beleg.show;
   PopupMenu1.items.clear; 
end;
elundril Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Fr 15.06.07 11:34 
ok vielen dank! falls ich noch fragen hab meld ich mich!

lg elundril
elundril Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Sa 23.06.07 15:17 
Ok soweit hab ichs jetzt. nur wie bring ich die MenüItemes in das Untermenü??

lg elundril
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Sa 23.06.07 15:37 
du musst das neue Item einem anderen per insert oder add unterordnen.

ausblenden Delphi-Quelltext
1:
MI_top.Add(MI_Sub);					


HTH Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
elundril Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Sa 23.06.07 17:45 
kannst du mir sagen wie der ganze code zum folgenden bild aussehen müsste?

lg elundril

Moderiert von user profile iconNarses: BMP in GIF gewandelt
Einloggen, um Attachments anzusehen!
_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Sa 23.06.07 18:23 
Hallo,

der ganze Code nicht, aber so in etwa:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var
  NewItem : TMenuItem ;
begin
  NewItem := TMenuItem.create(self);
  NewItem.Caption := 'Ich bin neu hier';
  PopupMenu1.Items[2].Add(NewItem);

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
elundril Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: So 24.06.07 13:58 
Ok passt danke!

lg elundril
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: So 24.06.07 16:48 
Hi

Du mußt auch vor der Schleife nochmal ein items.clear machen.
Hatte das ursprünglich drin, als ich Dir gepostet habe, hab ih geacht, wär doppelt und hatte e entfernt, aber beide items.clear dienen einem Zweck.
Das items.clear in DynMenuClick verhindert ein Flacker des Bildchirms für das andere Item.Cear. Dieses ItemClear vehidert wiederum, daß wenn Jemand zwar das Popup aufruft, aber nichts auswählt, daß dopeelte Menueinträge entstehen.

Gruß

Aga
elundril Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mo 25.06.07 14:19 
ok! danke!

lg elundril