How to have hyperlink-like functionality

SyntaxEditor for WPF Forum

Posted 15 years ago by Gustavo Guerra
Version: 9.1.0503
Avatar
I would like to make my identifier clickable when the control key is pressed, like this:
http://screencast.com/t/Qh9caPW9uZO. Is it possible to do with SytaxEditor?

I tried to reuse the URL inside comments style from the CSharp sample, but without success.

Best Regards,
Gustavo Guerra

Comments (11)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Gustavo,

While you probably could track ctrl+clicks on text and respond accordingly we don't currently have anything that will render URLs as underlined when Ctrl is pressed. We'll add a TODO item to think about this more for the future.


Actipro Software Support

Posted 15 years ago by Gustavo Guerra
Avatar
Is it possible to programmatically change the formatting of a piece of text, and then later revert it to the default?

Best Regards,
Gustavo Guerra
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Gustavo,

Not yet, that is something we will eventually be adding though (it is available in our WinForms version).


Actipro Software Support

Posted 15 years ago by Gustavo Guerra
Avatar
In that case, I can do it with a custom classifier that receives the start and end offsets of the text to underline. I then only need to have a way to force the reevaluation of a classifier. Is there a better way than removing the classifier and then adding it again?

Best Regards,
Gustavo Guerra
Posted 15 years ago by Gustavo Guerra
Avatar
I managed to get this to work, but there's no way to specify the color of the underline. Can this be implemented in an upcoming revision?

Best Regards,
Gustavo Guerra
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Gustavo,

We still need to make improvements in this area. But I believe once the classifier is added to the SyntaxEditor, you can raise its ClassificationChanged event to update the UI.

HighlightingStyle defines an UnderlineBrush you should be able to use.


Actipro Software Support

Posted 15 years ago by Gustavo Guerra
Avatar
When the classifier is removed, its decorations aren't removed. Is it by design or a bug?

Best Regards,
Gustavo Guerra
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Probably is a bug. It would be helpful for us if you put together a sample to show how you are using the classifiers. This would enable us to get some fresh ideas on how to improve their capabilities in the future.

To work around your bug, maybe set some flag on your classifier that "disables" it, then do the classification changed event (but while disabled don't classify anything), and then remove it. That may help.


Actipro Software Support

Posted 15 years ago by Gustavo Guerra
Avatar
Yes, that's what I'm doing now
Posted 10 years ago by Scott Currie
Avatar

A lot of features have been added to SyntaxEditor in the past 5 years.  Is this still the best way to do this?  Or would adornments or some other feature be easiest to manage?

Adornments seem to be a very quick way of finding the items i want to make clickable and adding an underline, but they don't appear to consistently respond to clicks.  That means I would need both the adornment and and IEditorViewMouseInputEventSink, which feels a bit sloppy.

[Modified 10 years ago]

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

Hi Scott,

No there isn't anything new in the area of supporting hyperlinks.  Using classifications/styles is better than adornments because the underlines will truly show up where they should be.  If you use adornments, you have to guess where the underline should appear vertically, which might not always be correct.  And yes, using the IEditorViewMouseInputEventSink would be how you want to watch for and react to mouse input to the editor.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.