Manage Learn to apply best practices and optimize your operations.

Leverage the progress bar within Notes

How to utilize a progress bar that displays percentage progress within a message box display.

View member feedback to this tip.

First, I did not write all this code; I simply modified it to suit the immediate task. I have used it for a long time and do not recall the original source.

This class placed within a script library allows you to utilize a progress bar that displays percentage progress within a message box display, and disappears when the task is completed. You must reference the script library in the declarations section of whatever type of action you are using, then instantiate a new instance of the class as an object reference. You will need to progressively set the instance members of the class as your task completes.

For example, if you are using the progress bar to display the ongoing status of an archive of selected documents, you would set the range property to the count of the document collection. You would then increment the Progress or Pos property accordingly via a local count index passed continuously back to the progress bar class via your object reference. You would also set the Text property of the object, which would be the text displayed within the progress bar dialog.

Declare Public Function NEMProgressBegin 
Lib "nnotesws.dll" (Byval wFlags As Integer) 
As Long
Declare Public Sub NEMProgressSetBarRange 
Lib "nnotesws.dll" (Byval hWnd As Long, 
Byval dwMax As Long)
Declare Public Sub NEMProgressDeltaPos
 Lib "nnotesws.dll" (Byval hWnd As Long, 
Byval dwIncrement As Long)
Declare Public Sub NEMProgressSetBarPos 
Lib "nnotesws.dll" (Byval hWnd As Long, 
Byval dwPos As Long)
Declare Public Sub NEMProgressSetText Lib
 "nnotesws.dll" (Byval hWnd As Long, Byval 
pcszLine1 As String, _
Byval pcszLine2 As String)
Declare Public Sub NEMProgressEnd Lib 
"nnotesws.dll" (Byval hWnd As Long)

Class CProgressBar
 
 Private hWnd As Long
 
 Property Set Range As Long
  NEMProgressSetBarRange hWnd, Range
 End Property
 
 Property Set Delta As Long
  NEMProgressDeltaPos hWnd, Delta
 End Property
 
 Property Set Pos As Long
  NEMProgressSetBarPos hWnd, Me.Pos
 End Property
 
 Property Set Text As String
  NemProgressSetText hWnd, Text, ""
 End Property
 
 Property Set Progress (Pos As Long) As 
String
  Me.Pos = Pos
  Text = Progress
 End Property
 
 Property Set ProgressBy (Delta As Long) 
As String
  Me.Delta = Delta
  Text = ProgressBy
 End Property
 
 Private Sub Init
  Range = 100
  Delta = 1
  Text = ""
  Pos = 0
 End Sub
 
 Sub New( Range As Long )
  Dim session As New NotesSession
  If session.GetEnvironmentValue
( "useProgressBar" ) = 1 Then
   hWnd = NEMProgressBegin( 2 ) 
' Const NPB_ONELINE = 2
   Init
   If Range <> 0 Then Me.Range = Range
  End If
 End Sub
 
 Sub Delay( Seconds As Integer )
  Dim Started
  Started = Now
  While (Now - Started) * 24 * 
60 * 60 < Seconds
        ' do nothing
  Wend
 End Sub
 
 Sub Delete
  NEMProgressEnd hWnd
 End Sub
 
End Class

MEMBER FEEDBACK TO THIS TIP

Could you please give me a good example how to call this routine in an LS agent? Thank you!

-- Vesa H.

Do you have comments on this tip? Let us know.

Dig Deeper on Web Development for Lotus Notes Domino

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close