IE Style Progress Bar?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

IE Style Progress Bar?

Post by Rook Zimbabwe »

I am running the older Disk Defrag program on Binky (My d: Drive) and I noticed the IE Style progress bar at the bottom. I suppose I had noticed it before but I paused a moment to wonder if WE (the PB community) had access to that little toy through PB?

I searched the forums fot explorer progress bar and IE Progress etc... Didn't see anything that looked specific to my topic. So I ask...

:?: :?: :?: :?:

Is there a way to use that Windows Gadget?
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

I'm not sure I know what you're referring to, so if I've missed the boat - sorry. Anyway, I took this whack at it:

Code: Select all

;
;     Looks best with XP skins on 
;
OpenWindow(0,0,0,320,240,"",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
bar = CreateStatusBar(0, WindowID(0))
CreateGadgetList(bar)
  ProgressBarGadget(1,170,4,100,15,0,100,#PB_ProgressBar_Smooth)
CreateGadgetList(WindowID(0))
  ButtonGadget(0, 90, 100, 140, 20, "Show some progress")

progress = 0
Repeat
  ev = WaitWindowEvent(1)
 
  GetCursorPos_(@pt.POINT)
  GetWindowRect_(GadgetID(0), br.RECT)
  If PtInRect_(@br, pt\x, pt\y)
    If GetAsyncKeyState_(#VK_LBUTTON) & 32768
      progress+1:If progress>100:progress=0:EndIf
      SetGadgetState(1, progress)
    EndIf
  EndIf

Until ev = #WM_CLOSE
The codeblock in the loop is just to change the progressbar state while the button's down, you don't need it.
BERESHEIT
merihevonen
Enthusiast
Enthusiast
Posts: 326
Joined: Mon Jan 01, 2007 7:20 pm

Post by merihevonen »

I guess he means that the ProgressBarGadget would be on a StatusBar.. not quite sure either..
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post by utopiomania »

In case it is about attaching a progressbar to a statusbargadget this post:
http://www.purebasic.fr/english/viewtopic.php?t=11125 explains how to do it

Code: Select all

If OpenWindow(0, 100, 150, 300, 100, "", #PB_Window_SystemMenu | #PB_Window_SizeGadget) 
  
  hstatus= CreateStatusBar(0, WindowID(0)) 
  If hstatus 
    AddStatusBarField(100) 
  EndIf 

  If CreateGadgetList(WindowID(0)) 
  Hprogress=ProgressBarGadget(0, 120, 2,150, 20, 0,100) 

EndIf 
  SetParent_(Hprogress,hstatus) 
  SetGadgetState   (0,50) 

  Repeat 
    
  Until WaitWindowEvent() = #PB_Event_CloseWindow 
EndIf
Post Reply