Can't get new set/get lexer to work

35 views
Skip to first unread message

topwizpr...@gmail.com

unread,
Jun 24, 2022, 5:24:01 PM6/24/22
to scintilla-interest
I'm updating my app from 4.2 to 5.2.3. It is written in PowerBuilder which is similar to VB6 in how it interacts with DLL files.

I've got everything working except Get/Set Lexer & Get Language.

External function declaration for messages with two numeric arguments:

Function long SciSend ( longptr hSciWnd, ulong iMessage, &
    longptr wParam, Ref longptr lParam &
    ) Library "Scintilla.dll" Alias For "Scintilla_DirectFunction"

This always returns zero:
ll_lexer = SciSend(ip_hSciWnd, SCI_GETLEXER, 0, unused)

This always returns zero:
newlexer = SCLEX_SQL
ll_return = SciSend(ip_hSciWnd, SCI_SETILEXER, 0, newlexer)

This aborts:
ll_lexer = SciSend(ip_hSciWnd, SCI_GETLEXER, 0, unused)

Neil Hodgson

unread,
Jun 24, 2022, 6:33:03 PM6/24/22
to Scintilla mailing list
topwizpr…@gmail.com:

This always returns zero:
newlexer = SCLEX_SQL
ll_return = SciSend(ip_hSciWnd, SCI_SETILEXER, 0, newlexer)

   SCI_SETILEXER takes a pointer to a lexer, not a lexer ID number.

   Scintilla 5 moved lexer features into a new project and DLL: Lexilla. You will need to load the Lexilla DLL and ask it for a lexer then pass the result to SCI_SETILEXER.

   Migrating to Scintilla 5 and Lexilla is documented at
https://scintilla.org/Scintilla5Migration.html

   Neil

topwizpr...@gmail.com

unread,
Jun 24, 2022, 8:42:44 PM6/24/22
to scintilla-interest
I have it working now, thanks!

What are the return values for Scintilla_DirectFunction? I have only seen zero. What is returned if the action fails?

Neil Hodgson

unread,
Jun 24, 2022, 9:53:09 PM6/24/22
to Scintilla mailing list
topwizpr…@gmail.com:

> What are the return values for Scintilla_DirectFunction? I have only seen zero. What is returned if the action fails?

The return value depends on the API - sometimes its an integer value, sometimes its a pointer, and other times its nothing.

If an action fails the status code may be set, which can be retrieved with SCI_GETSTATUS. There is also a function pointer that can be used to perform an action and retrieve the status code in one call.

https://scintilla.org/ScintillaDoc.html#SCI_GETSTATUS
https://scintilla.org/ScintillaDoc.html#SCI_GETDIRECTSTATUSFUNCTION

Neil

Reply all
Reply to author
Forward
0 new messages