Page 1 of 1
Scintilla GETLINE
Posted: Mon Sep 30, 2024 3:38 pm
by rndrei
How to find out the current line number where the cursor is located? This does not work:
Code: Select all
ScintillaSendMessage(#Sc, #SCI_GETLINE))
ScintillaSendMessage(#Sc, #SCI_GETCURLINE))
Re: Scintilla GETLINE
Posted: Mon Sep 30, 2024 4:15 pm
by infratec
Re: Scintilla GETLINE
Posted: Mon Sep 30, 2024 4:59 pm
by AZJIO
Re: Scintilla GETLINE
Posted: Mon Sep 30, 2024 5:21 pm
by rndrei
figured out how to find the current line number
Code: Select all
line_number=ScintillaSendMessage(#Sc, #SCI_LINEFROMPOSITION,ScintillaSendMessage(#Sc, #SCI_GETCURRENTPOS ))
But now I can't figure out how to find the current position in the current line?
Yes! ru:)
Re: Scintilla GETLINE
Posted: Mon Sep 30, 2024 6:27 pm
by infratec
Re: Scintilla GETLINE
Posted: Mon Sep 30, 2024 6:50 pm
by Piero
AZJIO wrote: Mon Sep 30, 2024 4:59 pm
ru?
mac?
Re: Scintilla GETLINE
Posted: Mon Sep 30, 2024 7:05 pm
by rndrei
Re: Scintilla GETLINE
Posted: Mon Sep 30, 2024 7:19 pm
by Piero
rndrei wrote: Mon Sep 30, 2024 7:05 pm
Linux
Very well!
Anyway that's a joke between me and AZJIO; I admire his work, so I'm trying to convince him to also GET A MAC

Re: Scintilla GETLINE
Posted: Mon Sep 30, 2024 8:27 pm
by infratec
Code: Select all
EnableExplicit
Procedure ScintillaCallBack(Gadget, *scinotify.SCNotification)
If *scinotify\updated
PostEvent(#PB_Event_Gadget, 0, Gadget, #PB_EventType_Change)
EndIf
EndProcedure
Define.i Event, CurrentPos, Row, Col, Length
If OpenWindow(0, 0, 0, 330, 200, "ScintillaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ScintillaGadget(0, 10, 10, 310, 160, @ScintillaCallBack())
ScintillaSendMessage(0, #SCI_STYLESETFORE, 0, RGB(255, 0, 0))
CreateStatusBar(0, WindowID(0))
AddStatusBarField(100)
SetActiveGadget(0)
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
If EventGadget() = 0
If EventType() = #PB_EventType_Change
CurrentPos = ScintillaSendMessage(0, #SCI_GETCURRENTPOS)
Row = ScintillaSendMessage(0, #SCI_LINEFROMPOSITION, CurrentPos)
Col = CurrentPos - ScintillaSendMessage(0, #SCI_POSITIONFROMLINE, Row)
Length = ScintillaSendMessage(0, #SCI_GETLENGTH)
StatusBarText(0, 0, Str(Row + 1) + " : " + Str(Col + 1) + " (" + Str(CurrentPos) + ") / [" + Str(Length) + "]", #PB_StatusBar_Center)
EndIf
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
Re: Scintilla GETLINE
Posted: Tue Oct 01, 2024 3:47 pm
by rndrei
thank's! it's work!