MouseMove position

eww245

Member
Licensed User
Is there anyway to detect if a MouseMove event is going up or down?

If the first value, moving down, is less than the new value, it would be moving up.

One option is with a Door event to get one property and _MouseMove to get the other.

Another way is calling a Sub from _MouseMove to save the Y position and check the new value against it.

In both situations saving it in a Global var.
The result is always the same value.
MouseUp and MouseDown obviously work, but not with MouseMove.

I just want a ImageButton to show a value based on the Y location and to decrease when moving Up.

.NET "Control.MousePosition.Y" might help, but I expect it would return the same result.

Any Thoughts?
 

agraham

Expert
Licensed User
Longtime User
I'm not sure what your problem is. This works for me
B4X:
Sub Globals
   'Declare the global variables here.
   oldY = 0
End Sub

Sub App_Start
   Form1.Show
End Sub


Sub Form1_MouseMove(x, y)
   oy = oldy
   oldy = y
   If y < oy Then
      Label1.Text = "Going up!"
   Else If y > oy
      Label1.Text = "Going down!"
   Else
      Label1.Text = "Going nowhere!"   
   End If
End Sub
 

eww245

Member
Licensed User
I'm not sure what your problem is. This works for me
B4X:
Sub Globals
   'Declare the global variables here.
   oldY = 0
End Sub

Sub App_Start
   Form1.Show
End Sub


Sub Form1_MouseMove(x, y)
   oy = oldy
   oldy = y
   If y < oy Then
      Label1.Text = "Going up!"
   Else If y > oy
      Label1.Text = "Going down!"
   Else
      Label1.Text = "Going nowhere!"   
   End If
End Sub


Well I missed the oy = oldy
Thanks, it works.

Now another question.

I'm having trouble with args()
The only way a command line seems to work is
B4X:
If ArrayLen(args())=2 then Form1.Show Else msgbox("NoForm")

How can the argument be saved, or read?

B4X:
For.....
   If args(i) = -ShowTheForm then Form1.Show Else msgbox("NoForm")
Next

Index Out Of Range
 
Top