
-----------------------------------
Fexter
Tue Mar 20, 2012 10:08 pm

Seeing if turing window is top on screen?
-----------------------------------
What is it you are trying to achieve?
I want to find if my Turing program is on top of the screen, so that I can only have it detecting mouse clicks if I am running the window.


What is the problem you are having?
I have a program that's proceeding after finding a mouse click, thinking it was on the Turing window, even if I have the window minimized and have gone to a different window.


Describe what you have tried to solve this problem
I tried looking for anything that would be capable of doing this, but couldn't find anything.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)



var curX, curY, curZ : int

procedure waitForButtonDown(var x,y,z : int)

loop

Mouse.Where(x, y, z)
% if Window.IsTop(defWinId) then %
exit when z not= 0

end loop

end waitForButtonDown

loop

waitForButtonDown(curX, curY, curZ)

drawfilloval(curX, curY, 5, 5, black) % This is running even if the window is minimized, so going back to it makes a mess on the screen

end loop



Please specify what version of Turing you are using
I am using Turing 4.1.

-----------------------------------
Dreadnought
Wed Mar 21, 2012 12:25 am

Re: Seeing if turing window is top on screen?
-----------------------------------
What you're looking for is in the [tdoc]windowmodule[/tdoc], the window that is "on top" is called the "active" window. You can check if the Turing window is the active window and you can also set the active window.

-----------------------------------
Raknarg
Wed Mar 21, 2012 10:24 am

RE:Seeing if turing window is top on screen?
-----------------------------------
Window.GetActive
