How to Scroll (Editor_Input = EditorGadget) to Line x ?
The following code Runs fine , Except it doesn't Scroll Editor_Input .
Code: Select all
Case Editor_Output
;Global Editor_Input , Editor_Output , HelpButton ,
; itemText$ , selectedItem , event = 0 , spacePosition , number$ ,
; Editor_Input_LineNumber = 0
If EventGadget() = Editor_Output And EventType() = #PB_EventType_LeftClick ; Check for left click on the ListView
; Get the selected item index
selectedItem = GetGadgetState(Editor_Output) ; Assuming Editor_Output is the ID of the ListView
If selectedItem <> -1
; Fetch the text of the selected item
itemText$ = GetGadgetItemText(Editor_Output, selectedItem)
; Find the position of the first space
spacePosition = FindString(itemText$, " ", 0)
If spacePosition <> 0
; Extract the number before the first space
number$ = Left(itemText$, spacePosition - 1)
; Convert string number to integer
Editor_Input_LineNumber = Val(number$) - 1 ; Convert to zero-based index if needed
; Scroll to the line in the Editor_Input gadget
SetGadgetState(Editor_Input, Editor_Input_LineNumber)
MessageRequester("Event Detected", "Left click on ListView detected on item #" + Str(selectedItem) + " - Number: " + number$ + " (" + itemText$ + ")")
EndIf
EndIf
EndIf