Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DAY 012: _MOUSEMOVE
#1
This is one of those keywords of the day that Steve(tm) personally thinks is written poorly.   Sure, it works, but in my opinion, it works backwards half the time.  Let me explain in a moment, after I get the basics out of the way:

What is it? _Mousemove is simply a command to move the mouse cursor across your screen.  It's not hard to figure out what this one does.  Smile

How does on use it? Simply add in a command for _MOUSEMOVE (x, y), and move that mouse cursor where you want it to go.



Now, why do it personally think it's poorly written?

Code: (Select All)
For y = 1 To _Height
    For x = 1 To _Width
        Locate y, x: Print "ð";
        _MouseMove x, y
        _Limit 80
    Next
Next
Sleep


In the code above, we're using _MOUSEMOVE with a SCREEN 0 text screen.  _MOUSEMOVE here is moving by character position -- but if you look closely at the code above, you'll see that we're locating y, x and mousemoving x, y.  In my opinion, if you're going to have a set coordinate system for a certain screen mode, then you need to stick to that existing coordinate system!  

It's just a PITA to have to remember to swap over from row, column coordinates to width, height coordinates.  Honestly, I think this may have been some sort of oversight when the code was originally written, but it's too late to change it now.  Who knows how much old code might be broken by the swap?   For better or worse, _MOUSEMOVE now will always run in width, height coordinates -- even in SCREEN 0 screens where we normally think in terms of row, column.

Be aware of this backwards coordinate system and don't like it bit you on the hiney, if you're ever coding in SCREEN 0.  It's just one small aspect of an otherwise simple command to always keep in the back of your mind when working with it.  Wink
Reply


Messages In This Thread
DAY 012: _MOUSEMOVE - by SMcNeill - 11-17-2022, 11:08 PM
RE: DAY 012: _MOUSEMOVE - by mnrvovrfc - 11-17-2022, 11:19 PM
RE: DAY 012: _MOUSEMOVE - by PhilOfPerth - 11-17-2022, 11:21 PM
RE: DAY 012: _MOUSEMOVE - by mnrvovrfc - 11-17-2022, 11:23 PM
RE: DAY 012: _MOUSEMOVE - by Pete - 11-17-2022, 11:25 PM
RE: DAY 012: _MOUSEMOVE - by SMcNeill - 11-18-2022, 12:15 AM
RE: DAY 012: _MOUSEMOVE - by mnrvovrfc - 11-17-2022, 11:36 PM
RE: DAY 012: _MOUSEMOVE - by Pete - 11-18-2022, 01:35 AM



Users browsing this thread: 3 Guest(s)