NetTalk Central

Author Topic: Refresh Form from browse  (Read 3882 times)

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Refresh Form from browse
« on: August 13, 2013, 12:27:27 PM »
Hi,
I have a NetWebBrowse inside a NetWebForm. The user can delete records via delete button on the browse rows. When all the records are deleted from the browse table, I wish to refresh (or regenerate) the NetWebForm screen containing the browse. Is there a way to do this?

Thanks,
Rob

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Refresh Form from browse
« Reply #1 on: August 13, 2013, 11:42:49 PM »
"refresh" in what sense? Are you going to affect specific controls on the form - hide / unhide etc?
It is possible - if not "only on last delete" then certainly on "all deletes". But exactly what's going to look different after the refresh will dictate the approach somewhat.

cheers
Bruce

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Refresh Form from browse
« Reply #2 on: August 14, 2013, 05:38:36 AM »
HI Bruce,
Yes, hide controls and display text will change. I have a session variable with the number of records that the condition can be tested on any delete, but of course would prefer "refreshing" the form on "only last delete".  If I could get a "only last delete" event, then it would be simpler to regenerate the whole page.
Rob
« Last Edit: August 14, 2013, 05:42:25 AM by Rob Kolanko »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Refresh Form from browse
« Reply #3 on: August 15, 2013, 12:15:08 AM »
Hi Rob,

>>  If I could get a "only last delete" event

yeah, that's probably a little too specific. It implies a chain of events, leading to a result, triggering another event. That could get very tricky to manage.

But there is a "childUpdated" event sent to the form after the row is deleted from the browse. So if you have a sessionValue to test, then you could embed code in the form, something like this;

Validate::BrowseLineItems  Routine
  if p_web.Event = 'childupdated' and p_web.GSV('AreThereRecords') = 0
    do Refresh::somefield
    do Refresh::someotherfield
  end


In the above the AreThereRecords is the session value you alluded to earlier.

Does this help?

cheers
Bruce

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Refresh Form from browse
« Reply #4 on: August 15, 2013, 12:47:17 PM »
p_web.event ?
What is this witchery? that thou has created!!
I checked "Send Stage to DebugView" and look, not only is the stage displayed, but this new browse event value also displayed. Also the stage description (thanks).  I hope that you will cover the browse events during the CIDC training.

Thanks, your suggestion will work great!

Rob
« Last Edit: August 15, 2013, 12:48:52 PM by Rob Kolanko »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Refresh Form from browse
« Reply #5 on: August 15, 2013, 07:10:42 PM »
Hi Rob,

>> What is this witchery? that thou has created!!

remember all that refactoring that went on in June? I told you it would pay off :)
One of the goals has been to make embedding easier, which in turn means trying to create familiar patterns and also show how to understand those patterns.

Rather than seeing a Browse or Form etc as a "Procedure" it's helpful to think of it as an "Event Processor" - or in ABC terms, as a "Take Event".

There's still some refinement to go to make the code a bit easier to read, but I think the Event metaphor will be easier to understand.
And yes, this is definitely on the agenda for the NetTalk Training.

Cheers
Bruce