Problem : #EM_LINESCROLL Stopped working ?
Posted: Sun Apr 28, 2024 5:56 pm
TIA !
Problem : #EM_LINESCROLL Stopped working ?
Click on Output_Editor line
should cause Input_Editor to #EM_LINESCROLL to same line .
Stops working after 1st Click .
Is there Reset or
something that needs to be done after #EM_LINESCROLL ?
Problem : #EM_LINESCROLL Stopped working ?
Click on Output_Editor line
should cause Input_Editor to #EM_LINESCROLL to same line .
Stops working after 1st Click .
Is there Reset or
something that needs to be done after #EM_LINESCROLL ?
Code: Select all
;
OpenWindow(0, 0, 50, 1372, 904, "Search-Study 1.0", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
Input_Editor = EditorGadget(#PB_Any, 10, 70, 1030, 60)
GadgetToolTip(Input_Editor , "Contains All text Lines from 'File Opened' ." )
AddGadgetItem(Input_Editor, -1 , "1 1 The Pilgrim's Progress")
AddGadgetItem(Input_Editor, -1 , "2 2 by John Bunyan")
AddGadgetItem(Input_Editor, -1 , "3 3 Table of Contents")
AddGadgetItem(Input_Editor, -1 , "4 4 1. The City of Destruction")
AddGadgetItem(Input_Editor, -1 , "5 5 2. Obstinate And Pliable")
AddGadgetItem(Input_Editor, -1 , "6 6 3. The Swamp of Despond")
AddGadgetItem(Input_Editor, -1 , "7 4. Mr. Worldly Wiseman")
AddGadgetItem(Input_Editor, -1 , "8 5. The Narrow Gate")
AddGadgetItem(Input_Editor, -1 , "9 6. The House of the Interpreter")
AddGadgetItem(Input_Editor, -1 , "10 7. The Cross")
Output_Editor = ListViewGadget(#PB_Any, 10, 150, 1030, 60)
GadgetToolTip(Output_Editor , "Click on a Line to Find/Show the 'Line in Context' From Above.")
AddGadgetItem(Output_Editor, -1 , "1 1 The Pilgrim's Progress")
AddGadgetItem(Output_Editor, -1 , "2 2 by John Bunyan")
AddGadgetItem(Output_Editor, -1 , "3 3 Table of Contents")
AddGadgetItem(Output_Editor, -1 , "4 4 1. The City of Destruction")
AddGadgetItem(Output_Editor, -1 , "5 2. Obstinate And Pliable")
AddGadgetItem(Output_Editor, -1 , "6 3. The Swamp of Despond")
AddGadgetItem(Output_Editor, -1 , "7 4. Mr. Worldly Wiseman")
AddGadgetItem(Output_Editor, -1 , "8 5. The Narrow Gate")
AddGadgetItem(Output_Editor, -1 , "9 6. The House of the Interpreter")
AddGadgetItem(Output_Editor, -1 , "10 7. The Cross")
;- Event_Loop
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
; MessageRequester("Case #PB_Event_Gadget" , "Case #PB_Event_Gadget")
Select EventGadget()
;- Case Output_Editor
Case Output_Editor ; Click on Output_Editor LINE to Position Editor_Input at Same Line .
; Debug "Output_Editor"
; numberVal = 0
If EventGadget() = Output_Editor And EventType() = #PB_EventType_LeftClick ; Check for left click on the ListView
; Get the selected item index
selectedItem = GetGadgetState(Output_Editor) ; Assuming Output_Editor is the ID of the ListView
If selectedItem <> -1
; Fetch the text of the selected item
; Output_Editor is a ListViewGadgetthe first item in a ListViewGadget is 0.
itemText$ = GetGadgetItemText(Output_Editor, 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)
numberVal = Val(number$) - 1 ; adjust for ListView index starts at 0
;- SendMessage
Debug "============" +#CRLF$+
"itemText$ = " + itemText$ +#CRLF$+
"spacePosition = " + Str(spacePosition) +#CRLF$+
"number$ = " + number$ +#CRLF$+
"numberVal = " + Str(numberVal) ; +#CRLF$+
; InputEditor is an EditorGadget, lines are counted starting from 1.
SendMessage_(GadgetID(Input_Editor), #EM_LINESCROLL, 0, numberVal)
SetGadgetState(Input_Editor,numberVal)
EndIf
EndIf
EndIf
; End of Case Output_Editor
EndSelect
EndSelect
Until WaitWindowEvent()=#PB_Event_CloseWindow