Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi eigene Messageunit funzt nicht ganz (https://www.delphipraxis.net/25317-eigene-messageunit-funzt-nicht-ganz.html)

Nicodius 4. Jul 2004 17:07


eigene Messageunit funzt nicht ganz
 
Delphi-Quellcode:
unit MyMessages;

interface
  uses
  Forms,
  QStdCtrls,QExtCtrls, Graphics,
  SysUtils, test;
type
  TMyMessage = Class
    procedure CreateForm(Left,Top, Width, Height,Symbol : Integer;
                         Caption, Text : String);
    procedure ShowMMessage(Caption : String; MMessage : String); overload;
    procedure ShowMMessage(Caption : String; MMessage : Integer); overload;
    procedure ShowMMessage(Caption : String; MMessage : Real); overload;

  end;

implementation
procedure TMyMessage.CreateForm(Left,Top, Width, Height,Symbol : Integer;
                     Caption, Text : String);
var Form : TForm;
begin
  Form := nil;
  Form := TForm.Create(Form);
  Form.Left := Left-Width div 2;
  //Form.Width := Width;
  Form.Top := Top+Height div 2;
  Form.Height := Height;
  Form.Caption := Caption;
  Form.Parent := Form1;
 // Besch.WordWrap := true;
  case Symbol of
    0 : ; //Nichts
    1 : ; //Info
    2 : ; //Frage
    3 : ; //Ausruf
  end;
  Form.Canvas.Font.Color := clblack;
  Form.Canvas.TextOut(30,30 , text);
  Form.BorderStyle := bsdialog;
  Form.Visible := true;
  Form.SetFocus;
end;
procedure TMyMessage.ShowMMessage(Caption : String; MMessage : String);
begin
  CreateForm((Screen.Width div 2), 40, (Screen.Height), 100, 0, Caption, MMessage);
end;
procedure TMyMessage.ShowMMessage(Caption : String; MMessage : Integer);
begin
  CreateForm((Screen.Width div 2), 40, (Screen.Height), 100, 0, Caption, IntToStr(MMessage));
end;
procedure TMyMessage.ShowMMessage(Caption : String; MMessage : Real);
begin
  CreateForm((Screen.Width div 2), 40, (Screen.Height), 100, 0, Caption, FloatToStr(MMessage));
end;

end.

AUFRUF


Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var MyM : TMyMessage;
begin
  Mym.ShowMMessage('HALLO', 'HALLO WELT');
end;
es wir das form angezeigt mit caption etc
so... jetzt wird aber kein text in dem form ausgegeben warum?

Meflin 4. Jul 2004 17:07

Re: eigene
 
wie wärs mal mit nem brauchbaren titel?

fred.reichbier 4. Jul 2004 17:10

Re: eigene
 
Hi!
probier mal das textout nach dem form1.show zu machen.
MfG,
fred

neolithos 4. Jul 2004 17:10

Re: eigene
 
Du gibst den Text via TextOut aus.
Dieser Text wird nie angezeigt, da zu diesem Zeitpunkt das Fenster noch nicht existiert.

Such mal nach OnPaint.

Nicodius 4. Jul 2004 17:11

Re: eigene Messageunit funzt nicht ganz
 
DANKE!

habs nach dem visible gegeben !



thx!


//edit hab diesmal NUR ein edit gemacht :D


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:09 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