Neil Hodgson
unread,Apr 5, 2017, 3:39:48 AM4/5/17Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Scintilla mailing list
A feature that has been requested is a notification when the selection changes in an autocompletion list. One reason for this feature is for the application to display a documentation popup for the currently selected item.
Attached is a potential implementation of this feature. There are 2 parts: a new mechanism to send events from the platform’s list box code to the generic Scintilla code; and a SCN_AUTOCSELECTIONCHANGE notification from Scintilla to the application. The SCN_AUTOCSELECTIONCHANGE carries the text of the currently selected item.
This change requires implementation in each platform layer with a patch-size of around 90 lines. See, for example, the PlatWin.cxx section of the attached patch.
The mechanism used between the platform layer and ScintillaBase is quite extendible so it should not break compatibility with platform layers again if a new notification is required or some more data such as whether the user clicked on the text or the icon. Platform layers that want to support new features will, naturally, have work to do but they will still build and run without changes.
A new interface IListBoxDelegate is defined in Platform.h and implemented by ScintillaBase. Platform list boxes will call this delegate for any events. Its argument is a ListBoxEvent which currently contains a value of an EventType enumeration containing selectionChange or doubleClick. Future events (for example a ‘hover’) may extend the enumeration. Extra data fields may be added to ListBoxEvent. The platform’s ListBox implementation provides a SetDelegate method to set this up.
Thus, the current SetDoubleClickAction is removed and replaced with SetDelegate. While a higher degree of compatibility could be maintained (such as leaving SetDoubleClickAction in ListBox) that would increase complexity and does not seem warranted.
Neil