AGB  ·  Datenschutz  ·  Impressum  







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

Second Form and Thread

Ein Thema von mohfa · begonnen am 4. Mai 2008 · letzter Beitrag vom 7. Mai 2008
Antwort Antwort
christian_r
(Gast)

n/a Beiträge
 
#1

Re: Second Form and Thread

  Alt 7. Mai 2008, 07:22
Zitat von mohfa:
Here is a Pseudo Code.
I think you should post the relevant code you really used.

Delphi-Quellcode:
On MainForm Creat Event
On MainForm Destroy
On TMainForm.Button1.Click
What is that? You should post pseudo code that could be used and doesn't have to be corrected.

Here is a code that works. It's tested! It's the code, you posted as a pseudo code. And it doesn't cause any compiler errors and it doesn't cause your problem. It works fine!

unit1
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Classes, Controls, StdCtrls, Forms, Dialogs;

type
  TForm1 = class( TForm )
    Button1 : TButton;
    Label1 : TLabel;
    Label2 : TLabel;
    procedure FormCreate
              ( Sender : TObject );
    procedure Button1Click
              ( Sender : TObject );
  end;

var
  Form1 : TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.FormCreate
          ( Sender : TObject );
begin
  if not Assigned( Form2 ) then
    Form2 := TForm2.Create( Nil );
end;

procedure TForm1.Button1Click
          ( Sender : TObject );
begin
  Form2.Label1.Caption := 'Caption Nr. 1';
  Form2.Label2.Caption := 'Caption Nr. 2';
  if Form2.ShowModal = mrOk then
    ShowMessage( 'Ok.' );
end;

end.
unit2
Delphi-Quellcode:
unit Unit2;

interface

uses
  Windows, Classes, Controls, StdCtrls, Forms, Dialogs;

type
  TForm2 = class( TForm )
    Label1 : TLabel;
    Label2 : TLabel;
    Button1 : TButton;
    Button2 : TButton;
    procedure Button1Click
              ( Sender : TObject );
  end;

var
  Form2 : TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click
          ( Sender : TObject );
begin
  Self.ModalResult := mrOk;
end;

end.
And again ...
Check your code!
Stop to discuss!
Post your relevant code!
  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 03:11 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