473,387 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 1380
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Marc | last post by:
Hi all, I am trying to write an application where I need the ability to open an Excel spreadsheet and do basic read/write, insert rows, and hide/unhide rows. Using win32com I have been able to...
45
by: Adrian | last post by:
I am looking for a free web sourse with little images, particularly the union jack, but also others. Does anyone know of such a source? Many thanks, Adrian.
18
by: Philipp Lenssen | last post by:
I want to write a third installment of "Little Known HTML Facts"*. I would appreciate your input here. For one thing, I would like to remember what exactly those proprietary icons were you could...
38
by: Martin Marcher | last post by:
Hi, I've read several questions and often the answer was 'C knows nothing about .' So if C knows that little as some people say, what are the benefits, I mean do other languages know more...
8
by: Perception | last post by:
Hello all, If I have a C-like data structure such that struct Data { int a; //16-bit value char; //3 ASCII characters int b; //32-bit value int c; //24-bit value }
2
by: Daniel | last post by:
I'm new to .Net and all of its abilities so I hope this makes sense. Basically I'm confused on when is the appropriate time to use web forms controls vs. regular HTML. For example in ASP...
14
by: CMM | last post by:
Do the developers of Visual 2005 actuall use it??? There's lots of great things in VS2005 (mostly related to the outstanding work done on the CLR)... but in general the LITTLE THINGS totally drag...
37
by: John Salerno | last post by:
I contacted my domain host about how Python is implemented on their server, and got this response: ------------------- Hello John, Please be informed that the implementation of python in our...
52
by: ¬a\\/b | last post by:
is it possible that a malloc function that use a nobody student is better than all yours :) How many errors do you see? Bug1: memory<13MB Bug2: it seems do you have to write you own sprintf...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.