Mega Code Archive

 
Categories / Delphi / VCL
 

Goody for a StatusBar

Title: goody for a StatusBar Question: Some times the use of a StatusBar is a hassle, when using 2 or more panels... and probably you write your procedure to update the statusbar... but then you notice you have to add another panel, then you have to change all the occurrences... =o| Answer: you can put this procedure in a separate unit ("goodys.pas" in this example) Procedure SetStatusBar(Var StB:TStatusBar; Strs:Array Of String); Var X:Byte; Begin For X:=Low(Strs) To High(Strs) Do If Not (Strs[X]='') Then StB.Panels[X].Text:=Strs[X]; Application.ProcessMessages End; Then include that unit in your formunit Implementation Uses goodys; and whenever you need to update your status bar, make a call SetStatusBar(MyStatusBar, ['panel', '', 'another panel']) no matter how many panels the StatusBar has, you can use the same procedure: SetStatusBar(MyStatusBar, ['update my first panel only']) Notes: - to empty a panel, make a call with an space: SetStatusBar(MyStatus, ['panel 2 should be empty', ' ']) - and make sure you have at least one panel in your statusbar, and the simplepanel property is False =o) I hope this is helpful keep up coding EberSys