Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Savewarn

Hi guys,

I have a bit of a quandry.. I have a databound form which I am trying to close after the Write event. I've been trying the "Standard" method of :
gfctrl = get_property(@window,'GOTFOCUS_CONTROL')
call send_event(gfctrl,'GOTFOCUS')
call set_property(@window,'SAVEWARN',0)
call end_window(@window)

I've also tried doing a post_event(@window,'CLOSE') instead of end_window.

Regardless, I'm still getting the "Would you like to save changes to the entry?" message, even though the record has been written.

I just want to end the window, period. Is there a workaround?

Thanks!

Michael

Comments

  • There might be other things to discuss, but as a possible quick explanation is the focus usually within an edit box control?
  • In this case yes, an edit box or edit line.
  • Does the issue occur every single time regardless of which type of control has focus when you save the row?

    I also should have asked some additional questions:
    1. Is your code being called from the WRITE script event handler or from the QuickEvent handler?
    2. Does your form have the "Clear form after write" setting enabled?
    3. How is the WRITE event being triggered? Menu event, push button click event, other?
  • So far, yes, it happens regardless of control type.

    The code is called from the Write script event handler. It occurs after the Forward_Event

    Yes, the Clean Form flag is set

    The Write occurs upon either a push button event or pressing F9 (menu event)
  • I suspect you have an event handler that is populating a databound control after your WRITE event completes and this is causing the SAVEWARN property to get triggered once again. Since the intent is to always close the form after a WRITE, try removing the check from the "Clear form after write" setting and see if this helps. This might prevent the process from changing any databound controls. If this doesn't help, also try moving the focus back to the primary key control before doing your Forward_Event.
  • Bingo! Thank you sir
  • Very good...what step actually helped you?
  • Unchecking the Clear Form after Write flag
Sign In or Register to comment.