Game Development Community

Disabling mouse events

by Maxime Jouin · in Torque Game Engine · 04/10/2007 (9:12 am) · 3 replies

Hello,

I am looking for a way to disable all mouse events during a certain period of time (I transform the mouse cursor into an hourglass while I do work in the backround and I do not want the user to clicl anywhere during that time). Searching the forum I found the following line of code:

sceneWindow2D.setUseWindowMouseEvents( false );

But this gives the following error message: "Unable to find object 'sceneWindow2D' ". Is this obsolete? Is there another way to do this?

Thank you for any help.

#1
04/10/2007 (11:03 am)
That call looks like it is from TGB, so it won't work in TGE.

One simple way to disable clicks would be to push a dummy GuiControl to the top of the Canvas, and have it cover the whole screen. You'd need to set the horiz and vert settings to be "width" and "height."

This will block all the incoming clicks from going to your GUIs, and instead they will hit the dummy control and do nothing.

I can't think of the commands off the top of my head, here is some pseudo code:

%dummyGui = new GuiControl()
{
  position= "0 0";
  extent = "10 10";
      horizSizing = "width";
      vertSizing = "height";

  ...
};
PlayGui.add(%dummyGui);

Then when you are done, something like:

%dummyGUi.delete();
#2
04/11/2007 (1:25 am)
This works exactly like I want it to.

Thank you.
#3
04/11/2007 (5:53 am)
Glad to hear it! It's always nice when the easy solution gets it done.