Page 1 of 1

IsScreenActive()

Posted: Tue Dec 22, 2009 4:57 am
by IdeasVacuum
I have a WindowedScreen which displays a Mesh nicely and then the Mesh can be rotated etc by dragging the mouse etc. So far so good. However, I want to return focus to the Parent Window (or the Window of any other desktop program) if the mouse position is outside of the WindowedScreen.

So far a test such as:

fMousePosnX = MouseX()

Code: Select all

If ( fMousePosnX > (fScreenWth -2) ) 
                  
            ReleaseMouse(1)
                        
EndIf
Just about works but the solution is not elegant because the test checks if the mouse is off screen to the right but including a test to see if it is off screen to the left delivers a false positive.

Also, if the mouse is returned to the WindowedScreen, how does one return the focus to the WindowedScreen?

I have also tried IsScreenActive():

Code: Select all

RenderWorld()

                        DisplaySprite(#CursorSprite, MouseX, MouseY)

                        FlipBuffers()
                        
                        ClearScreen(RGB(0, 0, 0))
                        
                        iScreenActive = IsScreenActive()
IsScreenActive() should return zero if the screen is inactive but I only ever get a return of 1. Perhaps this function only works in Full Screen mode? If so, does anyone know how to emulate it in a WindowedScreen?

Re: IsScreenActive()

Posted: Tue Dec 22, 2009 5:20 am
by Kaeru Gaman
I don't know right know about DX9 and 3D stuff...

for 2D stuff and DX7 I posted code some time ago...
http://www.purebasic.fr/german/viewtopic.php?t=11280
thought I also posted it in the english forums, but don't find it quick...

Re: IsScreenActive()

Posted: Tue Dec 22, 2009 7:14 am
by IdeasVacuum
Hi Kaeru

Your code looks as though it will cure my headache, thank you :)