Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 12 total
Thread IDE - "New Form" action is disabled
Sat, Oct 10 2015 6:26 AMPermanent Link

Christian Kaufmann

I changed my project source in order to defer the creation of the main form:

begin
  Application.Title := 'Swimrankings Manager';
  Application.LoadProgress := False;
//   Application.CreateForm(TForm1);
//   Application.Run;

 if (window.location.hostname = 'www.swimrankings.net') and (window.location.protocol <> 'https:')
   then window.location.href := 'https://www.swimrankings.net/manager'
   else BSServer.Run(BS_LOG_LEVEL_APPLICATION, TMainFormFactory.Create);
end.

BSServer sends a request to get some initial data (language specific) and creates the main form in
the request done event. This works fine, but I notice, that the form create action is disabled when
the "Application.Run" statement is missing. I tried to wrap it with {$IFDEF DESIGN}, but even then
it remains disabled.

Can this be fixed? Or is there another way to defere main form creation?

cu Christian
Sat, Oct 10 2015 12:35 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Christian,

<< BSServer sends a request to get some initial data (language specific) and creates the main form in the request done event. This works fine, but I notice, that the form create action is disabled when the "Application.Run" statement is missing. I tried to wrap it with {$IFDEF DESIGN}, but even then it remains disabled.

Can this be fixed? Or is there another way to defere main form creation? >>

You can't do what you're trying to do.  Form creation during startup is asynchronous because EWB may need to show a load progress dialog.  The Run method is what actually creates the forms, so getting rid of it will kill the form creation.

In general, don't mess with these lines in the application source.

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Oct 10 2015 2:55 PMPermanent Link

Christian Kaufmann

Tim Young [Elevate Software] wrote:

> In general, don't mess with these lines in the application source.

Well, I know but I didn't find another way to have a TServerRequest completed BEFORE the main form
is created.

I call the "Create MainForm" and the Application.Run in the OnComplete event of the request. Before
that I update all language specific values in the FormatSettings variable.

This worked fine in EWB1 and basically it works in EWB2 as well, except the disabled "New form"
function in the IDE.

Regarding LoadProgress: I don't show this anyway. Most time is used to download the .JS file so I
already have in my mind to try to add some static HTML code do the .html file.

cu Christian
Mon, Oct 12 2015 3:42 AMPermanent Link

Matthew Jones

Christian Kaufmann wrote:

> Well, I know but I didn't find another way to have a TServerRequest
> completed BEFORE the main form is created.

Why not have a main form that does the pre-flight work, and then have
the second form parented to that? My web shop starts with a "welcome"
form that is basically the empty desktop, and it then allows either the
web cart form to work, or the account one etc. The account one needs
you to be logged in first, so it makes sure that you are logged in
before you can see them. Basically, your main form can be the code you
want to do first, and then you can move to what you really want to have
as your application.

--

Matthew Jones
Mon, Oct 12 2015 5:34 AMPermanent Link

Christian Kaufmann

Matthew Jones wrote:

> Why not have a main form that does the pre-flight work, and then have
> the second form parented to that? My web shop starts with a "welcome"

I thought of that solution too and may end up with it. It would have to be a form with no language
specific stuff because the language I don't have available in the client before my first server
request. It's a limitation of current browsers javascript, you may read here for example:
https://github.com/dansingerman/jQuery-Browser-Language

cu Christian
Mon, Oct 12 2015 8:43 AMPermanent Link

Matthew Jones

Christian Kaufmann wrote:

> It would have to be a form with no language

I don't think that would matter - put up a spinner. My web shop starts
by making the form etc, and then talking to the server and it is all
very quick as far as I can see. Indeed, 2 seconds to load and show the
8 default products, with images etc, all built after a load of server
talk. I think it will work fine for you.

--

Matthew Jones
Mon, Oct 12 2015 10:34 AMPermanent Link

Christian Kaufmann

Matthew Jones wrote:

> I don't think that would matter - put up a spinner. My web shop starts

I changed my code and have a "weclome" form as main form now. You are right, it works fine. I left
my welcome dialog completeley empty because most of the time is used to download the two files
anyway.

So an improvement could be to have some text or image in the Project.html that is already shown by
browsers during the load of Project.js.

In addition all <script type="application/json"...> elements could be moved to a third file to make
the .html file smaller, but I'm not sure if this is possible.

cu Christian
Mon, Oct 12 2015 11:29 AMPermanent Link

Matthew Jones

Christian Kaufmann wrote:

> So an improvement could be to have some text or image in the
> Project.html that is already shown by browsers during the load of
> Project.js.

Have you tried the "show load progress" option in the project options
dialog? I expect that is customisable in some way too.

--

Matthew Jones
Mon, Oct 12 2015 11:47 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Christian,

<< In addition all <script type="application/json"...> elements could be moved to a third file to make the .html file smaller, but I'm not sure if this is possible. >>

That will most likely *increase* the loading time.

Your .html file shouldn't be much larger than 200-300k, compressed.  Are you operating over a particularly slow connection ?

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Oct 12 2015 3:08 PMPermanent Link

Christian Kaufmann

Tim Young [Elevate Software] wrote:

> Your .html file shouldn't be much larger than 200-300k, compressed.  Are you operating over a
> particularly slow connection ?
No.

It's not a priority issue. And I think it's not the loading time. These are the times in the local
network:

..html   0- 39ms
..js   120-164ms
RQ1   540-570ms

and this over a 5MBit internet connection:


..html    0- 450ms
..js    450-1200ms
RQ1   1750-1900ms


So it's the download time pluse the time used by the browser to parse the JS file when the user
just has a blank window. The EWB load progress comes after that.

cu Christian
Page 1 of 2Next Page »
Jump to Page:  1 2
Image