How do you rename a Status Bar Panel in Delphi 2010

I have just added a new panel to StatusBar1 and it is called 5 - TStatusPanel. I want to give it a different name but I can't remember how to do this.

Delphi 2010 StatusBar Panels

I want to rename 5 - TStatusPanel to 5 - GripArea. As you can see from the image I have done this before (see Num, Caps, AM/PM) but I can't remember how I did this. It sucks to get old.

Upvotes: 1

Views: 574

Answers (2)

Chris Thornton
Chris Thornton

Reputation: 15817

Here's a tip that would have saved some hunting: right-click on the form, View As Text. Now you'll see the form layed out as properties, and you could have found the control, seen how the other panels were named, and fix the last one. Alt+F12 to toggle the text view on/off.

Upvotes: 4

Andreas Rejbrand
Andreas Rejbrand

Reputation: 108963

Just change the Text property of the TStatusPanel. This is what is displayed in the status panel editor. Of course, this will make the text visible in the panel! Normally, in code, you access the status panels using the StatusBar1.Panels[PanelIndex] array. PanelIndex is the zero-based index of the panel. I always declare constants such as

STATUS_FILE_POSITION = 0;
STATUS_FILE_SAVED = 1;
STATUS_LONG_TEXT = 2;
STATUS_ZOOM_CONTROL = 3;

and use these to remember the panels. (The code above is from my text editor.)

So I can do, for instance,

StatusBar.Panels[STATUS_FILE_SAVED].Text := 'Modified';

Upvotes: 4

Related Questions