StatusStrip wiping out 2nd label

T

tshad

I have a status strip with 2 items: toolStripStatusLabel1 and
toolStripStatusLabel2.

I have the toolStripStatusLabel2 all the way to the right by using a margin
left of 500.

When I write to toolStripStatusLabel1, which is all the way to left, it
wipes out the text in toolStripStatusLabel2.

How do I set it up so it writes only to the left side of the strip?

Also, how do I get it to show the panels as inset so you can see the panels?

Thanks,

Tom
 
T

tshad

Family Tree Mike said:
It sounds like you should be setting the "Spring" property of both to
true, and using the TextAlignment properties to get both on the right and
left.

Tried that and even set the size to 50.

Set up the border and the size of the first one seems to be taking up 3/4 of
the space but it still writes of the 2nd panel and wipes out what is written
there.

Not sure what Spring does but it sounded like it would take up all available
space if set to true.

Is there a way to tell it to only take up 1/4 of the left side?

I tried setting the margins for the 2nd panel to left 500 and right of 0.

I have the settings for the 1st panel at Left 0 and right 0.

Is that a problem?

Thanks,

Tom
 
T

tshad

Family Tree Mike said:
It sounds like you may have things too complicated.

I think you are right there.
If you have two spring
labels, each will take up 50% of the status strip. If you have three,
then
each will take up 33% of the space. If you throw in some fixed size ones,
then these percentages are for the remainder after the fixed space is
used.

Once the labels are there, the text alignment property will make the
second
label appear all the way to the right. There is no need to wory about the
sizes or margins in any of this.

I now just created the 2 toolStripStatusLabels and now the 2nd one is
displaying correct, but the 1st is not.

I even tried to make a really long string:

display.StatusBar = "This is StatusBar 1This is StatusBar 1This is StatusBar
1This is StatusBar 1";

It seems to be writing blanking out the 1st status bar as the original label
text is gone. If I comment out the above statement the label text is there.
So something is definetly happening.

This is a Property (display.StatusBar) and it looks like:



string IStatusDisplay.StatusBar
{
get
{
return toolStripStatusLabel1.Text;
}
set
{
toolStripStatusLabel1.Text = value;
}
}

The other Status bar now works fine so if I do:

display.StatusBar2 = "This is StatusBar 2";

It displays correctly (at this point MiddleCenter the same as the other
panel). The property is identical and looks like:

string IStatusDisplay.StatusBar2
{
get
{
return toolStripStatusLabel2.Text;
}
set
{
toolStripStatusLabel2.Text = value;
//this.Refresh();
}
}

I dropped and recreated both panels to see if that would fix it, but it
doesn't.

Thanks,

Tom
 
T

tshad

Figured it out.

Your way worked perfectly.

But in my code on the main page I was accessing the 1st panel directly and
not by property and it was blanking it out when I re-enabled my buttons on
the page.

Thanks,

Tom

tshad said:
Family Tree Mike said:
It sounds like you may have things too complicated.

I think you are right there.
If you have two spring
labels, each will take up 50% of the status strip. If you have three,
then
each will take up 33% of the space. If you throw in some fixed size
ones,
then these percentages are for the remainder after the fixed space is
used.

Once the labels are there, the text alignment property will make the
second
label appear all the way to the right. There is no need to wory about
the
sizes or margins in any of this.

I now just created the 2 toolStripStatusLabels and now the 2nd one is
displaying correct, but the 1st is not.

I even tried to make a really long string:

display.StatusBar = "This is StatusBar 1This is StatusBar 1This is
StatusBar 1This is StatusBar 1";

It seems to be writing blanking out the 1st status bar as the original
label text is gone. If I comment out the above statement the label text
is there. So something is definetly happening.

This is a Property (display.StatusBar) and it looks like:



string IStatusDisplay.StatusBar
{
get
{
return toolStripStatusLabel1.Text;
}
set
{
toolStripStatusLabel1.Text = value;
}
}

The other Status bar now works fine so if I do:

display.StatusBar2 = "This is StatusBar 2";

It displays correctly (at this point MiddleCenter the same as the other
panel). The property is identical and looks like:

string IStatusDisplay.StatusBar2
{
get
{
return toolStripStatusLabel2.Text;
}
set
{
toolStripStatusLabel2.Text = value;
//this.Refresh();
}
}

I dropped and recreated both panels to see if that would fix it, but it
doesn't.

Thanks,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top