Discussion:
deprecated style byte indicators and hotspots
(too old to reply)
Stefan Küng
2014-07-05 13:07:52 UTC
Permalink
I've used style byte indicators as a way to mark certain text (e.g. hyperlinks) as clickable. I wanted to keep the styling of the lexer for the text but only mark it as a hotspot, which I could do by first reading the original style and its attributes, then creating a new style with the same attributes and the hotspot bit set.

Now that style byte indicators are no longer working I'm using the standard indicators. Problem is, there's no way (that I can see) to mark a standard indicator as a hotspot.

I'm currently adding a custom indicator to those texts using INDIC_PLAIN, then checking in a WM_SETCURSOR handler whether to change the cursor.
btw: there's no define for SC_CURSORHAND, but passing '8' to SCI_SETCURSOR works fine.

Still, this isn't the same as before: the underline is always shown.

Is there a better way to do this that I've missed?

Or if I may ask for a new feature:
Allowing to set an INDIC-style as a hotspot and have the SCI_SETHOTSPOTACTIVExxxx work for those as well.
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Neil Hodgson
2014-07-06 00:26:55 UTC
Permalink
Post by Stefan Küng
I'm currently adding a custom indicator to those texts using INDIC_PLAIN, then checking in a WM_SETCURSOR handler whether to change the cursor.
btw: there's no define for SC_CURSORHAND, but passing '8' to SCI_SETCURSOR works fine.
The cursor code platform-dependent and tries to hide some of the complexity. Cursor choices are limited by area and mode. Values not described in the documentation may not work or may work differently on different platforms.
Post by Stefan Küng
Still, this isn't the same as before: the underline is always shown.
Is there a better way to do this that I've missed?
Depends on platform with processing of WM_MOUSEMOVE by a subclass of Scintilla possible on Win32. You could set up cursor rectangles for the visible hotspot ranges and detect entry/exit, adding an indicator when moving into a range but that would be more work.
Post by Stefan Küng
Allowing to set an INDIC-style as a hotspot and have the SCI_SETHOTSPOTACTIVExxxx work for those as well.
That would be a reasonable addition if anyone is interested in implementing it. There should be a clear decision on how to handle multiple overlapping hotspots from both the indicator(s) and hotspot style, possibly saying that only one can be active at a time. May want to have a hotspot attribute for an indicator rather than tying it to a style.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Stefan Küng
2014-07-06 12:34:28 UTC
Permalink
Post by Stefan Küng
Post by Stefan Küng
I'm currently adding a custom indicator to those texts using
INDIC_PLAIN, then checking in a WM_SETCURSOR handler whether to change the
cursor.
Post by Stefan Küng
btw: there's no define for SC_CURSORHAND, but passing '8' to
SCI_SETCURSOR works fine.
The cursor code platform-dependent and tries to hide some of the
complexity. Cursor choices are limited by area and mode. Values not
described in the documentation may not work or may work differently on
different platforms.
I'm aware of that. And usually I don't use undocumented features, but in
this case it's necessary: Just setting the cursor manually in the
WM_SETCURSOR handler does not work because Scintilla re-sets the cursor
immediately, which leads to the cursor flashing back and forth between the
hand and the default cursor.
Post by Stefan Küng
Post by Stefan Küng
Still, this isn't the same as before: the underline is always shown.
Is there a better way to do this that I've missed?
Depends on platform with processing of WM_MOUSEMOVE by a subclass of
Scintilla possible on Win32. You could set up cursor rectangles for the
visible hotspot ranges and detect entry/exit, adding an indicator when
moving into a range but that would be more work.
I think I found a way:
* Using two instead of just one custom INDIC: one using INDIC_HIDDEN, the
other the INDIC_PLAIN. All urls are pre-set with the hidden indic.
* handle the WM_SETCURSOR message (need that to change the cursor to the
hand anyway).
* If the cursor is over the custom url INDIC, change the cursor.
* Then I find the start and end of the INDIC range and add the custom INDIC
which shows the underline.
* if the cursor is not over an url, clear the doc from the indic with the
underline

this seems to work fine. Still need to do some more testing but I think
this is the way to go.
Post by Stefan Küng
Post by Stefan Küng
Allowing to set an INDIC-style as a hotspot and have the
SCI_SETHOTSPOTACTIVExxxx work for those as well.
That would be a reasonable addition if anyone is interested in
implementing it. There should be a clear decision on how to handle multiple
overlapping hotspots from both the indicator(s) and hotspot style, possibly
saying that only one can be active at a time. May want to have a hotspot
attribute for an indicator rather than tying it to a style.
Or: how about new indic style INDIC_PLAINHOT which shows an underline but
only if the cursor is over it and is hidden otherwise?
Or to make this more general: instead of adding a new style, allow to set
any existing indic as 'hot active' meaning it's only shown/visible if the
cursor is over it.

Stefan
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...