Small script feature with hiding cursor
by Thomas \"Man of Ice\" Lund · in Torque Game Engine · 09/11/2004 (4:39 am) · 7 replies
When one tries to disable the hiding of the cursor, then there is a small "feature" in the cursor.cs script
Today when one puts in
nocursor = "1"; or noCursor = true;
into a TSCtrl gui script, then the cursor is removed.
But one would think that setting this to = false or = 0 would then enable it again. This is no the case, as the if() removing the cursor only checks for its existance.
One should change the following
common/client/cursor.cs
into
(Cost me 30 minutes to discover - might as well save someone else from that hassle)
Today when one puts in
nocursor = "1"; or noCursor = true;
into a TSCtrl gui script, then the cursor is removed.
But one would think that setting this to = false or = 0 would then enable it again. This is no the case, as the if() removing the cursor only checks for its existance.
One should change the following
common/client/cursor.cs
function GuiCanvas::checkCursor(%this)
{
%cursorShouldBeOn = false;
for(%i = 0; %i < %this.getCount(); %i++)
{
%control = %this.getObject(%i);
[b]if(%control.noCursor $= "")[/b]
{
%cursorShouldBeOn = true;
break;
}
}into
function GuiCanvas::checkCursor(%this)
{
%cursorShouldBeOn = false;
for(%i = 0; %i < %this.getCount(); %i++)
{
%control = %this.getObject(%i);
[b]if(%control.noCursor $= "false" || %control.noCursor == 0)[/b]
{
%cursorShouldBeOn = true;
break;
}
}(Cost me 30 minutes to discover - might as well save someone else from that hassle)
#2
No cursor is displayed with parent = true, child = false
So I think its as you would expect it - parent sets the cursor behaviour
The fix can naturally be shorted down to
09/11/2004 (10:03 am)
If my fix is implemented, then a cursor is displayed when parent = false, child = trueNo cursor is displayed with parent = true, child = false
So I think its as you would expect it - parent sets the cursor behaviour
The fix can naturally be shorted down to
if(!%control.noCursor)
#3
09/11/2004 (11:05 pm)
So what happens if I bring up a window that brings up another window and I don't set noCursor on the child?
#4
09/12/2004 (1:04 am)
You mean like the dialog boxes? They work fine
#5
09/12/2004 (8:18 am)
Snazzy.
#6
11/19/2004 (10:52 am)
Ok, this is fixed.
#7
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6638
without even thinking about it needing to be added to the HEAD, I too encountered problems that traced back to that exact problem when I designed a universal toggle function that could toggle any GUI's. My problem was I needed to be able to open the inner windows as well as the entire GUI control and the interior controls are NOT checked against the cursor. Therefore if you needed a cursor, it would not be there for you. No sooner than I solved that problem everything went right to hell and I discovered the exact same thing Thomas did, which is my problems stemmed directly from the exact same line of code.
I'm not sure what you put in for the change, but this was my solution and so far it's been flawless....
Regardless, this is one of those fixes I really appreciate you guys making because it will never bother anyone again until some freak like me decides that toggling a cursor just isn't good enough for some reason, lol.
11/19/2004 (11:12 am)
Man I had no idea anyone else had seen this, and I passed it off as a suggestion in this thread...www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6638
without even thinking about it needing to be added to the HEAD, I too encountered problems that traced back to that exact problem when I designed a universal toggle function that could toggle any GUI's. My problem was I needed to be able to open the inner windows as well as the entire GUI control and the interior controls are NOT checked against the cursor. Therefore if you needed a cursor, it would not be there for you. No sooner than I solved that problem everything went right to hell and I discovered the exact same thing Thomas did, which is my problems stemmed directly from the exact same line of code.
I'm not sure what you put in for the change, but this was my solution and so far it's been flawless....
%control = %this.getObject(%i);
if(%control.noCursor <= 0)
{
%cursorShouldBeOn = true;
break;
}Regardless, this is one of those fixes I really appreciate you guys making because it will never bother anyone again until some freak like me decides that toggling a cursor just isn't good enough for some reason, lol.
Associate Kyle Carter