Einzelnen Beitrag anzeigen

Nicodius

Registriert seit: 25. Apr 2003
Ort: Graz
2.234 Beiträge
 
Delphi 2006 Architect
 
#1

eigene Messageunit funzt nicht ganz

  Alt 4. Jul 2004, 18:07
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?
Nico Müller
  Mit Zitat antworten Zitat