[Lazarus] Lazarus Übersetzung - Suche/Ersetzen

Benito van der Zander benito at benibela.de
Thu Oct 2 15:20:31 CEST 2008


You may need to post your application's .lpr as well... We don't know if the
forms are created in there or not.

I am not sure you can assign "Appliction" as the parent of a form... isn't
it just "null" or "self"?  Smarter people will know that...

ie.
Form2 := TForm2.Create (self);
or
Form2 := TForm2.Create (null);

In the .lpr file the command is different too...
Application.CreateForm (TForm2, Form2);

Regards,
-Reenen


2008/10/1 Usuario Anónimo <usuarioanonimomysql at gmail.com>

> Sometimes in a simple applicattion whith a principal form and several
> secondary forms accesed by a TMainMenu I get the error:
>
> Access violation.
>
> Press Ok to ignore and risk data corruption.
> Press Cancel to kill the program.
>
> when I branch between forms. Anybody help me?
>
> My application:
>
> unit Unit1;
>
> {$mode objfpc}{$H+}
>
> interface
>
> uses
>   Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Menus;
>
>
> type
>
>   { TForm1 }
>
>   TForm1 = class(TForm)
>     MainMenu1: TMainMenu;
>     MenuItem1: TMenuItem;
>     MenuItem2: TMenuItem;
>     MenuItem3: TMenuItem;
>     MenuItem4: TMenuItem;
>     procedure MenuItem1Click(Sender: TObject);
>     procedure MenuItem2Click(Sender: TObject);
>     procedure MenuItem3Click(Sender: TObject);
>   private
>     { private declarations }
>   public
>     { public declarations }
>   end;
>
> var
>   Form1: TForm1;
>
> implementation
>
> uses Unit2, Unit3, Unit4;
>
> { TForm1 }
>
> procedure TForm1.MenuItem1Click(Sender: TObject);
> begin
>  Form2 := TForm2.Create (Application);
>  try
>   Form2.ShowModal;
>  finally
>   Form2.Free;
>  end;
> end;
>
> procedure TForm1.MenuItem2Click(Sender: TObject);
> begin
>  Form3 := TForm3.Create (Application);
>  try
>   Form3.ShowModal;
>  finally
>   Form3.Free;
>  end;
> end;
>
> procedure TForm1.MenuItem3Click(Sender: TObject);
> begin
>  Form4 := TForm4.Create (Application);
>  try
>   Form4.ShowModal;
>  finally
>   Form4.Free;
>  end;
> end;
>
> initialization
>   {$I unit1.lrs}
>
> end.
>
> Unit2.pas
>
> unit Unit2;
>
> {$mode objfpc}{$H+}
>
> interface
>
> uses
>   Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Menus;
>
>
> type
>
>   { TForm2 }
>
>   TForm2 = class(TForm)
>     MainMenu1: TMainMenu;
>     MenuItem1: TMenuItem;
>     procedure MenuItem1Click(Sender: TObject);
>   private
>     { private declarations }
>   public
>     { public declarations }
>   end;
>
> var
>   Form2: TForm2;
>
> implementation
>
> { TForm2 }
>
> procedure TForm2.MenuItem1Click(Sender: TObject);
> begin
>   Close;
> end;
>
> initialization
>   {$I unit2.lrs}
>
> end.
>
> Regards.
>
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>


-- 
o__
,_.>/ _
(_)_\(_)_______
...speed is good
_______________
I believe five out of four people have a problem with fractions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20081002/81568cbf/attachment-0007.html>


More information about the Lazarus mailing list