Editing Database Information with a Dialog

I have tried Editing Database Information with a Dialog and found it works great. Two comments/questions related to shared databases:

If I open the dialog set up to edit data as described in the rundialog help page, and the user presses the Cancel button, the active record is locked and remains locked after the dialog closes. I thought it would be better not to lock the record when Cancel is pressed.

Second, when the Ok button is pressed, the record is locked. Wouldn’t it be better to lock the record, upload the changes, the commit the changes (i.e. unlock the record)?

This section of the documentation was written long before Panorama X Server was a thing. This code example was not written with record locking in mind.

However, I think you could easily modify the code to make it work with a shared database. You just have to lock the record before the dialog opens and unlock it when the dialog closes.

if lockcurrentrecord()
        rundialog {Form=Address Height=120 Width=400
         stoploopif info("trigger")="Dialog.Close"
    alertsheet "Record is locked by another user"

Jim, thank you for those suggestions. I had wondered what would happen if I tried to access a locked record. I will make these changes part of my regular code.

When using a dialog with a form both as a sheet or a dialog can the dialog use a form with scroll bars? It seems that the scrollbar options are turned off automatically for both.

According to the help page for Opendialog, “The dialog window will not have any scroll bars or tool palette.”

1 Like

Thank you sir, I read through the help page several times, must of missed that.