[SOLVED] Synchronize two gadgets

Just starting out? Need help? Post your questions and find answers here.
Maitre_Kanter
User
User
Posts: 84
Joined: Mon Sep 06, 2010 3:05 pm

[SOLVED] Synchronize two gadgets

Post 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
Last edited by Maitre_Kanter on Fri Apr 17, 2020 9:26 pm, edited 1 time in total.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Synchronize two gadgets

Post by IdeasVacuum »

Not the specific solution you need but interesting:
https://www.purebasic.fr/english/viewto ... 41&start=0
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
wombats
Enthusiast
Enthusiast
Posts: 716
Joined: Thu Dec 29, 2011 5:03 pm

Re: Synchronize two gadgets

Post 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
Maitre_Kanter
User
User
Posts: 84
Joined: Mon Sep 06, 2010 3:05 pm

Re: Synchronize two gadgets

Post by Maitre_Kanter »

Thank you very much !

Amazing !!!! Youpi !

Kanter
Post Reply