View previous topic :: View next topic |
Author |
Message |
ursuselasticus
Joined: 26 Mar 2005 Posts: 71
|
Posted: Tue Aug 16, 2022 2:30 pm Post subject: TIMER and MOUSE_MOVE interfere in callback |
|
|
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? |
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Tue Aug 16, 2022 3:27 pm Post subject: |
|
|
This earlier post may be of some help.
http://forums.silverfrost.com/viewtopic.php?t=3992
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.
Code: | SUBROUTINE sub(....)
LOGICAL,SAVE:: active
!!DATA statement to initialise active to .FALSE.
IF(active) RETURN
active = .TRUE.
!! Body of subroutine
active = .FALSE.
END SUBROUTINE |
|
|
Back to top |
|
|
ursuselasticus
Joined: 26 Mar 2005 Posts: 71
|
Posted: Tue Aug 16, 2022 3:42 pm Post subject: |
|
|
Thanks, Kenneth. Works fine.
I did not think of the SAVE-Attribute.
Norbert |
|
Back to top |
|
|
|