Autor Beitrag
D. Annies
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Mi 10.11.10 20:10 
Hi, Delpher,

ich prüfe in einer Routine, ob Excel, Word oder OpenOffice auf der Platte vorhanden ist.
Wenn diese Prüfung negativ ist, wird bei den zugehörigen PopupItems-Enabled auf false gesetzt.
Klappt alles bestens, was mir aber Probleme bereitet, ist, den Button in dem folgenden Code,
wenn z.B OpenOffice nicht vorhanden ist, dann auch für diesen Button-enabled gleich auf false zu setzen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TBuchMain.starte_TabellenkalkPrg(sender:Tobject);
var LoadParams : variant;
           erg : integer;
begin
  excel_gewuenscht := false; opoffck_gewuenscht := false;
  erg := xMessageDlg(fname+#13+
                      ' mit Excel ansehen oder mit OpenOfficeCalc? ',
                        mtConfirmation, [mbYes, mbNo, mbcancel], ['Excel''OpOffCalc''Abbrechen'], self.font);
  case erg of
    mryes    : excel_gewuenscht := true;
    mrno     : opoffck_gewuenscht := true;
    mrcancel : EXIT;
  end;

  // usw.


Danke für Ideen, sagt
Detlef

kleiner Nachtrag, Code von function xmessagedlg
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
function TBuchMain.xMessageDlg(const Msg: string; DlgType : TMsgDlgType;
            Buttons : TMsgDlgButtons; Captions: array of string; myFont:TFont) : Integer;
var aMsgDlg         : TForm;
    CaptionIndex, i : integer;
    dlgButton       : TButton;  // uses stdctrls
begin
  aMsgDlg := CreateMessageDialog(Msg, DlgType, buttons);
  aMsgDlg.Font.style := [];   //myFont, zB. [fsitalic] ;
  aMsgDlg.setbounds(300,520,650,200);
  //aMsgDlg.setbounds(groupbox16.Left,560,screen.Width-groupbox16.Left,200);
  CaptionIndex := 0;
  for i := 0 to aMsgDlg.ComponentCount - 1 do  // alle Objekte des Dialoges testen
  begin
    if (aMsgDlg.Components[i] is TButton) then  // wenn es ein Button ist, dann...
    begin
      dlgButton := TButton(aMsgDlg.Components[i]);
      dlgButton.Left := 100*(i-2) + 10*(i+1);
      dlgbutton.width := 100;   // default=68;
      if CaptionIndex > High(Captions) then Break;
      dlgButton.Caption := Captions[CaptionIndex]; // Beschriftung = Captions-array
      Inc(CaptionIndex);
    end;
  end;
  Result := aMsgDlg.ShowModal;
end;

Nützt das etwas?

_________________
ut vires desint, tamen est laudanda voluntas
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 10.11.10 20:43 
Da du das ganze in einer Methode gekapselt hast, wirst du wohl noch ein Boolean-Array mit übergeben müssen, das für die Buttons deren Status angibt.