4D Write Pro equiv to WR LOCK DOCUMENT

Greetings,

My organization is beginning the final conversion of our old database to full 64bit with v18. One feature we definitely need is a way to lock a 4D WP document. I’m not talking about “Freeze Expressions”, I’m talking about locking the document such that it cannot be edited.

The documentation for “Importing 4D Write documents” has a list of properties that will be recovered from a 4D Write document. For the lock it specifically says:

Locked Not available (use read-only object property)

I’m not concerned with determining whether the old document was locked, there are mechanisms in place that allow us to know whether a lock is appropriate. What I need to know is how to get back to that locked state. I’ve dug all around API and haven’t found anything promising, the toolbar that comes standard in v18 does not have an obvious locking mechanism, and I can’t help but feel I’m missing something obvious.

So the question is: How do I lock a 4D Write Pro document to prevent all edits?

Hey,

You may try this code (but keep it secret!)

<code 4D>
OBJECT SET ENTERABLE(*;“WParea”;$B_RW)
</code 4D>

I was wondering if it was necessary to go down this path. The trick is that the toolbar still allows one to modify a document even if the document interface is disabled. I’m thinking I’ll create a cut-down toolbar that only has allowed actions, and hide it behind the 4D toolbar. Then I’ll hide the 4D toolbar in addition to disabling the edit area, and the cut-down toolbar will appear because of the z-order.

Not optimal, but not bad.

A feature request to “protect” (=lock) parts of a document for editing is already existing, development has started and should be available later this year.

That is excellent news - thank you very much for the update.

Setting the 4DWP area to disabled is only partially successful, as there are a number of buttons on the toolbar that still alter the content. The path I’m currently going down is to place an image behind the toolbar that looks exactly the same as a disabled toolbar with only the print icons enabled.

I’ll probably swap that out for your no-doubt-much-better-version with the upgrade to v19, since it’s unlikely I’ll be able to use the R releases in production.

Thank you again.

I marked this as resolved, and so far as I am concerned it is resolved, but there is another point:

The print icon on the toolbar - it is a little disconcerting that it immediately sends the print job to the “default” printer, at least in Windows. It took me the longest time to figure out why my computer kept trying to save the print job as a .xpsx file. Turns out my Windows was deciding for itself which printer is “best”, and it’s decision was to use a printer on my home network that is only accessible under highly extraordinary circumstances. Windows fallback decision was to save a file meant for the XPS viewer - that I don’t have because Windows no longer comes with XPS.

That is all on Windows, no fault to 4D at all. However, if the button were to start with “PRINT SETTINGS” instead of going straight to “WP PRINT” (or whatever exact call you use), then it would be much more in line with the flow of most other applications.

I can’t think of a single other instance where clicking the print button makes a sheet of paper come out immediately without so much as an “are you sure?”

: Chris PARKER

I’ll probably swap that out for your no-doubt-much-better-version
with the upgrade to v19, since it’s unlikely I’ll be able to use the
R releases in production.

https://us.4d.com/product-release-life-cycleOnly two years from now>… :twisted: