NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: hkalmbach on October 09, 2015, 02:39:58 AM
-
Hi,
I have a general question to embed code in webbrowses and forms.
I found that if I perhaps enter code in a webbrowse at the embed point 'procedure setup' and then run the webserver this code is run twice opening the form.
I am not sure whats the sense of this and more important how to avoid it. Because sometimes I have to do time consuming things and don't want to slow down the server to much.
What can be done to avoid this?
Thanks in advance.
Heinz
-
Hi, you need to understand the difference between a browse and a form and why a form can be called several times. It might be good for you to buy the net talk book from capesoft, it describes both.
Also look through the Net Talk User Group - show 35 will explain form embeds
See http://www.capesoft.com/accessories/NetTalkUserGroup.htm
In general, look for something that sounds like it gets called once, like
GenerateBrowse Routine in a browse
GenerateForm Routine in a form
if you are unsure, put a debug line in and run the browse or form, see if it only gets called once.
-
Hi Heinz,
You're thinking of the NetWebBrowse and NetWebForm as "procedures" when in fact they are much more like "event handlers". During the life of a browse or form the "procedure" will be called many many times, maybe 20 times or more, each time handling some specific event.
So "Procedure Setup" is not a very useful embed point, because it is called for "all events". Rather you need to understand exactly what event you are trying to embed on, and then embed much closer to the code that runs on that event.
As Kevin suggests, GenerateBrowse and GenerateForm being obvious candidates for "when this thing is generated".
cheers
Bruce