Just stick it into GoScintilla.pbi to use it.
Returns the word currently hovered over by the cursor, which can be used for F1-> contextual help, or whatever. If you're writing an IDE, this can be used to get help on commands.
Usage:
word$ = GOSCI_GetHoverText(id)
Code: Select all
;/////////////////////////////////////////////////////////////////////////////////
;The following function returns the word currently under the cursor.
Procedure.s GOSCI_GetHoverText(id)
Protected text$
If IsGadget(id) And GadgetType(id) = #PB_GadgetType_Scintilla
curPos = ScintillaSendMessage(id, #SCI_GETCURRENTPOS)
linePos = ScintillaSendMessage(id, #SCI_LINEFROMPOSITION,curPos)
colPos = ScintillaSendMessage(id, #SCI_GETCOLUMN,curPos)
text$=GOSCI_GetLineText(id, linePos)
word$=""
;get the start of the word
colPos=colPos+1
stPos.i=1
nonalpha.i=0
For a.i=colPos To 1 Step-1
m.c=Asc(Mid(text$,a.i,1))
Select m.c
Case 'a' To 'z', 'A' To 'Z'
If nonalpha.i=0
stPos.i=a.i
EndIf
Default
nonalpha.i=1
EndSelect
Next
;get word
For a.i=stPos.i To Len(text$)
m.c=Asc(Mid(text$,a.i,1))
Select m.c
Case 'a' To 'z', 'A' To 'Z'
word$=word$+Chr(m.c)
Default
If Trim(word$)<>""
ProcedureReturn word$
EndIf
EndSelect
Next
EndIf
ProcedureReturn word$
EndProcedure
;/////////////////////////////////////////////////////////////////////////////////