Hi,
using VCL I usually create a form and initialize it calling a "startup" method; thsi method is repsonsible to set up the form, open
the queries and finally display the form. During that phase, if an exception is raised implicitely or explicitely, the relative message
is shown to the user and the form is not shown.
Something like this:
with TMyForm.Create(self)
try
Initialize(.., ...);
finally
Free;
end;
procedure TMyForm.Initailize(..., ...);
begin
// form initialization...
raise Exception.Create('some error');
ShowModal;
end;
In the above example, the form is created, the Initailize method is executed until the exception, finally the form is freeid.
I'm unable to achieve the same behaviour with UniGUI, as it seems that the forms are automatically shown after being created.
I've tried something like this, but it gives a Javascript error:
procedure TMyForm.Initailize(..., ...);
begin
try
// form initialization...
raise Exception.Create('some error');
ShowModal;
except
self.Close;
end;
end;
Is there a solution ? Or, which is the best way to initialize a form ?
Andrea