Device Manage for OS/2

DevCon for OS/2 - Developer Connection

Operating systems:
ArcaOS, eComStation, IBM OS/2 Warp
eComStation myths 




/ Guidelines: Additional control elements / Progress-bar / Progress-bar FAQ, tricks&tips

Progress-bar FAQ, tricks&tips

It's difficult learn how Progress bar works.. First of all, examine carefuly "Progress Bar Test Window" sample program (prtest.exe), too see, how PROGRESS.DLL should be used, and how it works.
When to use Progress bar?

Open the window with progress bar if operation requires more than 5-10 seconds. You should provide Cancel button to user.

Why to use our Progress bar?
  • we draw eye-candy progress bar
  • we are sorting text strings on the surface of the window
  • we calculate the size of the window
Which kind of Progress bar to use?

Use Round PBar for applications which are rebuilding / changing / destroying something. Don't use Round PBar for copy / search operations.

How to create modal window Modal PBar - use WinProcessDlg() and WinSetSysModalWindow().

If WinProcessDlg() was called, use WinDismisssDlg() to stop it. Don't remove modal PBar window using WinDestroyWindow() before call of WinDismisssDlg()! Don't try to open new windows (Message Boxes) while modal window is floating.

How to perform additional initialization? If you want make additional initialization of PBar after creation (for example, you are going change attributes for some controls), don't set PRS_SHOW flag. Call WinShowWindow() after additional initialization to show the PBar.
How to use own PNG pictures? To use own resources put them to EXE or DLL. Pictures should have type RT_PNG (defined in "progress.h"), IDs of the resources should follow in succession. The ID of the first picture should be passed to PrgShowDlg().
The window is jumping, changing size during the process If you are going change a text string during the process then pass in during initialization as long text string full of spaces. Use PrgSetupCaption() to update the text string, flUpdate = FALSE.
Text on buttons MSG-BOX-1: It's a good idea to use your own captions on the buttons instead of the default. Always use verbs as captions: "Close window", "Do not close", "Overwrite file", "Keep file" instead of "Yes", "No", "OK", etc.
Progress-bar animation only How to disable all text strings, frames and keep progress-bar animation only? All strings as NULL, disable frames
How to put Progress-bar dialog to the center of desktop? You can do this manually: example
How can I tell a progress bar the place to draw itself? no information
Is there are way to set the position within it's client window (owner)? no information
How can I calculate the size of a progress bar? no information
Can I draw the bar without any caption? no information
Can there be an implementation of progressbar as a static control window? no information



(C) OS2.GURU 2001-2024