Progress Bar - Within Statusbar

Category: Controls - .Techniques

Date: 02-16-2022

Return to Index


 
'Compilable Example:  (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "win32api.inc"
%ID_Timer      = 600
%IDC_StatusBar = 601
Global hDlg As Dword, pBar As String
 
Function PBMain() As Long
   Dialog New Pixels, 0, "Statusbar Test",300,300,200,100, %WS_SysMenu, 0 To hDlg
   Control Add Statusbar, hDlg, %IDC_StatusBar, "",0,0,0,0
   Statusbar Set Parts hDlg, %IDC_StatusBar, 75,75,99999
   Statusbar Set Text hDlg, %IDC_StatusBar, 1, 0, "one"
   Statusbar Set Text hDlg, %IDC_StatusBar, 2, 0, "two"
   Statusbar Set Text hDlg, %IDC_StatusBar, 3, 0, "three"
   Control Set Color hDlg, %IDC_StatusBar, %Red, %Yellow
   Dialog Show Modal hDlg Call DlgProc
End Function
 
CallBack Function DlgProc() As Long
   Select Case Cb.Msg
      Case %WM_InitDialog
         SetTimer(Cb.Hndl, %ID_Timer, 200, ByVal %NULL)   'uses callback messages
      Case %WM_Timer
         pBar = pBar + "|"
         Dialog Set Text hDlg, Str$(Len(pBar))
         If Len(pBar) > 20 Then pBar = ""
         Statusbar Set Text hDlg, %IDC_StatusBar, 1, 0, pBar
      Case %WM_Destroy
         KillTimer Cb.Hndl, %ID_Timer
   End Select
End Function
 
'gbs_00800
'Date: 03-10-2012


created by gbSnippets
http://www.garybeene.com/sw/gbsnippets.htm