TC_Event Problem

I am not sure if this is a problem or if I am misunderstanding how the TC_Event library function operates. But here is my question......

I have a program with two windows. Timer (TimerId) and Question (Wid)

I move between the windows to display the timer countdown and monitor if somebody has entered a value into a text box.

In the code I used the statement
CALL TC_Event(0,Event$,Wid,X1,X2)
to capture the event in the Question window(Wid)

But after the TC_Event line is called the Wid is modified to a different value - as a result the code fails.

To resolve this I used a Value parameter on the TC_Event line.
CALL TC_Event(0,Event$,(Wid),X1,X2)

Is this a specific problem or is this how TC_Events works?

Thanks for any feedback.



Hi, In general TC_event


In general TC_event scans for events in all visible windows, i.e. it looks for keystrokes or mouse clicks. TC_event doesn't always respond in the way you would expect. For example, suppose you have two visible windows and the first is the ACTIVE window (in front). If you click your mouse on an object such as a push button, in the second window, then TC_event produces a whole rash of events such as a SELECT event because you changed windows, a REFRESH event because the window may have been partially obscured, a CONTROL SELECTED event because you clicked on the push button and a CONTROL DESELECTED event because you released the mouse button.
As you can see from the above you will get a change of window ID because you have moved the window focus from the first window to the second.

To fully understand how TC event works I would suggest you include the following temporary code immediately after TC_event:

CALL TC_event(0,event$,wid,x1,x2)
IF event$<>"REFRESH" and event$<>"" then
PRINT event$,wid
PRINT x1,x2
GET KEY keynum

The rest of your code here


As the program loops through TC_event you will see printed in RED what event has been detected and what the value of WID is. Press any key to continue to the next event.

Big John



I forgot to mention that all the parameters in the call to TC_event should be variables except the first parameter (time) which can be a numeric constant (usually zero). All the others e.g. event$, wid, x1 and x2 must be variables.

Big John