Jump to content
Sign in to follow this  
bilcan

Migrating from 2.2 to 3.00 beta 2 and gotoform is not working

Recommended Posts

Hello,

I managed to migrate my old 2.2 application to 3.00 beta 2 but gotoform is not doing anything? What can be the reason? It used to work.

 

unit Unit1;

interface

uses
  Pseudo.CreateForms, 
  System.Types, SmartCL.System, SmartCL.Components, SmartCL.Forms, 
  SmartCL.Application,

  FrmMain, FrmOdaListesi, FrmSalon, FrmConnectionunit, FrmOkeyMasa;

type

  TApplication = class(TW3CustomApplication)
  private
    FrmOdaListesi: TFrmOdaListesi;
    FrmSalon: TFrmSalon;
    FrmOkeyMasa: TFrmOkeyMasa;
    FrmConnection: TFrmConnection;
  public
    procedure ApplicationStarting; override;
  end;


implementation


procedure TApplication.ApplicationStarting;
begin
  FrmOdaListesi := TFrmOdaListesi.Create(Display.View);
  FrmOdaListesi.Name := 'FrmOdaListesi';
  RegisterFormInstance(FrmOdaListesi, True);

  FrmSalon := TFrmSalon.Create(Display.View);
  FrmSalon.Name := 'FrmSalon';
  RegisterFormInstance(FrmSalon, True);


  FrmOkeyMasa := TFrmOkeyMasa.Create(Display.View);
  FrmOkeyMasa.Name := 'FrmOkeyMasa';
  RegisterFormInstance(FrmOkeyMasa, True);


  FrmConnection := TFrmConnection.Create(Display.View);
  FrmConnection.Name := 'FrmConnection';
  RegisterFormInstance(FrmConnection, True);

  inherited;
end;


end.
 

Share this post


Link to post
Share on other sites

You only attached Unit1, so there's no way for me to properly debug. Here's my best guess:

This is what Unit1 looks like in a new project.

unit Unit1;

interface

uses
  Pseudo.CreateForms, // auto-generated unit that creates forms during startup
  System.Types, SmartCL.System, SmartCL.Components, SmartCL.Forms, 
  SmartCL.Application, Form1;

type
  TApplication  = class(TW3CustomApplication)
  end;

implementation

end.

While previously you created all the forms by code, it's now done by TW3Application itself. You can control it here:

image.png

If you can't see all your forms there, try creating a new project and add your old existing forms to it. When Auto is checked in that list, TW3Application creates the form during startup. If you continue to have issues, you can send a zip of your project to jt at smartmobilestudio.com and I'll be happy to help.

Share this post


Link to post
Share on other sites

One thing I noticed is that you pass TRUE as the second parameter of RegisterForm -- This should only be done once.
The TRUE defines that the registered form is the "main" form. So only one should have TRUE while all the others should be false.

I also suspect that you should wait for the instance to finish before jumping (since you have modified the start code directlt):

TW3Dispatch.WaitFor([form1,form2,form3], procedure ()
begin
  Application.GotoForm(bla bla bla);
end);

Share this post


Link to post
Share on other sites

Hello Lennart,

thank you for your notice, I did not know second param's feature. I have changed form creation part, so application create forms automatically at the beginning and I have not had any problem so far.

P.S 

Migrating from 2.2 to 3.0 beta 2 was quite easy, thank you for your great work.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×