Adornment layers in relation to token taggers

SyntaxEditor for WPF Forum

Posted 8 years ago by Nick Beer - National Instruments
Version: 11.1.0545
Avatar
Hello -

I'm having trouble getting an adornment layer behind the text background layer (this is the layer token taggers use, correct?)

I'm registering my adornment like this:
private static AdornmentLayerDefinition _layerDefinition =
    new AdornmentLayerDefinition("CurrentLine",
        new ordering(AdornmentLayerDefinitions.TextBackground.Key, 
            OrderPlacement.Before));
Even though I'm specifying the layer should be before (or should it be after? I've tried both...) the text background layer, my adornment still draws on top of the text background layer.

Am I doing something wrong?

Thanks -

Nick

Comments (4)

Posted 8 years ago by Nick Beer - National Instruments
Avatar
Actually - I should note that I have two adornment managers. If I disable one of them, I'm able to place the other behind the text background layer. (I also found out that it should be 'After' and not 'Before').

I found this post that seems to indicate there could be a bug in the orderings when you have multiple adornment layers. Is it possible that's what I'm running into? Can you think of a workaround? I've tried ordering the adornments against the built in layers, but as soon as I have two adornment layers, I can't get one behind the text background layer.

Thanks -

Nick
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Nick,

Yes I think that's the bug you're running into. I'd recommend doing what was posted in that other thread, where you specify all the known layers that your layers come after. As an instance, we do this for our Text Background layer:
textBackground = new AdornmentLayerDefinition("Text Background",
    new Ordering[] { 
        new Ordering(AdornmentLayerDefinitions.Highlight.Key, OrderPlacement.After),
        new Ordering(AdornmentLayerDefinitions.Selection.Key, OrderPlacement.After),
        new Ordering(AdornmentLayerDefinitions.CollapsedRegion.Key, OrderPlacement.After),
        new Ordering(AdornmentLayerDefinitions.Squiggle.Key, OrderPlacement.After),
        new Ordering(AdornmentLayerDefinitions.TextForeground.Key, OrderPlacement.After),
        new Ordering(AdornmentLayerDefinitions.Caret.Key, OrderPlacement.After),
    });
If you do that sort of thing for your adornment layers, it should work around the issue until it is fixed.


Actipro Software Support

Posted 8 years ago by Nick Beer - National Instruments
Avatar
I've just gotten back to this, and your suggestion worked perfectly. Thank you!
Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Nick,

We've updated our algorithms for orderable sorting so that it works properly, even with a large number of items.  This change will be in the next 2012.2 maintenance release.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.