Autor Beitrag
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Fr 21.08.09 10:26 
Hi,

also ich hab mal mein Delphi durchstöbert auf der Suche nach einer möglichkeit in Msgdlg'en die Buttons selbst zu beschriften. Gibt es da etwas oder muss ich mir das selbst zusammen schreiben?

Habe bereits gestöbert wie in Dialogs das ganze kreiert wird und bin dort auf eine gute Ausgangsbasis gestoßen.
Nur bevor ich mir das selbst zusammen schreibe möchte ich eben wissen ob es das nicht doch schon gibt.

mfg nic


Moderiert von user profile iconNarses: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Fr 21.08.2009 um 12:05
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 21.08.09 10:42 
CreateMessageDialog, dort die nötige Anzahl Buttons angeben und dann nachträglich mit FindComponent die einzelnen Buttons umlabeln. ShowModal dann zur Anzeige.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
thepaine91 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Fr 21.08.09 11:45 
Danke BenBE mehr wollte ich nicht wissen.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 21.08.09 12:50 
Aber einfachher ist es wahrscheinlich sich schnell einen eigenes Formular zusammen zu klicken. ;)
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: Fr 21.08.09 13:12 
oder man lagert das ganze in ne Prozedur aus. Sowie diese hier:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
function ExMessageDlg(const Msg: string; MsgCaption: String; DlgType : TMsgDlgType;
                     Buttons : TMsgDlgButtons; Captions: array of string) : Integer;
var
  aMsgDlg : TForm;
  CaptionIndex, i : integer; 
  dlgButton : TButton;
begin 
  aMsgDlg := CreateMessageDialog(Msg, DlgType, buttons); 
  aMsgDlg.Caption := MsgCaption;
  CaptionIndex := 0
  for i := 0 to aMsgDlg.ComponentCount - 1 do begin  
    if (aMsgDlg.Components[i] is TButton) then begin 
      dlgButton := TButton(aMsgDlg.Components[i]); 
      if CaptionIndex > High(Captions) then Break;  
      dlgButton.Caption := Captions[CaptionIndex];
      Inc(CaptionIndex); 
    end
  end
  Result := aMsgDlg.ShowModal; 
end;


Basiert auf einem Quelltext aus der Delphi-Praxis. aufgerufen kann es zum Beispiel so werden:

ausblenden Delphi-Quelltext
1:
  ExMessageDlg('Das is der Text im Dialog''das is die caption', mtInformation, [mbYes, mbNo], ['Ja''Nein']);					


lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.