cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

insert_tag callback not called (on time) on link tags if DLM enabled

naglists
1-Newbie

insert_tag callback not called (on time) on link tags if DLM enabled

Hiya,

Does anyone know of a way to work around this limitation? I want to
suppress a Dynamic Link Manager (DLM) insert link dialog from opening when
a particular element is inserted that I want to manage and not let DLM
manage it.

Although Help says the insert_tag callback will not fire if DLM is enabled,
it does in fact fire, it just fires late (at least for my purposes ...
after I cancel/escape the insert link dialog). Although Help doesn't say
anything about the insert_tag_after callback, this callback does NOT fire
after inserting a link.

I tried both the link and linkto callback and neither fires.

If DLM is disabled, then the insert_tag callback fires before the element
is inserted and the insert_tag_after callback fires after the element is
inserted. This allows me to set requireattrs=off before the element is
inserted so no link dialog opens and set requireattrs=on after the element
is inserted so other elements I am not worried about will launch the modify
attributes dialog on insertion if required attributes exist.

--
Paul Nagai
6 REPLIES 6

Hi Paul--



You might be able to catch this if you take an AOM approach. The AOM has
specific DLM events defined that you should be able to handle. Search
for "Event Types" in the Help Center, and scroll way to the bottom.



--Clay



Clay Helberg

Senior Consultant



TerraXML

1380 Forest Park Circle, Suite 100

Lafayette, CO 80027

Paul,

If I remember correctly (it's been a while), DLM itself uses an insert_tag callback to trigger itself. Have you tried installing your callback with the 'prepend' parameter to see if you can get yours to be fired first?

I just saw Clay's response, and he's right, there may be an answer there. In particular, check out the DLMLinkCreated event. That will fire when DLM instantiates a new link object, but, I think, before the dialog appears. The only problem is that it isn't cancelable, and so might not work for what you want.

Chris

Thanks, Clay. Thanks, Chris.

In package _dcam, function editfilehook() PREPENDs an insert_tag callback.
Even though I prepend, DLM pre-prepends.

Also, in looking at DLM's insert_tag callback function
(_linkdlgmods::insert_tag_cb) itself, I can see that it tests protectdcam.
If off, it does not pop the dialog. So, I'll need to get my editinit ACL to
run last ... gaming the timing to see if I can out-pre-pre-pend. Failing
that, I may have to overwrite _dcam() removing the prepend of DLM's
insert_tag callback. In either case, instead of or in addition to I'll need
to set protectdcam=off.

Any thoughts about getting my editinit acl adding the callback to be the
last callback so my PREPEND wins?



On Wed, Feb 27, 2013 at 12:52 PM, Chris Nitchie <
chris.nitchie@oberontech.com> wrote:

> Paul,
>
> If I remember correctly (it's been a while), DLM itself uses an insert_tag
> callback to trigger itself. Have you tried installing your callback with
> the 'prepend' parameter to see if you can get yours to be fired first?
>
> I just saw Clay's response, and he's right, there may be an answer there.
> In particular, check out the DLMLinkCreated event. That will fire when DLM
> instantiates a new link object, but, I think, before the dialog appears.
> The only problem is that it isn't cancelable, and so might not work for
> what you want.
>
> Chris
>
>

Oh yeah, docname.acl runs lastest. that should do it.


It's kind of evil, but one trick I've used in the past is to prepend my callback from within a timer callback. The Editor is single-threaded, so you can set a timer for 1 nanosecond, and you're guaranteed not to run until the current execution - which will include all the initialization - is finished running.

function run_deferred() {
doc_add_callback(…);
}
timer_add_callback(1, 'run_deferred');

Chris

LOL! A little evil does the trick. Thanks, Chris.


On Wed, Feb 27, 2013 at 1:27 PM, Chris Nitchie <chris.nitchie@oberontech.com<br/>> wrote:

> It's kind of evil, but one trick I've used in the past is to prepend my
> callback from within a timer callback. The Editor is single-threaded, so
> you can set a timer for 1 nanosecond, and you're guaranteed not to run
> until the current execution - which will include all the initialization -
> is finished running.
>
> function run_deferred() {
> doc_add_callback(…);
> }
> timer_add_callback(1, 'run_deferred');
>
> Chris
>
>
Top Tags