AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi MessageDLG mit eigener Überschrift, Wie?
Thema durchsuchen
Ansicht
Themen-Optionen

MessageDLG mit eigener Überschrift, Wie?

Ein Thema von Amnon82 · begonnen am 10. Mai 2006 · letzter Beitrag vom 10. Mai 2006
Antwort Antwort
Benutzerbild von Amnon82
Amnon82

Registriert seit: 5. Jan 2005
186 Beiträge
 
FreePascal / Lazarus
 
#1

MessageDLG mit eigener Überschrift, Wie?

  Alt 10. Mai 2006, 08:06
Ich hab folgenden Code:

Delphi-Quellcode:
function xMessageDlg(const Msg: string; DlgType : TMsgDlgType;
                     Buttons : TMsgDlgButtons; Captions: array of string) : Integer;
var
  aMsgDlg : TForm;
  CaptionIndex,
  i : integer;
  dlgButton : TButton; // uses stdctrls
begin
  // Dlg erzeugen
  aMsgDlg := CreateMessageDialog(Msg, DlgType, buttons);
  CaptionIndex := 0;
  // alle Objekte des Dialoges testen
  for i := 0 to aMsgDlg.ComponentCount - 1 do begin
    // wenn es ein Button ist, dann...
    if (aMsgDlg.Components[i] is TButton) then begin
      dlgButton := TButton(aMsgDlg.Components[i]);
      if CaptionIndex > High(Captions) then Break;
      // Beschriftung entsprechend Captions-array ändern
      dlgButton.Caption := Captions[CaptionIndex];
      Inc(CaptionIndex);
    end;
  end;
  Result := aMsgDlg.ShowModal;
end;
Wie kann man den Title (Überschrift) definieren?
Ich benötige einen MSGDLG wo ich die Überschrift und die Buttons selber definieren kann. Mit der Buttons-Beschriftung klappts ja, nur nicht mit dem Title.
  Mit Zitat antworten Zitat
Benutzerbild von Sharky
Sharky

Registriert seit: 29. Mai 2002
Ort: Frankfurt
8.251 Beiträge
 
Delphi 2006 Professional
 
#2

Re: MessageDLG mit eigener Überschrift, Wie?

  Alt 10. Mai 2006, 08:16
Zitat von Amnon82:
... Wie kann man den Title (Überschrift) definieren?. ...
Hai Amnon82,

da der Dialog ja ein TForm ist hat diese ja auch eine Caption. Du musst also nur noch den Titel als Parameter übergeben und dann vor dem Aufruf von aMsgDlg.ShowModal die Caption setzen:
Delphi-Quellcode:
function xMessageDlg(const aCaption : string;const Msg: string; DlgType : TMsgDlgType;
                     Buttons : TMsgDlgButtons; Captions: array of string) : Integer;
.
.
begin
.
.
  aMsgDlg.Caption := aCaption;
  Result := aMsgDlg.ShowModal;
end;
Stephan B.
  Mit Zitat antworten Zitat
Benutzerbild von Amnon82
Amnon82

Registriert seit: 5. Jan 2005
186 Beiträge
 
FreePascal / Lazarus
 
#3

Re: MessageDLG mit eigener Überschrift, Wie?

  Alt 10. Mai 2006, 10:15
Hab auch was gefunden:

http://img96.imageshack.us/img96/4356/dialogs6nq.png

Delphi-Quellcode:
MsgBox(
    STR Msg, // address of text in message box
    STR Caption, // address of title of message box
    BOOL Silent // determine muted sound
    INT uType // style of message box
   );

MsgBoxEX(
    STR Msg, // address of text in message box
    STR Caption, // address of title of message box
    TPIC MsgPic // address of icon to show in the message box
    TIMGLST GlyphList // address of imagelist to representing button glyphs
    TPOS Position // position of message box
    STR Buttons // adress of ButtonCaptions
    STR Sound // adress of sound to play when opening the message box
    BOOL StayOnTop // formstyle of message box
    BOOL SetForeGround // determine if message box becomes the foreground
                             window.
    TCOLOR Color // set the color of the message box
    BYTE DefaultButton // sets the default button in the message box
   );
Example on how to display a message box with red fonts in message,
yesnobuttons, yesbutton's caption = 'Yeah', display a questionicon,
and default button is 2:

Delphi-Quellcode:
 Var ReturnValue : Integer;

 Procedure Sample1;
 begin
   mb_BtnYes := '&Yeah';
   mb_MsgFont := Tfont.Create;
   mb_MsgFont.Color := clRed;
   ReturnValue := MsgBox( 'This is the red message', '', False,
    MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION);
   mb_MsgFont.Free;
 end;

Example on how to display a simple message box asking for a value
from 1 to 10 represented by buttons 1 to 10, playing the soundfile
"c:\woww.wav", where default button is 5:

Delphi-Quellcode:
 Var ReturnValue : Integer;

 Procedure sample2;
 begin
   ReturnValue := MsgBoxEX('Select a value from 1 to 10', '', nil, nil,
   poOwnerFormCenter, '1|2|3|4|5|6|7|8|9|10', 'c:\woww.wav', False, False,
   clBtnFace, 5);
 end;
Angehängte Dateien
Dateityp: zip msgbox__and_statusbox_736.zip (27,3 KB, 20x aufgerufen)
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:19 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz