Silverfrost Forums

Welcome to our forums

TIMER and MOUSE_MOVE interfere in callback

16 Aug 2022 1:30 #29283

I try to develop a certain simulation using clearwin+. The callback to my OpenGL- window is triggered at regular intervals by a %dl-timer. I check for 'TIMER' as callback reason and then perform a new cycle of my simulation with corresponding window updates. This may take some time and runs continuously when I run what I call real-time-mode.

My OpenGL-Window covers a substantial portion of my screen and it cannot be avoided that while operating controls the mouse touches this graphic window which invokes the callback once again while it is still active. This leads to an error message and the prog aborts execution.

Of course, there is a workaround to create another window which does timecontrol only and minimize it. But is there a more elegant solution, like locking the callback while it is active performing a lenghty job?

16 Aug 2022 2:27 #29284

This earlier post may be of some help.

https://forums.silverfrost.com/Forum/Topic/3551

i.e. this part:

If a routine is being entered against your wishes then you could put a SAVEd logical variable at the start of it. Set this .TRUE. on the first entry and exit immediately on reentry so that the routine is only executed at the first level.

SUBROUTINE sub(....)
LOGICAL,SAVE:: active
!!DATA statement to initialise active to .FALSE.
IF(active) RETURN
active = .TRUE.
!! Body of subroutine
active = .FALSE.
END SUBROUTINE
16 Aug 2022 2:42 #29285

Thanks, Kenneth. Works fine. I did not think of the SAVE-Attribute.

Norbert

Please login to reply.