Any recommendations on visual substitution?

SyntaxEditor for Windows Forms Forum

Posted 14 years ago by Brad S. - MedAssets, Inc.
Version: 4.0.0282
Avatar
I've got a need to show something friendly in place of something ugly within code. In other words, I need to substitute a piece of code with a friendly label that the user will understand. My SyntaxLanguage parses the code completely and I have a complete AST backing up the SyntaxEditor (in other words, I know exactly what I want to hide, where it is, and what I'd like to show in its place).

For example, the code might look this:

IF isIceCream AND productCode IN $CodeList( "559972e1-2ca4-4162-afa2-fbd145827692" )
    THEN SetError( 115 );
But the user should see this:

IF isIceCream AND productCode IN 'Invalid ice cream product codes'
    THEN SetError( 115 );
Where 'Invalid ice cream product codes' is an uneditable, underlined link that I can hook an event on (and the text may not be as unique as the underlying GUID, so a simple preprocessor isn't sufficient). They could delete it as a whole, but not edit it. When they right click on it, I can show other choices or allow them to replace it with another choice.

I'm not expecting there to be a ready, easy solution for this, but I am hoping that someone might have some suggestions or recommendations. It seems similar to the collapsible/outlining mechanism (visually replace a chunk of text with something else, but the chunk is still there). And there are plenty of highlighting styles and a readonly mechanism and events are easily trapped and so on. It seems like it should be possible, but I'm not sure of the best place to begin my investigation. Any clues?

Thanks,
Brad

Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Brad,

There really isn't anything in SyntaxEditor that lets you swap some text for something else. A collapsed outlining node is about the only thing that comes close to that however it can be expanded by double clicks, etc. Although I do suppose you could handle ViewMouseDown double-clicks over collapsed nodes to prevent them from expanding the node. And also on IOutliningNodeParseData there is an IndicatorVisible property. If you can make that false, then the +/- indicator won't show up in the selection margin either. The net result is that you can have some text that looks is a collapsed node replacing your GUID part.

Hope that helps.


Actipro Software Support

The latest build of this product (v24.1.0) 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.