Board index » cppbuilder » Status Bar repaint

Status Bar repaint


2004-12-22 08:14:50 PM
cppbuilder0
Hello, I've got a simple-looking problem with a statusbar
I;ve got a main form with lots of stuff on it, and a status bar at the
bottom
My problem is when I resize the Form:
1/ if I make it bigger it's ok
2/ if I make it smaller, the status bar simply doesn't repaint as expected
and most times doesn't show anything. I thought the reason might be that I
got a TImage above it which is resized in the OnResize event ot the form, so
it's bottom is 4 pts away from the statusbar's top, so I even tried removing
the TImage, and other stuff, but the statusbar continues to repaing
incorrectly. I tried to manually call the Repaint () and Refresh () methods
of the TStatusBar object, but there was no result. Any ideas what might
cause such strange behaviour?
10x in advance
Analian
 
 

Re:Status Bar repaint

Hi,
Try first to add Panel1 on the Form1 (main form) and
make the panel aligned alClient and get rid of borders.
Add your TStatusBar (and all of your components ) to that
panel.
Let me know is still there are any resize/look problems with
TStatusBar.
Best regards,
Vladimir Stefanovic
Analian < XXXX@XXXXX.COM >wrote in message
Quote
Hello, I've got a simple-looking problem with a statusbar
I;ve got a main form with lots of stuff on it, and a status bar at
the
bottom
My problem is when I resize the Form:
1/ if I make it bigger it's ok
2/ if I make it smaller, the status bar simply doesn't repaint as
expected
and most times doesn't show anything. I thought the reason might be
that I
got a TImage above it which is resized in the OnResize event ot the
form, so
it's bottom is 4 pts away from the statusbar's top, so I even tried
removing
the TImage, and other stuff, but the statusbar continues to repaing
incorrectly. I tried to manually call the Repaint () and Refresh ()
methods
of the TStatusBar object, but there was no result. Any ideas what
might
cause such strange behaviour?

10x in advance
Analian


 

Re:Status Bar repaint

Sorry I didn't respond fo 6 days but XMas time and no time for programming.
So...
I don't get quite right what Panel1, are you talking about
but I tried some aligning stuff, but none of it worked out
On the bottom of my form (filled with lots of stuff) and above the status
bar I've got a label which must be aligned with the bottom of the form so
OnResize I simply compute the new Top property of the Label and thus expect
everything to repaint and be fine. But it ain't ok this way. I tried setting
the alignment of the Label to alClient, as you proposed but it occupies
almost all the form this way and so isn't what I need. Any other proposals?
 

{smallsort}

Re:Status Bar repaint

"Analian" < XXXX@XXXXX.COM >wrote:
Quote

Any other proposals?
My status bars always have multiple panels (see the Panels
property) so I always use the TStatusBar::OnResize event to
keep them proportional and I have no problems because changing
a panel's Width will cause it to repaint.
~ JD
 

Re:Status Bar repaint

JD,
I don't get want you're trying to tell me. When I'm resizing the form, the
statusbar is also resizing because of the align type and so it shoud be
rapainted. So what am I to do it the OnResize event of the statusbar? I
tried Repaint()ing and Refreshing() but there was no improvement, Did you
have something else in mind?
 

Re:Status Bar repaint

"Analian" < XXXX@XXXXX.COM >wrote:
Quote

[...] Did you have something else in mind?
Yes. Changing the Width of the TStatusBar::Panels
for( int x = 0; x < StatusBar->Panels->Count; ++x )
{
StatusBar1->Panels->Items[ x ]->Width =
StatusBar1->Panels->Items[ x ]->Width;
}
I actually iterate the panels and resize them based on the
form's Width to keep the proportion to each other based on the
form's width.
From your other post, it sounds to me like you don't have any
panels set so look at the Panels property in the Object
Inspector and click on the elipse and add one (or more).
~ JD
 

Re:Status Bar repaint

JD,
So I've got which panels are you talking about and did as you proposed but
there's no effect. I think the problem si something with the Label attached
to the statusbar or whatever is attached to it but still can't find a
solution. 10x anyway
 

Re:Status Bar repaint

"Analian" < XXXX@XXXXX.COM >wrote:
Quote

So I've got which panels are you talking about
That tells me that you aren't using them.
Quote
and did as you proposed but there's no effect.
Of course not. You're not using the panels so the Count is
zero and the body of the loop never executes.
What are you using a TLabel for anyway? Why aren't you using
the panels Text property instead?
StatusBar1->Panels->Items[ x ]->Text = "Some thing";
What do you expect to happen when the form Width is reduced?
~ JD
 

Re:Status Bar repaint

Quote
>So I've got which panels are you talking about

That tells me that you aren't using them.
I AM using these panels, just didn't know they're called like that. And they
are 4, so the lood executes, just doesn't make any difference.
Quote
What do you expect to happen when the form Width is reduced?
Well, then an OnResize event for the form should occur and then an OnResize
for the statusbar, and thus the statusbar should be repainted.