forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

WaitAction

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
GEWV



Joined: 25 Nov 2013
Posts: 19

PostPosted: Tue Jan 21, 2014 11:52 am    Post subject: WaitAction Reply with quote

In a loop, the mouse info to be queried only when an action is performed.
Code:
do while (endless)
    call get_mouse_position@(x,y,flag)
    call temporary_yield@()
end do


The CPU is being used even though nothing is done.
The same result I get when I permit_another_callback views before the loop.
[img]http://tu-dresden.de/die_tu_dresden/fakultaeten/fakultaet_maschinenwesen/iet/ew/trnsys/temp_yield[/img]
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Tue Jan 21, 2014 1:29 pm    Post subject: Reply with quote

If you have a %gr window, then specify a callback function and "full_mouse_input". For each mouse movement within the graphics window a call to your specified callback function is performed and you can check the mouse info within that function.
If this is not for a graphics window, then forget I mentioned this!
Ian
Back to top
View user's profile Send private message Send e-mail
DanRRight



Joined: 10 Mar 2008
Posts: 2814
Location: South Pole, Antarctica

PostPosted: Tue Jan 21, 2014 2:32 pm    Post subject: Reply with quote

Ian made good point for %gr. As to other uses of mouse it would be wise to curb excessive CPU use by adding to the DO loop above the CALL SLEEP1@(smalldelay) which is specifically designed for not sucking processor time ( versus SLEEP@ as I last time used it a decade ago) with smalldelay from 0.01 to a quarter a second depending on usage
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7923
Location: Salford, UK

PostPosted: Tue Jan 21, 2014 3:15 pm    Post subject: Reply with quote

Calling temporary_yield@ causes ClearWin+ to process the Windows message queue at the point that you specify. If you omit the call then normally ClearWin+ will make the call automatically at an appropriate point.

If you need the call in the current context and do not make it, then Windows may not respond (e.g. to mouse movements).

In a simple program ClearWin+ will automatically call (something like) temporary_yield@ just before the Fortran STOP (or END) statement.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group