OS2 World.Com Forum
2012.05.25, 23:20:32 *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Progressbar  (Read 1522 times)
jep
Global Moderator
Sr. Member
*****
Posts: 402


View Profile
« on: 2008.04.01, 10:24:14 »

Marked as: Easy
Hello,

here's an example on how to create a function that display a progressbar.

call rxProgress 23, 214, 2 /* row 0 is the topmost row */

Code:
/* part, of_total, display_on_row */
rxProgress: Procedure
    if datatype( ARG(1), 'N' ) & datatype( ARG(2), 'N' ) then
    do
        if datatype( ARG(3), 'W' ) then
            parse value SysCurPos( ARG(3), 0 ) with prev_row prev_col
    progress = 76 * ARG(1) % ARG(2)
    say left( copies( '█', progress )||copies( '░', 76 - progress ), 76 )||right( ( ( 100 * ARG(1) ) % ARG(2) )||'%', 4 )
        if datatype( ARG(3), 'W' ) then
            call SysCurPos prev_row, prev_col
    end
Return 0
« Last Edit: 2008.04.03, 11:52:24 by jep » Logged
Andre Nancoz
Newbie
*
Posts: 4


View Profile
« Reply #1 on: 2008.04.02, 19:23:18 »

The datatype statement is missing a quote on the N literal.

  if datatype( ARG(1), 'N ) & datatype( ARG(2), 'N' ) then
Logged
jep
Global Moderator
Sr. Member
*****
Posts: 402


View Profile
« Reply #2 on: 2008.04.03, 11:52:41 »

Fixed :-)

Thanks
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.14 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!