Page 1 of 1
[SOLVED] Synchronize two gadgets
Posted: Wed Apr 15, 2020 2:51 pm
by Maitre_Kanter
Hello everybody,
I hope you are safe and fine.
I need to synchronize movements (up and down) of two scintillas gadgets (in the same way that Winmerge do the job)
Thank you in advance,
Kanter
Re: Synchronize two gadgets
Posted: Wed Apr 15, 2020 7:03 pm
by IdeasVacuum
Re: Synchronize two gadgets
Posted: Wed Apr 15, 2020 10:24 pm
by wombats
Code: Select all
EnableExplicit
InitScintilla()
Procedure ScintillaCallBack(gadget, *sciNotify.SCNotification)
Protected firstVisible
Select *sciNotify\nmhdr\code
Case #SCN_UPDATEUI
firstVisible = ScintillaSendMessage(gadget, #SCI_GETFIRSTVISIBLELINE)
If gadget = 0
ScintillaSendMessage(1, #SCI_SETFIRSTVISIBLELINE, firstVisible)
Else
ScintillaSendMessage(0, #SCI_SETFIRSTVISIBLELINE, firstVisible)
EndIf
EndSelect
EndProcedure
OpenWindow(0, 0, 0, 770, 480, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ScintillaGadget(0, 0, 0, WindowWidth(0) / 2, WindowHeight(0) - 20, @ScintillaCallback())
ScintillaGadget(1, GadgetX(0) + GadgetWidth(0), 0, WindowWidth(0) / 2, WindowHeight(0) - 20, @ScintillaCallback())
Define i, txt.s, *txt
For i = 1 To 400
txt + "Line " + Str(i) + Chr(10)
Next
*txt = UTF8(txt)
ScintillaSendMessage(0, #SCI_SETTEXT, 0, *txt)
ScintillaSendMessage(1, #SCI_SETTEXT, 0, *txt)
FreeMemory(*txt)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: Synchronize two gadgets
Posted: Fri Apr 17, 2020 9:25 pm
by Maitre_Kanter
Thank you very much !
Amazing !!!! Youpi !
Kanter