Game Development Community

Mac - OpenFileDialog - cursor gets stuck - LOGGED

by Richard Müller · in Torque Game Builder · 03/28/2011 (2:34 am) · 4 replies

Hi there,


I am porting a Windows game to Mac (developped with TGB 1.7.5).
I was able to fix most of the problems however there is one big problem left:

The user should be able to choose a picture of its own (jpeg or bmp) to import it to the game.
So I use the 'OpenFileDialog' with the right Filters and execute the Dialog.

Under Windows it's working fine.
-> The custom cursor gets stuck over the Button that executes the File Dialog and the Windows-Standard-hardwarecursor gets visible to browse through the FileDialog.

Under Mac the customcursor gets stuck and the hardwarecursor doesn't appear in top of the game!
-> The mousecursor is invisible as it is over the TGB-window (the hardwarecursor gets visible if I move the mouse off the game-window).


Is there a fix, trick or workaround to get the FileDialog working under Mac? (it is already working, but I don't want the gamers to drag with an invisible mousecursor the FileDialog-Window off the windowed game-window to get a visible mousecursor to be able to browse within the FileDialog..)


Perhaps anybody could give me a hint because I don't know how to fix this nuisance or how a workaround could look like for letting the user choose a custom picture.


Greetings from Hamburg, Germany

Richard

About the author

Recent Threads


#1
03/30/2011 (8:41 am)
Logged as TGB-512.
#2
03/30/2011 (9:53 am)
A temporary fix would be to hunt down the function and call the show/hide cursor stuff. Make sure the cursor is definitely visible before the file dialog opens, then return to whatever the previous state was after it closes.

There is very little consideration for the state of the mouse cursor in TGB in general, so the behaviour can be unpredictable :/
#3
03/30/2011 (1:28 pm)
This may be related to an issue that we discovered during iT2D 1.4.1 development, though if it's not you'll certainly run into it next. FileDialogs are populated by searching for file types by wildcard. The problem is that Apple, in their infinite wisdom, added *.* as a file type in 10.6. Which means that the FileDialog will never find images to select.
#4
04/04/2011 (5:24 am)
Hi there and thanks for the replies.

@Ronny: I already tried the show/hide-cursor-stuff, but it didn't help - even if I turn my custom cursor completly off.

For a better explanation: The (custom)cursor gets always visible if I close the file dialog.
I get the hardware cursor in the file dialog visible if I follow these three steps:
Step one: Manage to drag the file dialog outside the tgb-game-window (so that the desktop or another window is behind the file dialog / or a part of it)
Step two: Move the (invisible) mouse cursor outside the tgb-game window and outside the file dialog (just over the finder or desktop). The mouse cursor gets visible.
Step three: Move the (now visible) hardware-default mouse cursor over the file dialog window and voil� .. the mouse cursor remains visible as long I move it within the file dialog window. If I move over the tgb-game window the cursor gets invisible again. Go back to Step two.

@Scott: I am developing in Mac OS 10.6.7 and I don't have any problems to limit the selectable files to just *.jpg and *.bmp - I use the File-Dialog like this:
%imageSelectorSpec = "JPEG (*.jpg)|*.jpg|BMP (*.bmp)|*.bmp";

   // open file dialog:
   new OpenFileDialog(getFile){ 
      Filters = %imageSelectorSpec;
      MustExist = true;
      MultipleFiles = false;      
      ChangePath = false;
      Title = getStringContent("open_file_dialog_title");
   };
   
   if (! getFile.Execute() )
      return false;

I think, I have to look deeper in the code.. somewhere near the openFileDialog-stuff in the C++ code. I think somewhere in the code somebody just forgot to reset the visibility of the hardware cursor if a OpenFileDialog is called on a Mac - on Win it is working fine.