NetTalk Central

Author Topic: Embed point when windows closes?  (Read 4701 times)

John Fligg

  • Sr. Member
  • ****
  • Posts: 361
    • View Profile
    • Ambrit Software
    • Email
Embed point when windows closes?
« on: December 29, 2011, 02:45:40 PM »
I am missing something VERY basic I know.

I am setting a parameter in a session variable. But I want to reset that when say a Browse window closes.

I cannot use End of Procedure as that is called many times and is not the actual closing of the browse window. Every embed point I try using (such as Close Button) does not fire. So for example I put some code under Before or After Close button but that does not fire.

So where do I actually put my code to run when the browse window or form actually closes?

Sorry for missing the obvious.

John

John Fligg

  • Sr. Member
  • ****
  • Posts: 361
    • View Profile
    • Ambrit Software
    • Email
Re: Embed point when windows closes?
« Reply #1 on: December 30, 2011, 02:01:01 AM »
Sorry for the hassle but this one is holding me up now so hopefully someone can put me out of my misery.

Cannot find anything in the book or the help files. Clearly missing something very obvious.

John

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Embed point when windows closes?
« Reply #2 on: December 30, 2011, 04:19:16 AM »
Hey John,

How are you resetting the parameter?  What's the code look like?

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Embed point when windows closes?
« Reply #3 on: December 30, 2011, 06:09:57 AM »
The obvious thing you're missing is that windows never close.
That's because they don't exist.

When a request is made for a page, a thread starts, generates the page, and then disappears. The page is displayed in the browser, but there is nothing on the server side that matches that "page". the user might navigate elsewhere, they might turn off their PC - anthing might happen. But the page never "closes".

So what is your real question? What are you wanting to do, when, and why?

cheers
Bruce

John Fligg

  • Sr. Member
  • ****
  • Posts: 361
    • View Profile
    • Ambrit Software
    • Email
Re: Embed point when windows closes?
« Reply #4 on: December 30, 2011, 07:09:11 AM »
Yes of course!

So taking a specific example using the familiar invoice - invoice line windows ....

Open Browse Invoice. Now add an invoice line. Press a button and set variable to 1. Return to the Browse. Keep the variable set at 1 for now while I add more invoice lines. BUT when I press CLOSE to close Browse Invoice I want to set the variable back to 0.

Hope that makes sense.

Wherever I tried to rest the parameter it was being triggered several times and requests to the server were made. I need a unique point when that Browse or Form closes.

Thanks

John

bruce2

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Email
Re: Embed point when windows closes?
« Reply #5 on: December 30, 2011, 10:32:30 PM »
Surely that should be a save button, not a close button?

John Fligg

  • Sr. Member
  • ****
  • Posts: 361
    • View Profile
    • Ambrit Software
    • Email
Re: Embed point when windows closes?
« Reply #6 on: December 31, 2011, 03:27:10 AM »
If I am doing it from a FORM then I accept that, but I also need to do something similar on a Browse.

An example there is a Diary. AT startup I filter just todays appointments. On the window are buttons to filter by Week, Month etc. Each of those sets the parameter,

But when I close the BROWSE I need to reset that parameter back to 0.

So it is the general priciple I am trying to get at here Bruce. Is there a UNIQUE embed pooint I can use to do something when closing a Form or a Browse for the last time?

What baffles me is if I put code uner the CLOSE button, it fires all the time. I just need it to fiure when I actually press the button to close that form.

Hope that makes sense.

John

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: Embed point when windows closes?
« Reply #7 on: January 01, 2012, 09:38:39 AM »
John,
You might want to try adding an "Enter another line item" button that would recall the entry form as an insert instead of returning to the browse.
Or make the save button call the entry form as an insert and add a "No more line items" button that returns to the browse. (AKA the cancel button)

Since there are no user interface windows in a web app, you can't trap a close event. You need to rethink how the data entry logic works.

HTH
chris
Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Embed point when windows closes?
« Reply #8 on: January 01, 2012, 09:58:07 PM »
Browses and forms are very different controls, and have very different embed points.

>> But when I close the BROWSE I need to reset that parameter back to 0.

no you don't. Actually leaving this sort of thing alone means that the user gets a better experience as the window "remembers" the way they used it previously. In exactly the same way if you sort a browse, then go somewhere else, then open the browse again, the browse remains sorted in the way you left it.

But that aside, the Browse doesn't exist - so it is never "closed" - so there's no embed point that signals that it has disappeared from the user's browser.

cheers
Bruce