ReneMiner
03-10-2021, 18:05
There are already events function names, when i read in helpfile it's filtered and delegates the event according to the message to the dialog or control,
in the most simple case just to <objname>_OnCallback.
Now there are a few, i pick "_OnMouseMove" for the moment to think about. I read that i need to use wparam, lparam to obtain the position.
MOUSE MOVE : the position is the essential cause for the fact that event happened.
I would not mind if i had there were a generic mouse-info or even just the parameters when i write my
Callback Function <objname>_OnMouse<something>(Byval lX as Long,
Byval lY as Long,
byval Mousestate as Long,
byval shiftKeystate as Long ) As Long
' lx and ly : obvious - the mouse position within the client of the item that is refered to in CBHNDL.
' Mousestate: we have usually LMB, RMB and MMB - the numbers 1,2 and 4 for these if pressed applied using logic Or
' in the past the middle mouse button was just = (LMB And RMB) : 3 - i am not sure if it still is that way...
' when it's about mouse the information about buttons is required, also the wheel - that was not invented at the time
' the mousebuttons received these numbers....
' wheel can either turn or not turn 8
' wheel can turn backward(down): 16 or not turn backward but if it turns then it can only be forward
' shiftKeystate : the keyboard has a few keys that - if holding them down causes keys to different output,
' as the shift-, ctrl-, menu- or windows-key. In some apps that have many functions and are mouse-controlled mostly
' the mouse-input turns to something else, for example the wheel will scroll a listvertically, holding CTRL wil cause the wheel to
' change the fonts size (zoomIn & ZoomOut) or holding shift changes scrolling to horizontally. and
If shiftKeyState And %SKS_SHIFT Then
If MouseState And %Mouse_WheelTurned Then
myDialogInViewport.X += MinMax( iif(MouseState And %Mouse_WheelReverseTurn,
- changePerWheeltick,
changeperWheeltick) ,
0,
myDialogInViewport.W - myViewport.cW )
if i am able to find the help-topic about callback _OnMouse<whatever_happened> then i am able to use the syntax that is described there.
When it says:
Syntax:
Callback Function <calledObjectsName>_OnMouseMove( byval CbFunParams as AnyType) As Long
To use this Callback-event you have to provide the following parameters:...String CBFunParams ... then i can do that
...now hack the string...
optional you can write: byval lX as Long, byval lY As Long, lMouseState as Long, lShiftkeyState as Long
? - Why???
... refer to the manual for further information. The Callback-split- and -call-engine will send MKL$(lX, lY, lMS, lKS) and you may
provide an udt of tCallbackMouseParams, four happy long values with funny names or just a string alias Anytype in your function-header.
However you like. It must provide the size to receive all parameters...
String is safe. It will be large enough. name it like
Alias String As CallBackFunctionParams ' "CBFunParams".
From within the function the user wants to get his cbFunParams. I do not like to create an udt for each kind of possible params-mix. Guess you don't neither.
in the most simple case just to <objname>_OnCallback.
Now there are a few, i pick "_OnMouseMove" for the moment to think about. I read that i need to use wparam, lparam to obtain the position.
MOUSE MOVE : the position is the essential cause for the fact that event happened.
I would not mind if i had there were a generic mouse-info or even just the parameters when i write my
Callback Function <objname>_OnMouse<something>(Byval lX as Long,
Byval lY as Long,
byval Mousestate as Long,
byval shiftKeystate as Long ) As Long
' lx and ly : obvious - the mouse position within the client of the item that is refered to in CBHNDL.
' Mousestate: we have usually LMB, RMB and MMB - the numbers 1,2 and 4 for these if pressed applied using logic Or
' in the past the middle mouse button was just = (LMB And RMB) : 3 - i am not sure if it still is that way...
' when it's about mouse the information about buttons is required, also the wheel - that was not invented at the time
' the mousebuttons received these numbers....
' wheel can either turn or not turn 8
' wheel can turn backward(down): 16 or not turn backward but if it turns then it can only be forward
' shiftKeystate : the keyboard has a few keys that - if holding them down causes keys to different output,
' as the shift-, ctrl-, menu- or windows-key. In some apps that have many functions and are mouse-controlled mostly
' the mouse-input turns to something else, for example the wheel will scroll a listvertically, holding CTRL wil cause the wheel to
' change the fonts size (zoomIn & ZoomOut) or holding shift changes scrolling to horizontally. and
If shiftKeyState And %SKS_SHIFT Then
If MouseState And %Mouse_WheelTurned Then
myDialogInViewport.X += MinMax( iif(MouseState And %Mouse_WheelReverseTurn,
- changePerWheeltick,
changeperWheeltick) ,
0,
myDialogInViewport.W - myViewport.cW )
if i am able to find the help-topic about callback _OnMouse<whatever_happened> then i am able to use the syntax that is described there.
When it says:
Syntax:
Callback Function <calledObjectsName>_OnMouseMove( byval CbFunParams as AnyType) As Long
To use this Callback-event you have to provide the following parameters:...String CBFunParams ... then i can do that
...now hack the string...
optional you can write: byval lX as Long, byval lY As Long, lMouseState as Long, lShiftkeyState as Long
? - Why???
... refer to the manual for further information. The Callback-split- and -call-engine will send MKL$(lX, lY, lMS, lKS) and you may
provide an udt of tCallbackMouseParams, four happy long values with funny names or just a string alias Anytype in your function-header.
However you like. It must provide the size to receive all parameters...
String is safe. It will be large enough. name it like
Alias String As CallBackFunctionParams ' "CBFunParams".
From within the function the user wants to get his cbFunParams. I do not like to create an udt for each kind of possible params-mix. Guess you don't neither.