To get the hor/vert position of the virtual view inside the physical view you can use Canvas_GetView (and counterpart Canvas_SetView) like the following:
local WidthVar as Long
local HeightVar as Long
...
Canvas_GetView WidthVar, HeightVar
Not sure which events are triggered when user move scrollbars
I need to make some search, anyway here an example: as you can see there are many events.
Uses "UI"
uses "console"
Begin ControlID
%ID_Canvas
End ControlID
Function TBMain() As Long
Local hDlg As DWord '---Used to store window handle of main dialog
hDlg = Dialog_New Pixels, 0, "ABC ", -1, -1, 1200, 775,
%WS_DLGFRAME |
%DS_CENTER |
%WS_CAPTION |
%WS_SYSMENU |
%WS_OVERLAPPEDWINDOW
Dialog Show Modal hDlg, Call cbDialog
End Function
CallBack Function cbDialog() As Long
local WidthVar as Long
local HeightVar as Long
Select Case CBMSG
Case %WM_INITDIALOG
Control Add Canvas, CBHNDL, %ID_Canvas, "", 200, 10,1000, 400, %WS_BORDER | %WS_CHILD | %WS_VISIBLE
Canvas_Attach(CBHNDL, %ID_Canvas, %FALSE)
Canvas_SetVirtual(100000, 380)
Canvas_SetView(0,0)
Canvas_Width(2)
case %WM_MOUSEMOVE
case Else
printl " Msg", cbmsg, CBCTL, CBLPARAM, CBLPARAM
Canvas_GetView WidthVar, HeightVar
printl "GetView", WidthVar, HeightVar
End Select
End Function
Bookmarks