Autor Beitrag
bl3nder
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 58



BeitragVerfasst: Mo 25.09.06 12:04 
Hi
Ich wuerde gerne beim Start meines Programmes zunaechst ein Formular anzeigen, worauf sich nur ein Bild befindet .
Beim Klicken auf dieses Bild soll erst dann das Hauptformular und eigentlich auch erst das ganze Programm geoeffnet werden.

Meine MainForm heisst leider Form1 ( hab das Umbenennen zu lange vergessen und jetzt zu faul alles umzschreiben ;) )
und das ImageForm heisst Form6

Wenn ich es so schreibe, startet sich leider trotzdem sofort die Form1 des Programms:

ausblenden 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:
program Inventory;

uses
  Forms,
  Doku in 'Doku.pas' {Form2},
  Edit in 'Edit.pas' {Form3},
  Delete in 'Delete.pas' {Form4},
  Search in 'Search.pas' {Form1},
  Tausch in 'Tausch.pas' {Form5},
  Wait in 'Wait.pas' {Form6};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm6, Form6);
  Form1.Hide;
  Form6.Show;



  Application.Run;
end.


Bei Klick auf das Bild :
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm6.Image1Click(Sender: TObject);
begin

  Application.CreateForm(TForm2, Form2);
  Application.CreateForm(TForm3, Form3);
  Application.CreateForm(TForm4, Form4);
  Application.CreateForm(TForm5, Form5);

  Form1.Show;
  Form2.Hide;
  Form3.Hide;
  Form4.Hide;
  Form6.Close; 
  Form6.Free; // brauch ich beides ums zu zerstoeren ? wird ja nicht mehr benoetigt..

end;
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Mo 25.09.06 12:26 
Hallo,

du kannst im Nachhinein deine MainForm in den Optionen umstellen. Wenn du das nicht möchtest, dann würde ich das Logofenster dynamisch erzeugen und nach dem Click wieder freigeben.
Die MainForm kannst du dann mit ShowMainForm := False zunächst ausblenden.

Gruß Hape!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
bl3nder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 58



BeitragVerfasst: Mo 25.09.06 12:43 
Hi
Das Fenster dynamisch zu erzeugen hab ich doch probiert oder ?
Zunaechst moechte ich die MainForm verbergen mit Form1.Hide und lasse Form6 anzeigen, was sich bei Klick auf Form6 wieder aendert. Aber das funzt so nicht.
Das Umstellen der MainForm kenn ich schon, doch wuerd ich gerne das so beibehalten.
ShowMainForm := false geht bei mir nicht
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Mo 25.09.06 13:13 
ausblenden Delphi-Quelltext
1:
  Application.ShowMainForm := False					

Und mit dynamisch erstellen meinte ich sowas in der Art:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
  Form6 := TForm6.Create(Self);

//OnClose
  Action := caFree;

Denn Rest würde ich wieder aus der Projektdatei entfernen!

Gruß Hape!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
bl3nder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 58



BeitragVerfasst: Mo 25.09.06 13:30 
Danke jetzt gehts
Hier der Code fuer alle Googelnden ;)



ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
begin

  Application.Initialize;



  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.CreateForm(TForm3, Form3);
  Application.CreateForm(TForm4, Form4);
  Application.CreateForm(TForm5, Form5);
  Application.CreateForm(TForm6, Form6);

  Application.ShowMainForm := False;

  Form6.Show;


  Application.Run;


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm6.Image1Click(Sender: TObject);
begin
  Application.ShowMainForm := true;
  Form1.Show;
  Form6.Close;
end;
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Mo 25.09.06 13:34 
Hallo,

schön das es funktioniert. Dennoch erstellst du dein Formular 6 immer noch nicht dynamisch. Du zeigst es an und versteckst es wieder, gibt es aber nicht frei.

Gruß Hape!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
bl3nder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 58



BeitragVerfasst: Mo 25.09.06 13:54 
in Image1Click dann ein Form6.Free ?
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Mo 25.09.06 14:17 
user profile iconbl3nder hat folgendes geschrieben:
in Image1Click dann ein Form6.Free ?
Geht wohl eher nicht. Benutz dafür das Ereignis OnClose. Allerdings musst du es dann auch dynamisch erstellen, zum Beispiel in OnCreate und in den Optionen festlegen, dass es nicht automatisch erzeugt werden soll! Warum zeigst du das Formular eigentlich nicht Modal an?

Gruß Hape!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
bl3nder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 58



BeitragVerfasst: Mo 25.09.06 14:37 
Wusst ich nicht ;)
Dann mach ichs Modal
Danke