Autor Beitrag
MH1987
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: Sa 07.10.06 16:29 
hi,

ich möchte in meinem programm ein 2tes Fenster per klick auf ein button öffnen lassen.

hab bisher diesen ansatz, hab aber leider nicht die ahnung wie das richtig funktionieren soll:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;
  TForm2 = class(TForm)
  end;

var
  Form1: TForm1;
  neu: TForm2;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  neu:= TForm2.Create(Form1);
  neu.Width:= 100;
  neu.Visible:= true;
end;

end.


wäre nett wenn mit jemand weiterhelfen könnte!

gruß
Matthias


Moderiert von user profile iconGausi: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Sa 07.10.2006 um 16:33
rizla
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 417
Erhaltene Danke: 2

XP
FPC mit Lazarus
BeitragVerfasst: Sa 07.10.06 16:33 
hi
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var form2: TForm2;
begin
form2 := TForm2.create(application);
form2.show(modal);
form2.release;

gruß :r:

_________________
if you have what they want - they'll find a way to take it (bruce sterling)
WOW - 10 JAHRE Mitglied beim Delphi-Forum. Wie die Zeit vergeht, Freunde.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 07.10.06 16:33 
Warum erstellst du nicht zur Designzeit über Datei->Neu->Fenster ein neues Fenster in deiner Anwendung und lässt es dir über Form2.Show; anzeigen?

_________________
We are, we were and will not be.
MH1987 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: Sa 07.10.06 16:35 
dankee für die ganzen schnellen antowrten! das ist echt toll!
werds direkt mal probieren

Dankee

Gruß
Matthias
rizla
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 417
Erhaltene Danke: 2

XP
FPC mit Lazarus
BeitragVerfasst: Sa 07.10.06 16:41 
hinweis:

show öffnet das neue fenster
showmodal auch, aber das neue fenster behält den focus, bis es geschlossen wird.
such mal in der hilfe nach showmodal
release gibt den speicher wieder frei, nachdem das fenster geschlossen wurde

:r!a:

_________________
if you have what they want - they'll find a way to take it (bruce sterling)
WOW - 10 JAHRE Mitglied beim Delphi-Forum. Wie die Zeit vergeht, Freunde.
MH1987 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: Sa 07.10.06 16:46 
es kommt jedoch ein fehler bei der zeile:

ausblenden Delphi-Quelltext
1:
form2 := TForm2.create(application);					


fehler: EResNotFound

so sieht der ganze quelletxt aus:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;
  TForm2 = class(TForm)
  end;

var
  Form1: TForm1;
  form2: TForm2;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var form2: TForm2;
begin
form2 := TForm2.create(application);
form2.show;
form2.release;
end;

end.
rizla
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 417
Erhaltene Danke: 2

XP
FPC mit Lazarus
BeitragVerfasst: Sa 07.10.06 16:48 
uses..
unit2
muss auch noch rein! sonst weiß delphi ja net, was form2 ist..

_________________
if you have what they want - they'll find a way to take it (bruce sterling)
WOW - 10 JAHRE Mitglied beim Delphi-Forum. Wie die Zeit vergeht, Freunde.
MH1987 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: Sa 07.10.06 16:53 
soo
jetzt klappts endlich...

vielen dank!!

Gruß
Matthias