Can I Lock a Form?

Is there any way to lock a form or otherwise make in un-deletable?

I have a user who has forms disappear without any obvious reason and I’m doubtful that Panorama is losing them. I have found that under some circumstances, the Graphics Mode button and Delete button in Graphics Mode can be pretty closely aligned. So I’m wondering if he’s double clicking on Graphics Mode and triggering the deletion. I’ve been able to duplicate that.

So if there’s a way to prevent form deletion…

I don’t think there is a current way to lock a form from deletion. You could devise a scheme to rebuild it if it has been deleted. Your .Initialize procedure could make a variable to contain the binary data of the form involved (or several variables of multiple forms). You would also setup a timer to check that these forms still exist in the database. If they are missing, the timer would call a procedure to replace the missing form:

 fileglobal binaryForm1, binaryForm2
 binaryForm1=exportform("MyFirstForm")
 binaryForm2=exportform("MySecondForm")
 starttimer "FormMonitor","code",{call .replaceForm},"interval",60

I have set the interval so that the timer runs every minute and the code calls the .replaceForm procedure which would look something like this:

case arraynotcontains(dbinfo("forms",""),"MyFirstForm",¶)
     importform binaryForm1
case arraynotcontains(dbinfo("forms",""),"MySecondForm",¶)
     importform binaryForm2
endcase

I have also left the scope at the default of database so it only runs when this database is active. Admittedly a hack but the only thing I could think of to do the job. I may be missing something much simpler. :worried:

There is no way to lock a form. The user could customize the toolbar to remove the Delete Form tool, or to move it. In fact I think they must have done that already – by default it is very far from the Graphics/Data Mode button. But it can be moved to any position they want or removed from the toolbar entirely. Unfortunately, this cannot be done on an individual form or even individual database basis – the toolbar configuration is for all Panorama form windows. See Customizing the Toolbar on this help page:

When Panorama 10.2 comes out, it will have a preference option to warn you before a form is deleted. In fact, the new version will have very granular preferences for customizing warning alerts if you want them. This has been a much requested feature, and it is coming soon.

The warnings will suffice in this scenario.

You can lock a database to a specific account. In that case only someone who logged into that account can open the database. When locking the database to an account, you can set the permission levels for the Administrator, Developer, and User. Someone logged in as a user, if I understand correctly what I have seen, can be restricted from accessing Graphics mode, or viewing or changing procedures. I haven’t fully explored this, but I think that they can with these tools be prevented from deleting a form.

The could, but this would also prevent them from going into Graphics Mode, and it sounds like this particular user needs to go into graphics mode. That’s why I didn’t mention this capability.

The account locking would be a solution except this user does have access to everything - much of the file set is his own programming from some years ago. I’ve just helped him move into PanX so he’s still learning it.

I’ve never experienced or seen anything here about Pan X forms disappearing during ordinary use of a database. I was looking for a way to prevent deletion of forms since a single click is all it takes to eliminate one. The form that “disappeared” would have benefited greatly with a warning if he did delete it and will be better than a lock in this situation.

Perhaps it would be sufficient to remove Delete Form from the toolbar.

That could help, but any customizing of the Toolbar readily restores it. That’s especially true if the user selects the “pre-packaged” tool set. But you do bring up another interesting point. If the Toolbar is set the Titles, the Remove tool becomes Delete Form and can truncate or crowd with others making it less clear that the Delete refers to the form and not a record - though many of us wouldn’t expect the ability to delete a record in Graphics Mode.

Please keep in mind that in Panorama X the Remove Form operation is UNDO-able, so it is not necessarily a permanent deletion of the form. Of course the user has to realize that before they go on to do other things/