Author: Eber Irigoyen
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...
Answer:
you can put this procedure in a separate unit ("goodys.pas" in this example)
1 2 procedure SetStatusBar(var StB: TStatusBar; Strs: arrayofstring);
3 var4 X: Byte;
5 begin6 for X := Low(Strs) to High(Strs) do7 ifnot (Strs[X] = '') then8 StB.Panels[X].Text := Strs[X];
9 Application.ProcessMessages
10 end;
11 12 //Then include that unit in your formunit 13 14 implementation15 16 uses goodys;
and whenever you need to update your status bar, make a call
17 18 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:
19 20 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