realbasic-games
[Top] [All Lists]

Re: Beach ball and mouse-cursor

To: "REALbasic Games" <REALbasic-Games at lists dot realsoftware dot com>
Subject: Re: Beach ball and mouse-cursor
From: Frank C <pox at planetquake dot com>
Date: Sun, 28 Sep 2003 16:27:08 -0400
On Sunday, September 28, 2003, at 05:41  AM, Nils Raschke wrote:

What is the difference between CursorHide() and CursorObscure()?
What are CursorShield(w as Window) and CursorShield(rect as RectControl)
for?

There's an example project in the download that shows what those do... CursorHide hides the cursor, and increments it's hide count so it won't be shown until an equal number of "show" commands are called (though it doesn't seem to work that way on OSX). CursorObscure just hides the cursor until the mouse is moved, and shield hides the cursor only when it's over a specified rect in global coordinates - I just used window and control bounds to simplify the call.

These methods were added for completeness and are basically direct calls to Mac toolbox functions, the real good stuff is CursorMove, Capture/Release and Poll...

process keys (etc) as if it's infront. You can work around this with
some nasty hacks like polling the process manager, or trying to detect
the relevant key combos and breaking out of the tight loop when
appropriate.

I'm polling keyboard.asyncKeyDown() once in the loop. If a user presses
apple-tab in a moment when I'm not polling, I wont have a chance to detect
that I'm now in the background, right?

That's possible, but not likely to happen if yer polling 30-60 times a second.

So the right strategy would be to hide the cursor and poll as often as
possible for apple-tab and apple-H (which doesn't seem to affect my app) and
leave the tight loop when these keys are pressed.

That should work, but again, there's no real guarantee. Polling the process manager through declares or a plugin to see if your app is in front is probably safest, or checking for de/activate events behind RB's back might work as well. I'm planning a Mac-only plugin that lets you use either one of these approaches (plus adds some other hacks like disabling command-H/Q combos) but I haven't started it yet, and might not get a chance till November-ish.

Frank.


---
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

<Prev in Thread] Current Thread [Next in Thread>