Unlock/lock content controls

Modified on Mon, 5 Oct at 1:54 PM

BaseExtensions can be used to suspend a locked content control and locking it again after a set of commands has run. This means, we are able to unlock a locked content control, make some changes and then resume the locking. For instance, there could be a shape in the locked content control in which we want to change the fill color. This shape must be selected and with just one click, the content control is unlocked, the shape color changes and the content control will be locked again.

In this way, this command must be used in conjunction with whatever action that should happen in the content controls.

Module is located here:

Code
...\ModuleLibrary\BaseExtensions\04_nocontext_MISC\12a_W_contentControlLocks.xml

CMDs

Suspend content control locks

This command suspends the lock on the content control that is selected.

<Cmd case="BaseExtensions:SuspendContentControlLocks"/>

Parameter

title

Define the title of the content control. It is possible to insert several content controls. In that case, just separated them with a semicolon. Notice that this parameter is optional. This means, if there is no title defined, the command will suspend the lock of the selected content control.

This supports wildcards for each entry. As an example, a wildcard can be a *.

Example: without wildcards

In this example, no wildcards are used. Hence, only content controls with a title that match exactly will be included in the search.

XML
<Cmd case="BaseExtensions:SuspendContentControlLocks" Title="MyCC1;MyCC2;myCC3;"/>

Example 2: with wildcards

Here, wildcards are in use. Thus, all content controls with a title that starts with MyCC will be included in the search.

XML
<Cmd case="BaseExtensions:SuspendContentControlLocks Title="MyCC*"/>

Resume content control locks

The following command resumes the locks of the content control.

<Cmd case="BaseExtensions:ResumeContentControlLocks"/>

Use the two commands in conjunction with a command that changes the selected content. Here's an example:

XML
<Button label="Suspend Locking">
  <Cmd case="BaseExtensions:SuspendContentControlLocks"/>
  <Cmd case="BaseExtensions:change-fill-color" color="0, 0, 0"/>
  <Cmd case="BaseExtensions:ResumeContentControlLocks"/>
</Button>

When selecting the shape, the content control that contains this shape will be unlocked, the shape color will be changed to black and then the locking of the content control is resumed.

Unlock all content controls

The feature above that unlocks content controls is not able to unlock nested content controls. Thus, two nested locked content controls inside each other will not be unlocked when the command is called.

Therefore, we have created a command that simply removes the locks from all content controls in a document. The command takes no parameters.

<Cmd case="BaseExtensions:UnlockAllContentControls"/>

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article