Mouse Movement only after Showscreen is called?

Previous topic - Next topic

Moebius

Hello,
I'm not sure if this is the right place to post this, but it seems like a 'bug' to me and none of the other pages seem to really fit this.

It seems that the position of the mouse pointer is only updated when ShowScreen is called.  I'm not sure if this is intentional, but this example demonstrates it.  Hold the left button down to use showscreen.  Run it in debug mode:

Code (glbasic) Select
SYSTEMPOINTER TRUE

mbb = 0
mba = 1

WHILE mbb = 0

DEBUG mx + " " + my + " " + mba + " " + mbb + CHR$(10)

IF mba = 1
SHOWSCREEN
ENDIF

MOUSESTATE mx, my, mba, mbb

WEND

END



In addition, if the pointer is disabled, the cursor wont move while ShowScreen isn't being called.  If you want, you can try the following example.  Again, left click enables ShowScreen.  In this one, note that movement in between turning ShowScreen on and off isn't recognised:

Code (glbasic) Select
SHOWSCREEN

WHILE mbb = 0

MOUSESTATE mx, my, mba, mbb

PRINT mx, 10, 20
PRINT my, 10, 40
PRINT "<=", mx, my-8

IF mba = 1
SHOWSCREEN
ENDIF

WEND

END



Note:  I've run these examples using Keys instead of the left-click and the same thing happens.  Cursor movement is recognised when ShowScreen is called.
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

MrTAToad

Yes, mouse positions wont be updated without a SHOWSCREEN - likewise a mouse pointer wont move either.

SHOWSCREEN is needed to process window messages as well a screen flipping so not using it can causing problems (program not responding etc).

I dont see it as a bug though.

Moru

I would say it's more "working as designed" :-) Why do you need to not use SHOWSCREEN? You won't get anything displayed without showscreen. Not to mention lots of other things SHOWSCREEN does under the hood.

matchy

For SHOWSCREEN is required in every loop draw.  8)
There is no bug because there is no meaning to the code. What's trying to be achieved?

Moebius

okay - I was wondering whether it was a 'bug' or a 'feature' :)
I was getting my program to wait at a menu screen for the user to click on any of the buttons when I noticed this.  ShowScreen processing messages from Windows makes sense.  Thanks for the quick response.
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

Kitty Hello

But.. MOUSEAXIS(3) should be able to poll the left button statw w/o SHOWSCREEN.

Moebius

Button statuses seem to work without ShowScreen (whether you check them via MouseAxis or MouseState) but the pointer position isn't updated.
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

Kitty Hello

Yes. The reason is, that the mouse speed (MOUSEAXIS(0) ) is calculated from the relative mouse movement in one SHOWSCREEN step.

Moebius

Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary