469,599 Members | 2,672 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,599 developers. It's quick & easy.

Its the little things that really annoy me

Is there any quick way of fixing combo boxes or radio buttons so that on an
enquiry screen its possible to read their contents. As they don't have
read-only properties the only method available is to use the enabled
property, but this given an almost unreadable GUI.

In the VB days we used to dock troublesome controls onto frames and then
lock the frames but this is not an option anymore. Does anybody have an
alternative tip.

Its these kind of silly things that really frustrates and wastes a huge
amount of time.

Any suggestions gratefully received

Steve
Nov 16 '05 #1
5 1236
Steve Le Monnier wrote:
Is there any quick way of fixing combo boxes or radio buttons so that
on an enquiry screen its possible to read their contents. As they
don't have read-only properties the only method available is to use
the enabled property, but this given an almost unreadable GUI.

In the VB days we used to dock troublesome controls onto frames and
then lock the frames but this is not an option anymore. Does anybody
have an alternative tip.

Its these kind of silly things that really frustrates and wastes a
huge amount of time.

Any suggestions gratefully received

Steve


When a container control has its enabled property set to false, all its
contained controls are disabled, as well. For example, if the user clicks on
any of the controls contained in a disabled GroupBox control, no events are
raised.
Nov 16 '05 #2
I agree Steve, I have just spent an hour trying to make a checkbox both
"display only" only to look in the discussions and find that it seems that it
will be yet another simple thing that is difficult to do.

Before anyone replys with "disabled controls should be greyed so the user
doesn't get confused about why they can't change them"... please give some
thought to users who don't want to go blind trying to see the status of
checkboxes etc. on a web form that is solely for enquiry. As my users are not
morons, they can deal with "display only" controls being readable and in any
colour they choose.

Please someone provide a usefull response to this.

Cheers,
Jamie/James

"Steve Le Monnier" wrote:
Is there any quick way of fixing combo boxes or radio buttons so that on an
enquiry screen its possible to read their contents. As they don't have
read-only properties the only method available is to use the enabled
property, but this given an almost unreadable GUI.

In the VB days we used to dock troublesome controls onto frames and then
lock the frames but this is not an option anymore. Does anybody have an
alternative tip.

Its these kind of silly things that really frustrates and wastes a huge
amount of time.

Any suggestions gratefully received

Steve

Nov 16 '05 #3
It is not a huge deal to create a read-only checkbox. I just did it for a
VB project. Below is an off-the-cuff (untested) C# version. The basic idea
is to cancel the effect of the CheckChanged event when ReadOnly = true. I
have also set the text associated with the checkbox to a slightly greyed
color so that it's still somewhat distinguishable from a non read-only
checkbox, yet still quite readable. You could add a DisabledForeColor
property if you wanted to make that more configurable.

I haven't bothered to put in design-time checks, so this version will refuse
to let you change the Checked property in the designer unless ReadOnly =
false.

Compile this as part of a separate library and add that library to your
designer controls toolbar.

using System;
using System.Drawing;
using System.Windows.Forms;

namespace DevLib.Win.Controls {
class ReadOnlyCheckBox: CheckBox {

protected Color savedForeColor;
protected bool readOnly = false;
protected bool checkChangeFlag = false;
protected bool saveForeColorChangeFlag = true;

public ReadOnlyCheckBox() : base() {
this.savedForeColor = this.ForeColor;
}

public override Color ForeColor {
get {return base.ForeColor;}

set {
base.ForeColor = value;

if (this.saveForeColorChangeFlag == true) {
this.savedForeColor = value;
}

}

}

public virtual bool ReadOnly {
get {return this.readOnly;}

set {
this.readOnly = value;
this.saveForeColorChangeFlag = false;

if (value == true) {

if (this.savedForeColor == Color.DarkSlateGray) {
this.ForeColor = Color.DarkGray;
} else {
this.ForeColor = Color.DarkSlateGray;
}

} else {
this.ForeColor = this.savedForeColor;
}

}

}

private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{

if (this.readOnly == true) {
// Undo the change, making the control effectively read-only.
this.checkChangeFlag = true;
this.Checked = !this.Checked;
this.checkChangeFlag = false;
}

}

}

}

"James" <Ka***********@community.nospam> wrote in message
news:AA**********************************@microsof t.com...
I agree Steve, I have just spent an hour trying to make a checkbox both
"display only" only to look in the discussions and find that it seems that
it
will be yet another simple thing that is difficult to do.

