Thread View: adobe.indesign.sdk
2 messages
2 total messages
Started by Hans Stoessel
Mon, 23 Mar 2009 15:31
CS3 / Win: Lock an anchored text frame
Author: Hans Stoessel
Date: Mon, 23 Mar 2009 15:31
Date: Mon, 23 Mar 2009 15:31
37 lines
1682 bytes
1682 bytes
Hi
I lock frames using the following code (snippet):
...
InterfacePtr<ICommand> ipSetStoryLockStateCmd(CmdUtils::CreateCommand(kSetItemLockDataCmdBoss));
InterfacePtr<IBoolData> ipLockData(ipSetStoryLockStateCmd, IID_IBOOLDATA);
// ipTextModel - >this is an interface <ITextModel>
InterfacePtr<IItemLockData> ipTextLockData(ipTextModel, UseDefaultIID());
if(ipTextLockData == nil)
{
break;
}
// set the command data
if (ipTextLockData->GetInsertLock()) {
ipLockData->Set(kFalse); // unlock
} else {
ipLockData->Set(kTrue); // lock
}
ipSetStoryLockStateCmd->SetItemList(UIDList(ipTextModel));
if (CmdUtils::ProcessCommand(ipSetStoryLockStateCmd) != kSuccess)
{
ASSERT_FAIL("SetStoryLockStateCmd failed");
break;
}
...
This works if the TextModel is in a text frame is not anchored. If the text frame is anchored the TextModel is never locked and the user can input some text.
- Is is possible to look anchored text frames?
- What is wrong?
- How can I lock the input in a text frame or text model?
Thanks for an answer.
Hans
Re: CS3 / Win: Lock an anchored text frame
Author: toan.nguyen
Date: Thu, 08 Nov 2012 03:22
Date: Thu, 08 Nov 2012 03:22
42 lines
2651 bytes
2651 bytes
On Monday, March 23, 2009 10:31:29 PM UTC+7, hstoess...@pm-medici.ch wrote:
> Hi
>
> I lock frames using the following code (snippet):
>
> ...
> InterfacePtr<ICommand> ipSetStoryLockStateCmd(CmdUtils::CreateCommand(kSetItemLockDataCmdBoss));
> InterfacePtr<IBoolData> ipLockData(ipSetStoryLockStateCmd, IID_IBOOLDATA);
> // ipTextModel - >this is an interface <ITextModel>
> InterfacePtr<IItemLockData> ipTextLockData(ipTextModel, UseDefaultIID());
> if(ipTextLockData == nil)
> {
> break;
> }
>
> // set the command data
> if (ipTextLockData->GetInsertLock()) {
> ipLockData->Set(kFalse); // unlock
> } else {
> ipLockData->Set(kTrue); // lock
> }
> ipSetStoryLockStateCmd->SetItemList(UIDList(ipTextModel));
> if (CmdUtils::ProcessCommand(ipSetStoryLockStateCmd) != kSuccess)
> {
> ASSERT_FAIL("SetStoryLockStateCmd failed");
> break;
> }
> ...
>
> This works if the TextModel is in a text frame is not anchored. If the text frame is anchored the TextModel is never locked and the user can input some text.
>
> - Is is possible to look anchored text frames?
> - What is wrong?
> - How can I lock the input in a text frame or text model?
>
> Thanks for an answer.
>
> Hans
if you want to lock which user can not to edit you can use following code:
ipTextLockData->SetInsertLock(kTrue); // lock
ipTextLockData->SetAttributeLock(kTrue); // lock
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads