June 27, 2023
How to lock / unlock TOC navigation with JS ?
Comments
(6)
June 27, 2023
How to lock / unlock TOC navigation with JS ?
Followers: 0 people
(6)

Hi,

I need to be able to lock / unlock TOC navigation when user clicked on key.
I can use JS code by I don’t find how set TOC navigation by JS and no with editor.

Thanks for your help.

6 Comments
2023-07-05 09:08:27
2023-07-05 09:08:27

To lock/unlock the Table of Contents (TOC) navigation when a user clicks on a key, you can use JavaScript code. However, it seems like you’re looking for a way to set the TOC navigation using JavaScript and not through the editor.

Could you please provide more details about the editor you are using and the specific issue you are facing? That way, I can better assist you with finding a suitable solution.

Thanks for reaching out, and I’m here to help!

Like
()
2023-06-28 09:49:10
2023-06-28 09:49:10

Thanks ! Right, just simple 🙂

Like
()
(3)
>
quentinb77
's comment
2023-06-28 09:53:20
2023-06-28 09:53:20
>
quentinb77
's comment

You got me smiling for two reasons. First you graciously accepted my simple solution, which is rare for users obsessed with JS code. Secondly it is also rare to get an answer being acknowledged in this community. Most users drop a question and never look back…

Do you know that you can mark an answer as being ‘correct’. That happens even less than my two previous statements. You made my day already, be sure.

Like
()
>
Lieve Weymeis
's comment
2023-06-28 12:43:48
2023-06-28 12:43:48
>
Lieve Weymeis
's comment

Even more surprising to me is that we actually have several responses to this thread in such short time. Many times I try to comment and it never appears or I have to wait several days for it to show up. Makes it tough to have a conversation at all.

So… thought I would try to comment on this just for the sake of satisfying the curiosity of the initial question

On the JS side – we just need to set the value

0-enabled

1-disabled

cpLockTOC=1;  //This will disable navigation via TOC

cpLockTOC=0; //This will enable navigation via TOC

Like
(1)
>
Lieve Weymeis
's comment
2023-06-28 14:24:51
2023-06-28 14:24:51
>
Lieve Weymeis
's comment

Thank Lieve for your simple answer, I marked Greg’s answer cause I always need this JS tips 😉

Like
()
2023-06-28 08:33:45
2023-06-28 08:33:45

Why not use a ‘simple’ or a conditional action since you have direct access to the system variable cpLockTOC? Identify the ‘key’ as shortcut key for an invisible button (like a shape button with Alpha and Stroke set to 0). If you use the same key to lock/unlock the action is rather simple:

Toggle cpLockTOC

Maybe too simple? Why make it simple when it can be complicated 😉

 

 

Like
()
Add Comment