Before anyone replys with "disabled controls should be greyed so the user
doesn't get confused about why they can't change them"... please give some
thought to users who don't want to go blind trying to see the status of
checkboxes etc. on a web form that is solely for enquiry. As my users are
not
morons, they can deal with "display only" controls being readable and in
any
colour they choose.

Please someone provide a usefull response to this.

Cheers,
Jamie/James

"Steve Le Monnier" wrote:
Is there any quick way of fixing combo boxes or radio buttons so that on
an
enquiry screen its possible to read their contents. As they don't have
read-only properties the only method available is to use the enabled
property, but this given an almost unreadable GUI.

In the VB days we used to dock troublesome controls onto frames and then
lock the frames but this is not an option anymore. Does anybody have an
alternative tip.

Its these kind of silly things that really frustrates and wastes a huge
amount of time.

Any suggestions gratefully received

Steve

Nov 16 '05 #4
> ... You could add a DisabledForeColor property if you wanted to make that
more configurable.
Actually I meant "a DisabledReadOnlyColor".

The VB version has a Handles clause in the CheckChanged handler declaration;
I believe this event will need to be manually wired up in the
ReadOnlyTextBox constructor.

--Bob

"Bob Grommes" <bo*@bobgrommes.com> wrote in message
news:OU**************@TK2MSFTNGP15.phx.gbl... It is not a huge deal to create a read-only checkbox. I just did it for a
VB project. Below is an off-the-cuff (untested) C# version. The basic
idea is to cancel the effect of the CheckChanged event when ReadOnly =
true. I have also set the text associated with the checkbox to a slightly
greyed color so that it's still somewhat distinguishable from a non
read-only checkbox, yet still quite readable. You could add a
DisabledForeColor property if you wanted to make that more configurable.

I haven't bothered to put in design-time checks, so this version will
refuse to let you change the Checked property in the designer unless
ReadOnly = false.

Compile this as part of a separate library and add that library to your
designer controls toolbar.

using System;
using System.Drawing;
using System.Windows.Forms;

namespace DevLib.Win.Controls {
class ReadOnlyCheckBox: CheckBox {

protected Color savedForeColor;
protected bool readOnly = false;
protected bool checkChangeFlag = false;
protected bool saveForeColorChangeFlag = true;

public ReadOnlyCheckBox() : base() {
this.savedForeColor = this.ForeColor;
}

public override Color ForeColor {
get {return base.ForeColor;}

set {
base.ForeColor = value;

if (this.saveForeColorChangeFlag == true) {
this.savedForeColor = value;
}

}

}

public virtual bool ReadOnly {
get {return this.readOnly;}

set {
this.readOnly = value;
this.saveForeColorChangeFlag = false;

if (value == true) {

if (this.savedForeColor == Color.DarkSlateGray) {
this.ForeColor = Color.DarkGray;
} else {
this.ForeColor = Color.DarkSlateGray;
}

} else {
this.ForeColor = this.savedForeColor;
}

}

}

private void checkBox1_CheckedChanged(object sender, System.EventArgs
e) {

if (this.readOnly == true) {
// Undo the change, making the control effectively read-only.
this.checkChangeFlag = true;
this.Checked = !this.Checked;
this.checkChangeFlag = false;
}

}

}

}

"James" <Ka***********@community.nospam> wrote in message
news:AA**********************************@microsof t.com...
I agree Steve, I have just spent an hour trying to make a checkbox both
"display only" only to look in the discussions and find that it seems
that it
will be yet another simple thing that is difficult to do.

Before anyone replys with "disabled controls should be greyed so the user
doesn't get confused about why they can't change them"... please give
some
thought to users who don't want to go blind trying to see the status of
checkboxes etc. on a web form that is solely for enquiry. As my users are
not
morons, they can deal with "display only" controls being readable and in
any
colour they choose.

Please someone provide a usefull response to this.

Cheers,
Jamie/James

"Steve Le Monnier" wrote:
Is there any quick way of fixing combo boxes or radio buttons so that on
an
enquiry screen its possible to read their contents. As they don't have
read-only properties the only method available is to use the enabled
property, but this given an almost unreadable GUI.

In the VB days we used to dock troublesome controls onto frames and then
lock the frames but this is not an option anymore. Does anybody have an
alternative tip.

Its these kind of silly things that really frustrates and wastes a huge
amount of time.

Any suggestions gratefully received

Steve


