By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,469 Members | 2,402 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,469 IT Pros & Developers. It's quick & easy.

Enable/Disable Labels

P: n/a
Tom
Hi:

When you disable a text box you get the "ghost effect" on the
associated label control. How can you mimic that same effect on a
label not associated with a text box?

Basically, the setup I have is:

lblControlName txtControl lblUnit

Where:
lblControlName is the title of the control (e.g., "Density")
txtControl is the value (e.g., 8.34)
lblUnit is the unit for the control (e.g., "lbs/gal")

For certain records I need to disable txtControl because I don't what
the user entering data. When I set enabled = false for txtControl,
lblControlName also goes to ghost. However, lblUnit doesn't and it
looks funny. How do I get it to mimic the ghost effect?

Thanks
Tom

Dec 20 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
MLH
Faced with the same dilemma in the past, I have resorted to
setting the label's Foreground and Background properties to
the colors in which the 'grayed out' text boxes are displayed
in. I seem to remember launching a discusion on that topic
on this NG a good while back and that was the best that
turned up.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx
On 20 Dec 2006 08:59:25 -0800, "Tom" <rt*****@swbell.netwrote:
>Hi:

When you disable a text box you get the "ghost effect" on the
associated label control. How can you mimic that same effect on a
label not associated with a text box?

Basically, the setup I have is:

lblControlName txtControl lblUnit

Where:
lblControlName is the title of the control (e.g., "Density")
txtControl is the value (e.g., 8.34)
lblUnit is the unit for the control (e.g., "lbs/gal")

For certain records I need to disable txtControl because I don't what
the user entering data. When I set enabled = false for txtControl,
lblControlName also goes to ghost. However, lblUnit doesn't and it
looks funny. How do I get it to mimic the ghost effect?

Thanks
Tom
Dec 20 '06 #2

P: n/a
Tom, this isn't a very elegant solution, but it works: you can make one long
label that contains both the control name and the units, with a big gap in
the middle that you cover up with the textbox. If this long label is
associated with the textbox, the whole thing will grey out when you disable
the textbox.
-John

"Tom" <rt*****@swbell.netwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
Hi:

When you disable a text box you get the "ghost effect" on the
associated label control. How can you mimic that same effect on a
label not associated with a text box?

Basically, the setup I have is:

lblControlName txtControl lblUnit

Where:
lblControlName is the title of the control (e.g., "Density")
txtControl is the value (e.g., 8.34)
lblUnit is the unit for the control (e.g., "lbs/gal")

For certain records I need to disable txtControl because I don't what
the user entering data. When I set enabled = false for txtControl,
lblControlName also goes to ghost. However, lblUnit doesn't and it
looks funny. How do I get it to mimic the ghost effect?

Thanks
Tom

Dec 20 '06 #3

P: n/a
Another approach is to associate the label with an unbound textbox.
Set the textbox width to 0, special effect to flat, border and
background to transparent, and tab stop to 'no'. The textbox will be
effectively hidden at that point and its associated label can be
'disabled' by disabling the textbox.

Bruce

Dec 20 '06 #4

P: n/a
Tom
Thanks to all 3 of you for your thoughts. It seems like there are a
few work arounds, but no elegant solutions. <sigh>.

Bruce - I think I like your solution the best, it seems to be the one
least likely to have unexpected problems crop up at a later date.

Tom
de***************@gmail.com wrote:
Another approach is to associate the label with an unbound textbox.
Set the textbox width to 0, special effect to flat, border and
background to transparent, and tab stop to 'no'. The textbox will be
effectively hidden at that point and its associated label can be
'disabled' by disabling the textbox.

Bruce
Dec 20 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.