NetTalk Central

Author Topic: Embed point 'After Opening files' in NetWebForm  (Read 3578 times)

hkalmbach

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
    • Email
Embed point 'After Opening files' in NetWebForm
« on: October 28, 2015, 12:41:37 AM »
Hello,
I have a normal NetWebBrowse and NetWebForm combination for listing and updating records.
Now I wanted to use the embed point 'After Opening files' to read additional data. I wanted to do this there because I didn't want it to do on procedure setup with is passed more than one time.

But then I recognized that this point is never passed?
There are three stages when OpenFiles is called:

Net:InsertRecord + NET:WEB:Populate
Net:ChangeRecord + NET:WEB:Populate
Net:ViewRecord + NET:WEB:Populate

I am changing records, but these stages are never active.

What is the routine 'Open files' good for? Why do I assign files to a Form if they are not opened?

Is there an overview which embed points are good for typical actions? In the nettalk book I didn't find (V2)

Thanks for every help.

Regards
Heinz

Vinnie

  • Full Member
  • ***
  • Posts: 182
    • View Profile
    • Email
Re: Embed point 'After Opening files' in NetWebForm
« Reply #1 on: October 28, 2015, 02:56:42 AM »
Hi Heinz

On  a Form I use

Generate Form - Start as an embed point to update or get data.
Do OpenFiles
Your code
Do CloseFiles

If you look at the Login Form  in the Nettalk demos programs. 

Cheers

Vinnie

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Embed point 'After Opening files' in NetWebForm
« Reply #2 on: October 28, 2015, 08:45:11 PM »
Hi Heinz,

There are ways to get your code run only once on the opening of a form (either Insert, Change, Delete, Copy or View).

A simple way is to use the PreInsert/Update/Delete embeds and call a routine, say Start_Code, at each point you need it (usually just PreInsert and PreUpdate.

Another option is to run a check in the InitForm embed, to make sure the code only runs once:

Code: [Select]
if (p_web.GetValue('FORMNAME_form:inited_') = 0)
Hope that helps.
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Embed point 'After Opening files' in NetWebForm
« Reply #3 on: October 28, 2015, 11:29:58 PM »
Hi Heinz,

>> What is the routine 'Open files' good for?

For starters it's useful for calling from embed code when you need a bunch of files opened.
It's also good, as you saw, for some of the events. (You may not be seeing these events at the moment in your app, depending on your app settings, but they do get called in some cases.)

The actual form file is opened as necessary by the library itself.

>> Why do I assign files to a Form if they are not opened?

They're not opened for all events (that would be burdensome from a performance point of view) but they are opened for some events, and in some cases. Plus of course it makes it easier for you to open a bunch of files in hand-code.

cheers
Bruce