Nov 16 '05 #5
Thank you Bob, I will try your suggestion. I looked for a simple (attribute
setting) way to solve the problem first and then went to the discussion group
when I realised that it was another "simple" thing that was going to take
more time than I allocated. When I saw the number of responses to similar
problems which took the approach of "well never mind what the customer wants,
the platform dictates that it should be something else" implying that most
users are morons (who can't understand why they can't change someting on a
page) and/or developers/architects are incabable of making wise decisions on
UI design/behaviour. It is a bit like saying that users should not be able to
choose their fore and back colours because they may pick the same colour for
each and then wonder why they can't see anything.

Thank you again very much for spending so much time to assist me. Your
attitude is obviously much better than the responses that others have
submitted to similar questions.

Cheers, J

"Bob Grommes" wrote:
... You could add a DisabledForeColor property if you wanted to make that
more configurable.


Actually I meant "a DisabledReadOnlyColor".

The VB version has a Handles clause in the CheckChanged handler declaration;
I believe this event will need to be manually wired up in the
ReadOnlyTextBox constructor.

--Bob

"Bob Grommes" <bo*@bobgrommes.com> wrote in message
news:OU**************@TK2MSFTNGP15.phx.gbl...
It is not a huge deal to create a read-only checkbox. I just did it for a
VB project. Below is an off-the-cuff (untested) C# version. The basic
idea is to cancel the effect of the CheckChanged event when ReadOnly =
true. I have also set the text associated with the checkbox to a slightly
greyed color so that it's still somewhat distinguishable from a non
read-only checkbox, yet still quite readable. You could add a
DisabledForeColor property if you wanted to make that more configurable.

I haven't bothered to put in design-time checks, so this version will
refuse to let you change the Checked property in the designer unless
ReadOnly = false.

Compile this as part of a separate library and add that library to your
designer controls toolbar.

using System;
using System.Drawing;
using System.Windows.Forms;

namespace DevLib.Win.Controls {
class ReadOnlyCheckBox: CheckBox {

protected Color savedForeColor;
protected bool readOnly = false;
protected bool checkChangeFlag = false;
protected bool saveForeColorChangeFlag = true;

public ReadOnlyCheckBox() : base() {
this.savedForeColor = this.ForeColor;
}

public override Color ForeColor {
get {return base.ForeColor;}

set {
base.ForeColor = value;

if (this.saveForeColorChangeFlag == true) {
this.savedForeColor = value;
}

}

}

public virtual bool ReadOnly {
get {return this.readOnly;}

set {
this.readOnly = value;
this.saveForeColorChangeFlag = false;

if (value == true) {

if (this.savedForeColor == Color.DarkSlateGray) {
this.ForeColor = Color.DarkGray;
} else {
this.ForeColor = Color.DarkSlateGray;
}

} else {
this.ForeColor = this.savedForeColor;
}

}

}

private void checkBox1_CheckedChanged(object sender, System.EventArgs
e) {

if (this.readOnly == true) {
// Undo the change, making the control effectively read-only.
this.checkChangeFlag = true;
this.Checked = !this.Checked;
this.checkChangeFlag = false;
}

}

}

}

"James" <Ka***********@community.nospam> wrote in message
news:AA**********************************@microsof t.com...
I agree Steve, I have just spent an hour trying to make a checkbox both
"display only" only to look in the discussions and find that it seems
that it
will be yet another simple thing that is difficult to do.

Before anyone replys with "disabled controls should be greyed so the user
doesn't get confused about why they can't change them"... please give
some
thought to users who don't want to go blind trying to see the status of
checkboxes etc. on a web form that is solely for enquiry. As my users are
not
morons, they can deal with "display only" controls being readable and in
any
colour they choose.

Please someone provide a usefull response to this.

Cheers,
Jamie/James

"Steve Le Monnier" wrote:

Is there any quick way of fixing combo boxes or radio buttons so that on
an
enquiry screen its possible to read their contents. As they don't have
read-only properties the only method available is to use the enabled
property, but this given an almost unreadable GUI.

In the VB days we used to dock troublesome controls onto frames and then
lock the frames but this is not an option anymore. Does anybody have an
alternative tip.

Its these kind of silly things that really frustrates and wastes a huge
amount of time.

Any suggestions gratefully received

Steve



Nov 16 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Marc | last post: by
45 posts views Thread by Adrian | last post: by
18 posts views Thread by Philipp Lenssen | last post: by
38 posts views Thread by Martin Marcher | last post: by
8 posts views Thread by Perception | last post: by
2 posts views Thread by Daniel | last post: by
14 posts views Thread by CMM | last post: by
37 posts views Thread by John Salerno | last post: by
52 posts views Thread by a\\/b | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.