• Welcome to OS2World OLD-STATIC-BACKUP Forum.
 

News:

This is an old OS2World backup forum for reference only. IT IS READ ONLY!!!

If you need help with OS/2 - eComStation visit http://www.os2world.com/forum

Main Menu

Rotating statusindicator

Started by jep, 2008.04.04, 12:16:06

Previous topic - Next topic

jep

Marked as: Easy
Hello,

The code below describe a way to show and update a message every second indicating that the script is busy processing infromation. It changes the character "\", "|", "/" or "-" in front of the message to give the impression of a rotating motion.

start_time = TIME( 'R' )
...
curr_time = TIME( 'E' )
...
do while ...
    if curr_time + 1 < TIME( 'E' ) then
    do
        call rxWorking 'Processing... Please Wait'
        curr_time = TIME( 'E' )
    end
end

rxWorking: Procedure Expose cfg.
    if datatype( ARG(1), 'W' ) then
        parse value SysCurPos( ARG(1), 0 ) with prev_row prev_col
    SELECT
        WHEN cfg.counter = 1 THEN
            say left( '/ '||ARG(2), 80 )
        WHEN cfg.counter = 2  THEN
            say left( '- '||ARG(2), 80 )
        WHEN cfg.counter = 3 THEN
            say left( '\ '||ARG(2), 80 )
        OTHERWISE
        cfg.counter = 0
        say left( '| '||ARG(2), 80 )
    END
    cfg.counter = cfg.counter + 1
    if datatype( ARG(1), 'W' ) then
        call SysCurPos prev_row, prev_col
Return 0