|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
DanRRight
Joined: 10 Mar 2008 Posts: 2815 Location: South Pole, Antarctica
|
Posted: Wed Nov 05, 2014 4:49 am Post subject: Ideas for "Work in Progress" indicator ? |
|
|
Any suggestions for good looking, small and simple indicator of "Run in Progress" ("Load in Progress" etc) ? If amount of runs/tries/lines is known i usually use slider %sl but if the volume of work/load is unknown then this is not good method. Something periodically blinking, moving, rotating... |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Wed Nov 05, 2014 8:36 am Post subject: |
|
|
Have you looked at %br? |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2815 Location: South Pole, Antarctica
|
Posted: Wed Nov 05, 2014 5:07 pm Post subject: |
|
|
Oops, i meant i used not %sl but %br. But it looks not exactly how i'd want the sign telling that the program is running/loading has to be displayed. It has to be something like this
or something blinking on/off
BTW, i have a freeze after few seconds with this program when use CALL SLEEP1@. If i do not use it or use SLEEP@ (which unfortunately grabs 100% CPU time when sleeps) the program works fine
Code: |
INCLUDE <windows.ins>
real*8 fill
ii=winio@('%ww%5br&', fill, RGB@(200,50,0))
!ii=winio@('%ww%5br[bottom_top]&', fill, RGB@(200,50,0))
ii=winio@('%ac[esc]&', '+', 'set', istop, 1, 'exit')
ii=winio@('%lw', ilw)
istop = 0
do i=1,2000000
if(istop.eq.1) exit
call sleep1@(0.1)
fill = abs(sin(i/5.))
call window_update@(fill)
enddo
end |
Last edited by DanRRight on Thu Nov 06, 2014 4:14 am; edited 1 time in total |
|
Back to top |
|
|
jalih
Joined: 30 Jul 2012 Posts: 196
|
Posted: Wed Nov 05, 2014 7:51 pm Post subject: Re: |
|
|
DanRRight wrote: |
BTW, i have program freeze after few seconds with this program when use CALL SLEEP1@. If i do not use it or use SLEEP@ (which unfortunately grabs 100% CPU time when sleeps) the program works fine
|
I would use separate threads to do the actual work and to update the progress. Using a thread pool it's really easy. Below is an example using my thread pool wrapper functions. You can get the project files from here. Package includes a simple total cpu usage monitor.
Code: |
module Test
implicit none
include <windows.ins>
! Thread pool wrapper functions in tp.dll
STDCALL TPEnvNew 'TPEnvNew' ():INTEGER*4
STDCALL TPEnvDelete 'TPEnvDelete' (VAL)
STDCALL TPCreate 'TPCreate' ():INTEGER*4
STDCALL TPSet 'TPSet' (VAL, VAL)
STDCALL TPClose 'TPClose' (VAL)
STDCALL TPCreateWork 'TPCreateWork' (VAL, REF, VAL):INTEGER*4
STDCALL TPCloseWork 'TPCloseWork' (VAL)
STDCALL TPSubmitwork 'TPSubmitwork' (VAL)
STDCALL TPCreateCleanupGroup 'TPCreateCleanupGroup' ():INTEGER*4
STDCALL TPCloseCleanupGroup 'TPCloseCleanupGroup' (VAL)
STDCALL TPSetCleanupGroup 'TPSetCleanupGroup' (VAL, VAL, VAL)
STDCALL TPCloseCleanupGroupMembers 'TPCloseCleanupGroupMembers' (VAL, VAL, VAL)
STDCALL TPWaitForWorkCallbacks 'TPWaitForWorkCallbacks' (VAL, VAL)
STDCALL TPSetThreadMax 'TPSetThreadMax' (VAL, VAL)
STDCALL TPSetThreadMin 'TPSetThreadMin' (VAL, VAL)
integer :: work
logical :: done = .FALSE.
real*8 :: fill
contains
subroutine updating(instance, context, work)
integer :: instance, context, work
integer :: i
i = 1
do while(.NOT. done)
fill = abs(sin(i/5.))
call window_update@(fill)
i = i + 1
if (i > 200) i = 1
call sleep(500)
end do
end subroutine updating
integer function cc_func()
done = .TRUE.
call TPWaitForWorkCallbacks(work, 0)
call TPCloseWork(work)
cc_func=0
end function cc_func
end module Test
winapp
use Test
implicit none
integer :: ii, ilw
ii=winio@('%ww%5br&', fill, RGB@(200,50,0))
ii=winio@('%`cc&',cc_func)
ii=winio@('%lw', ilw)
work = TPCreateWork(updating, 0, 0)
call TPSubmitwork(work)
end
|
|
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2815 Location: South Pole, Antarctica
|
Posted: Thu Nov 06, 2014 4:20 am Post subject: |
|
|
Does my code also freezes in your computer/OS/environment?
I have very little time right now for any experimenting, while your approach is huge jump aside...Let it lies in backbrain, may be some time we will return to it. You too think where it will shine the most. I'd probably only spend some time on parallelization on multi-core CPUs including massive parallel coprocessors, parallelization on GPUs, 64bit compilers and as a little hobby gaming on OpenGL+Fortran. That is our future, so many are probably interested too. Could be potentially interesting some latest advanced SDK allowing mouse click-based GUI programming for cellphones and tablets ideally also with some Fortran adopted for that. Anything else has to wait for better times... |
|
Back to top |
|
|
Wilfried Linder
Joined: 14 Nov 2007 Posts: 314 Location: Düsseldorf, Germany
|
Posted: Thu Nov 06, 2014 9:01 am Post subject: |
|
|
Dan, for your "animated wait" first find an animated GIF (or create one by ourself). Let's say we call this test_1.gif. This must be in a ressource script:
Code: | test_1 GIF test_1.gif |
Then you can do something like this:
Code: | WINAPP 'test_1'
PROGRAM TEST_1
integer*4 play,ctrl,j
common /my_gif/ ctrl
j = play()
do j = 1,2500
print*,j,sqrt(dble(j))
end do
ctrl = 0
call window_update@(ctrl)
end
integer function play()
integer*4 ctrl
common /my_gif/ ctrl
play = winio@('%ww[naked,topmost]%lw%gi[test_1]',ctrl)
end |
With play() you start your animation, with ctrl=0 and window_update@(ctrl) you stop it.
Good luck - Wilfried |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2815 Location: South Pole, Antarctica
|
Posted: Fri Nov 07, 2014 5:21 am Post subject: |
|
|
Good idea, thanks, Wilfried
But is it possible to make some on/off animation tricks with existing images in the RESOURCES like graying and ungraying them? Or similar things with
standard CWP graphics resources like %si!, %si# etc ? |
|
Back to top |
|
|
|
|
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
|