Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

StatusBar1 onClick

Status
Not open for further replies.

801119

Programmer
Apr 10, 2000
311
SE
Greetings to all of you!!!

Is ther anyway of finding out which Panel/Item was clicked on the statusbar??? Martin G Broman
mgb_svea@thevortex.com

DWS - Alpha Whitin Dead Wolf Society
Xaner Software, DB programer
 
I also want to know how to keep proportions of the TStatusBar! My status bar is parted in 5 items, of which I want to resize 2 so the remaining keeps their size, the status bar looks something like this
| Keep | Alter | Keep | Alter | Keep |
The first has a width of 35, second 170, third 80, fourth140 and fifth 140
These are the numbers when the form has a width of 575...
How can I change the two (where it says Alter) so the others (where it says Keep) keep their size when forms resizes?
Martin G Broman
mgb_svea@thevortex.com

DWS - Alpha Whitin Dead Wolf Society
Xaner Software, DB programer
 
I don't know if this will work or not. Suppose you have a status bar with 5 panels, numbered 0 to 4. I THINK that to see if a panel has been clicked on try something like:
Code:
int y = 0;
for (int x = 0; x<5; x++)
{
    if (StatusBar1->Panels->Items[x]->Focused())
    {
        y=x;
     }
}
This might work. I haven't tried it.

For your problem with resize the panels, in the OnRsize method, you will need to create an algorithm that will allow some panels to change and others not. Look at the SetBounds method. That may help.

James P. Cottingham
 
Greetingx

If you need to change width of TStatusPanel's which are included to TStatusBar you should use TStatusPanel's property of Width.
Example of changing of the TStatusPanel's width! The StatusBar consists of three TStatusPanels.
StatusBar1 should have property of Align equal to alBottom

void __fastcall TForm::OnResize(...)
{
StatusBar1->Panels->Items[0]->Width = Width / 3;
StatusBar1->Panels->Items[2]->Width = Width / 4;
}


PS: For correct resizing of TStatusBar you should calculate dependings of TStatusPanel's width from width of the Form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top