
How Syncronize scroll in two gadgets?
Re: How Syncronize scroll in two gadgets?
Fluid Byte
thank you

Re: How Syncronize scroll in two gadgets?
One more question.
How syncronize scroll in two ScintillaGadget?
Thank you
How syncronize scroll in two ScintillaGadget?
Thank you
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re:
Yes exactely....SROD against NETMAESTRO....incredible....it's so greatchen wrote:Battle at the top![]()


It's the battle of TITANS, like when i was young and buy the "Strange" book

But a kind battle




Not a destination
Re: How Syncronize scroll in two gadgets?
Here is so workspablov wrote: How syncronize scroll in two ScintillaGadget?

Code: Select all
Global hSci0.l, hSci1.l, scroll_0.l, scroll_1.l
Enumeration 0
#Sci0
#Sci1
EndEnumeration
If InitScintilla("Scintilla.dll")=0
MessageRequester("File not found", " File " + Chr(34) + "Scintilla.dll" + Chr(34) + " not found!", #MB_OK|#MB_ICONERROR)
End
EndIf
ProcedureDLL ScintillaCallBack(Gadget, *scinotify.SCNotification)
scroll_0 = ScintillaSendMessage(#Sci0, #SCI_GETFIRSTVISIBLELINE)
scroll_1 = ScintillaSendMessage(#Sci1, #SCI_GETFIRSTVISIBLELINE)
If scroll_0 <> scroll_1
Select *scinotify\nmhdr\HwndFrom
Case hSci0
ScintillaSendMessage(#Sci1, #SCI_LINESCROLL, 0, scroll_0 - scroll_1)
Case hSci1
ScintillaSendMessage(#Sci0, #SCI_LINESCROLL, 0, scroll_1 - scroll_0)
EndSelect
EndIf
EndProcedure
If OpenWindow(0, 200, 10, 400, 470, "Scintilla exemple", #PB_Window_SystemMenu )
If UseGadgetList(WindowID(0))
hSci0 = ScintillaGadget(#Sci0, 0, 0, 400, 227, @ScintillaCallBack())
hSci1 = ScintillaGadget(#Sci1, 0, 234, 400, 227, @ScintillaCallBack())
ScintillaSendMessage(#Sci0,#SCI_SETHSCROLLBAR,0)
ScintillaSendMessage(#Sci1,#SCI_SETHSCROLLBAR,0)
; Set caret line colour
ScintillaSendMessage(#Sci0, #SCI_SETCARETLINEBACK, $eeeeff)
ScintillaSendMessage(#Sci0, #SCI_SETCARETLINEVISIBLE, #True)
ScintillaSendMessage(#Sci1, #SCI_SETCARETLINEBACK, $eeeeff)
ScintillaSendMessage(#Sci1, #SCI_SETCARETLINEVISIBLE, #True)
; Margins
ScintillaSendMessage(#Sci0, #SCI_SETMARGINTYPEN, 0, #SC_MARGIN_NUMBER) ;
ScintillaSendMessage(#Sci0, #SCI_SETMARGINMASKN, 2, #SC_MASK_FOLDERS)
ScintillaSendMessage(#Sci0, #SCI_SETMARGINWIDTHN, 0, 50)
ScintillaSendMessage(#Sci0, #SCI_SETMARGINWIDTHN, 2, 0)
ScintillaSendMessage(#Sci0, #SCI_SETMARGINSENSITIVEN, 2, #True)
ScintillaSendMessage(#Sci1, #SCI_SETMARGINTYPEN, 0, #SC_MARGIN_NUMBER) ;
ScintillaSendMessage(#Sci1, #SCI_SETMARGINMASKN, 2, #SC_MASK_FOLDERS)
ScintillaSendMessage(#Sci1, #SCI_SETMARGINWIDTHN, 0, 50)
ScintillaSendMessage(#Sci1, #SCI_SETMARGINWIDTHN, 2, 0)
ScintillaSendMessage(#Sci1, #SCI_SETMARGINSENSITIVEN, 2, #True)
For i = 1 To 1000
txt.s + Str(i)+Str(i)+Str(i)+Str(i)+Str(i)+Str(i)+#LF$
Next i
ScintillaSendMessage(#Sci0, #SCI_SETTEXT, #Null, @txt)
ScintillaSendMessage(#Sci1, #SCI_SETTEXT, #Null, @txt)
EndIf
EndIf
;{- Event loop
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = 0
CloseWindow(0)
Break
EndIf
EndSelect
ForEver
;}
Re: How Syncronize scroll in two gadgets?
Thanks for this helpful code.pablov wrote:Here is so works![]()

Here is a little update including both - vertical and horizontal synchronization:
Code: Select all
Global hSci0.l, hSci1.l, scroll_0.l, scroll_1.l
Enumeration 0
#Sci0
#Sci1
EndEnumeration
If InitScintilla("Scintilla.dll")=0
MessageRequester("File not found", " File " + Chr(34) + "Scintilla.dll" + Chr(34) + " not found!", #MB_OK|#MB_ICONERROR)
End
EndIf
ProcedureDLL ScintillaCallBack(Gadget, *scinotify.SCNotification)
scroll_0 = ScintillaSendMessage(#Sci0, #SCI_GETFIRSTVISIBLELINE)
scroll_1 = ScintillaSendMessage(#Sci1, #SCI_GETFIRSTVISIBLELINE)
If scroll_0 <> scroll_1
Select *scinotify\nmhdr\HwndFrom
Case hSci0
ScintillaSendMessage(#Sci1, #SCI_LINESCROLL, 0, scroll_0 - scroll_1)
Case hSci1
ScintillaSendMessage(#Sci0, #SCI_LINESCROLL, 0, scroll_1 - scroll_0)
EndSelect
EndIf
xscroll_0 = ScintillaSendMessage(#Sci0, #SCI_GETXOFFSET)
xscroll_1 = ScintillaSendMessage(#Sci1, #SCI_GETXOFFSET)
If xscroll_0 <> xscroll_1
Select *scinotify\nmhdr\HwndFrom
Case hSci0
ScintillaSendMessage(#Sci1, #SCI_SETXOFFSET, xscroll_0)
Case hSci1
ScintillaSendMessage(#Sci0, #SCI_SETXOFFSET, xscroll_1)
EndSelect
EndIf
EndProcedure
If OpenWindow(0, 200, 10, 400, 470, "Scintilla exemple", #PB_Window_SystemMenu )
If UseGadgetList(WindowID(0))
hSci0 = ScintillaGadget(#Sci0, 0, 0, 400, 227, @ScintillaCallBack())
hSci1 = ScintillaGadget(#Sci1, 0, 234, 400, 227, @ScintillaCallBack())
; ScintillaSendMessage(#Sci0,#SCI_SETHSCROLLBAR,0)
; ScintillaSendMessage(#Sci1,#SCI_SETHSCROLLBAR,0)
; Set caret line colour
ScintillaSendMessage(#Sci0, #SCI_SETCARETLINEBACK, $eeeeff)
ScintillaSendMessage(#Sci0, #SCI_SETCARETLINEVISIBLE, #True)
ScintillaSendMessage(#Sci1, #SCI_SETCARETLINEBACK, $eeeeff)
ScintillaSendMessage(#Sci1, #SCI_SETCARETLINEVISIBLE, #True)
; Margins
ScintillaSendMessage(#Sci0, #SCI_SETMARGINTYPEN, 0, #SC_MARGIN_NUMBER) ;
ScintillaSendMessage(#Sci0, #SCI_SETMARGINMASKN, 2, #SC_MASK_FOLDERS)
ScintillaSendMessage(#Sci0, #SCI_SETMARGINWIDTHN, 0, 50)
ScintillaSendMessage(#Sci0, #SCI_SETMARGINWIDTHN, 2, 0)
ScintillaSendMessage(#Sci0, #SCI_SETMARGINSENSITIVEN, 2, #True)
ScintillaSendMessage(#Sci1, #SCI_SETMARGINTYPEN, 0, #SC_MARGIN_NUMBER) ;
ScintillaSendMessage(#Sci1, #SCI_SETMARGINMASKN, 2, #SC_MASK_FOLDERS)
ScintillaSendMessage(#Sci1, #SCI_SETMARGINWIDTHN, 0, 50)
ScintillaSendMessage(#Sci1, #SCI_SETMARGINWIDTHN, 2, 0)
ScintillaSendMessage(#Sci1, #SCI_SETMARGINSENSITIVEN, 2, #True)
For n = 1 To 200
linetxt.s + Chr(n+63)
Next n
For i = 1 To 1000
txt.s + Mid(linetxt,Random(50),100+Random(50))+#LF$
Next i
ScintillaSendMessage(#Sci0, #SCI_SETTEXT, #Null, @txt)
ScintillaSendMessage(#Sci1, #SCI_SETTEXT, #Null, @txt)
EndIf
EndIf
;{- Event loop
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = 0
CloseWindow(0)
Break
EndIf
EndSelect
ForEver
;}
[Dynamic-Dialogs] - create complex GUIs the easy way
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)