AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

"Don't ask again" Messagedialog ?

Ein Thema von ralfiii · begonnen am 6. Apr 2009 · letzter Beitrag vom 14. Jul 2010
 
gmc616

Registriert seit: 25. Jun 2004
Ort: Jena
627 Beiträge
 
Delphi 10.3 Rio
 
#4

Re: "Don't ask again" Messagedialog ?

  Alt 6. Apr 2009, 13:56
Das Beispiel vom Zauberer funktioniert über die WinAPI und Registry.

Ich hatte mal das gleiche Problem, wollte aber ohne die Registry auskommen. Deshalb hab ich mir selbst etwas gebastelt.
Delphi-Quellcode:
function MyMsgBoxx (psText,psTitle : string; AShowAgainChecked : boolean = false; AIcon : Integer ) : boolean;
VAR
  AMsgDialog : TForm;
  ACheckBox : TCheckBox;
  AImg : TComponent;
  bShowAgain : boolean;
  btnOk : TControl;
  nHeigth : integer;
BEGIN
  bShowAgain := true;
  AMsgDialog := CreateMessageDialog(psText, mtWarning, [mbOk]);
  AMsgDialog.FormStyle := fsStayOnTop;
  AImg := AMsgDialog.FindComponent('Image');
  if AImg <> nil then
  begin
     // eigene Icon-Lade-Funktion
     TImage(AImg).Picture.Icon := GetIconByName(IntToStr(AIcon));
  end;

  btnOk := AMsgDialog.FindChildControl('OK');
  if btnOk <> nil then
  begin
    nHeigth := btnOk.top + btnOk.Height + 24;
  end else begin
    nHeigth := 169;
  end;

  ACheckBox := TCheckBox.Create(AMsgDialog);
  WITH AMsgDialog DO
  begin
    TRY
      Caption := psTitle;
      ClientHeight := nHeigth;
      WITH ACheckBox DO
      BEGIN
          Parent := AMsgDialog;
          Caption := 'Diesen Hinweis nicht mehr anzeigen.';
          width := 190;
          top := nHeigth - 20;
          Left := 8;
          Checked := AShowAgainChecked;
      END;

      ShowModal;

      bShowAgain := Not (ACheckBox.Checked);
    FINALLY
      ACheckBox.Free;
      Free;
    END;
  END;
  Result := bShowAgain;
end;
Das ganze ist zwar (noch) nicht der Stein des Weißen, aber für mich erfüllt es seine Zwecke.
  Mit Zitat antworten Zitat
 


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 03:36 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz