Tip: Difference between a Command Button and a Label

T

Tom Ellison

The first difference is that the corners of a command button are rounded. I
do like that appearance.

Both a command button and a label have click events, so the label can
function as a command button.

The label has an advantage I find quite wonderful. You can assign it a
background color. It can react to situations. It can tell you there is a
state to the data, and when you click on it, it can display information
about that state, so you can fix it.

To a command button, you cannot assign a background color. It does allow a
picture to be placed in it, which a label does not, so if you're into
drawing pictures, the command button it your control.

For pictures, use the image control, which has a click event and a
background color.

I have wondered why the otherwise terrific Command Button control does not
have background color control. Other than it's nice rounded corners, it is
really quite redundant in its capabilities. Maybe we could get a "corner
rounding" property on some other controls.

I have found that, to attract a user's attention, coloring a label is quite
superior to having a command button's nicer shape. For example, in the
header of forms, I place command buttons colored yellow. My users know
these buttons expose combo boxes used to filter the form, and they change to
pale green when a filter is active. Click them again and the filter is
removed, the combo box is made invisible, and it is yellow again. This
becomes quickly intuitive to my users. Usually after being shown only once
how to use one they know how to use additional ones without asking.

I recommend you carefully consider having a standard set of colors for
labels, and use them instead of command buttons.

Tom Ellison

If anyone would care to post this to a web site, you have my permission,
providing you notify me here or by email and give me the URL of the web site
and an email address where I can request changes to this message. You must
attribute this to me, please, and give me access to repair or enhance it.
You may, of course, remove it from your site without notice, though I'd
prefer to know why, if you please.

To those reading this post in the newsgroup, just enjoy!
 
T

Tom Ellison

This did not come out very well, so let me make a correction:



The first difference is that the corners of a command button are rounded. I
do like that appearance.

Both a command button and a label have click events, so the label can
function as a command button.

The label has an advantage I find quite wonderful. You can assign it a
background color. It can react to situations. It can tell you there is a
state to the data, and when you click on it, it can display information
about that state, so you can fix it.

To a command button, you cannot assign a background color. It does allow a
picture to be placed in it, which a label does not, so if you're into
drawing pictures, use the image control, which has a click event and a
background color.

I have wondered why the otherwise terrific Command Button control does not
have background color control. Other than it's nice rounded corners, it is
really quite redundant in its capabilities. Maybe we could get a "corner
rounding" property on some other controls.

I have found that, to attract a user's attention, coloring a label is quite
superior to having a command button's nicer shape. For example, in the
header of forms, I place command buttons colored yellow. My users know
these buttons expose combo boxes used to filter the form, and they change to
pale green when a filter is active. Click them again and the filter is
removed, the combo box is made invisible, and it is yellow again. This
becomes quickly intuitive to my users. Usually after being shown only once
how to use one they know how to use additional ones without asking.

I recommend you carefully consider having a standard set of colors for
labels, and use them instead of command buttons.

Tom Ellison

If anyone would care to post this to a web site, you have my permission,
providing you notify me here or by email and give me the URL of the web site
and an email address where I can request changes to this message. You must
attribute this to me, please, and give me access to repair or enhance it.
You may, of course, remove it from your site without notice, though I'd
prefer to know why, if you please.

To those reading this post in the newsgroup, just enjoy!
 
K

Keith Wilby

Tom Ellison said:
I have found that, to attract a user's attention, coloring a label is
quite superior to having a command button's nicer shape. For example, in
the header of forms, I place command buttons colored yellow. My users
know these buttons expose combo boxes used to filter the form, and they
change to pale green when a filter is active. Click them again and the
filter is removed, the combo box is made invisible, and it is yellow
again. This becomes quickly intuitive to my users. Usually after being
shown only once how to use one they know how to use additional ones
without asking.

I recommend you carefully consider having a standard set of colors for
labels, and use them instead of command buttons.

The buttons in my apps are the default grey and I see no reason to change
them. They all have legends to identify their purpose to the end user. I
once flirted with different colours but IMO you end up with a gaudy mess.
Colour is also not much use if any of your users have any degree of colour
blindness. And what happens if the users get used to one developer's colour
coding and then are faced with a different set from another?
Tom Ellison

If anyone would care to post this to a web site, you have my permission,
providing you notify me here or by email and give me the URL of the web
site and an email address where I can request changes to this message.
You must attribute this to me, please, and give me access to repair or
enhance it. You may, of course, remove it from your site without notice,
though I'd prefer to know why, if you please.

Why do you think that you have some sort of copyright over the use of colour
coding? I'm not trying to be hostile, just wondered.

Keith.
 
T

Tom Ellison

Dear Keith:

This is a tip. You are certainly permitted to take it or not.

I understand your concern about consistency of color coding. This can be
overcome by allowing the users to select colors that correspond with their
preferences, and saving them in a table. The users could then standardize
colors as they wish, especially if they have become accustomed to a given
scheme. That's actually a nice enhancement possibility I hadn't considered
before. If you like, I'll credit you in a later version of this article for
inspiring that. May I quote your question:

"what happens if the users get used to one developer's colour coding and
then are faced with a different set from another?"

I would think the answer is to build an array and store in that the selected
colors for a few different label button types. If this is done when the
application opens, it would take no time to assign them as each form opens
and functions, resulting in those color changes.

I am not asking for a patent on an idea here, but on a modest level of
authors rights as a courtesy. The only consideration I ask is with respect
to duplicating what I have written, that I be given the priviledge of
modifying it or withdrawing it, and that I be named in credit for writing it
(not owning it). I do not think those who might want it on a web site would
have any problem with that. Several have done so with other articles, and
always gladly credit me by name.

Tom Ellison
 
K

Keith Wilby

Tom Ellison said:
Dear Keith:

This is a tip. You are certainly permitted to take it or not.

I understand your concern about consistency of color coding. This can be
overcome by allowing the users to select colors that correspond with their
preferences, and saving them in a table. The users could then standardize
colors as they wish, especially if they have become accustomed to a given
scheme. That's actually a nice enhancement possibility I hadn't
considered before. If you like, I'll credit you in a later version of
this article for inspiring that. May I quote your question:

"what happens if the users get used to one developer's colour coding and
then are faced with a different set from another?"

I would think the answer is to build an array and store in that the
selected colors for a few different label button types. If this is done
when the application opens, it would take no time to assign them as each
form opens and functions, resulting in those color changes.

I am not asking for a patent on an idea here, but on a modest level of
authors rights as a courtesy. The only consideration I ask is with
respect to duplicating what I have written, that I be given the priviledge
of modifying it or withdrawing it, and that I be named in credit for
writing it (not owning it). I do not think those who might want it on a
web site would have any problem with that. Several have done so with
other articles, and always gladly credit me by name.

I think that the amount of effort required to implement such a feature would
far outweigh any benefits (which in my experience would be zero). I think
the user would tend to remember the *position* of objects rather than their
colour. Try moving one command button on a form and see how long it takes
for the user to locate it and complain that they'd prefer it back where it
was.

I also disagree with the concept of anyone "owning" what they write here
since this is a public forum intended for *free* exchange of information and
ideas, and the concept of colour coding items in anything isn't exactly new.
Again let me emphasise that I am not being hostile but I think we'll just
have to agree to disagree on this. :)

Keith.
 
R

Rick Brandt

Tom said:
The first difference is that the corners of a command button are
rounded. I do like that appearance.

Both a command button and a label have click events, so the label can
function as a command button. [snip]

One big disadvantage of using labels and images is that they cannot have focus
and therefore cannot be used without the mouse. For many the ability to use
Enter or the space bar to click a button would not be given up without protest.
 
R

RoyVidar

Tom Ellison wrote in message said:
Both a command button and a label have click events, so the label can
function as a command button.

Some times, I'll use buttons to move items up or down in lists. In such
case, some users will issue several clicks rather fast, to move it a
certain distance. There's probably also other usages of buttons/labels
too, where rapid clicking is behaviour to be expected from users.

When doing fast clicking on lables, I've found that the labels on click
event doesn't fire for each click - there seems to be some kind of
delay, where it seems the next click is not accepted/received at all if
it occurs to "short" after the previous click. I think the same goes
for
the MouseDown event.

Command buttons seems to fire the routine per each click.
 
B

BruceM

The idea of using a label as a command button has been around for quite some
time. A Google groups search should find quite a few entries on this very
topic. Some go into additional detail about using the Mouse Down and Mouse
Up events to simulate the look of a command button when it is clicked. Some
of the postings will be mine, but I do not claim (nor have I even for one
instant considered claiming) any sort of authorship, nor did the person or
people from whom I borrowed the idea. You would do well, before claiming
authorship or any sort of intellectual property consideration, to conduct
some research.
While it is true that a label will give you some formatting options not
available with command buttons, there are also limitations. For one thing,
a label can't be in your tab order, and label events can only be triggered
by the mouse. A label does not have a Got Focus, Lost Focus, Enter, or Exit
event (and maybe others, but these are the ones I can recall offhand).
These may not matter, but there are certainly significant differences
between the two types of control.
A Google search will reveal a number of places where you can download free
command button graphics that can be placed as pictures on command buttons.
I also use standard graphics for custom navigation buttons, etc. I will
just observe that my opinion about whether or not to use colors, graphics,
etc. is not necessarily the last word. Sometimes there needs to be
something other than gray. I would also like to comment, as a person with
color deficiency in my vision (aka color blindness) that some color
combinations are particularly troublesome, such as medium red or green
lettering on a textured gray background, or some combinations of green and
red together.
A graphic on a command button will leave the (gray) edges of the button as a
border. If you are troubled by that, and if you are satisfied with a
label's limitations as a command button, that is certainly an option. For
full command button functionality along with color options, one choice may
be found on Lebans site:
http://www.lebans.com/cmdbutton.htm
 
T

Tom Ellison

Dear Rick:

It is always possible to hot key the function of a control, and to advartise
that by underlining a character in the control's text, so that users can
access its function without using the mouse.

Having a button that changes colors to indicate various situations would
still be useful as it provides information to the user. We strive to
provide that functionality whenever it would be useful.

Tom Ellison


Rick Brandt said:
Tom said:
The first difference is that the corners of a command button are
rounded. I do like that appearance.

Both a command button and a label have click events, so the label can
function as a command button. [snip]

One big disadvantage of using labels and images is that they cannot have
focus and therefore cannot be used without the mouse. For many the
ability to use Enter or the space bar to click a button would not be given
up without protest.
 
T

Tom Ellison

Dear Roy:

I would want to test and verify what you say. It's very useful to know.

When such multiple clicks are likely, I have typically used more than one
button. A second button could, for instance, replace the clicking of the
first one 5 times, for example, it would scroll the control 5 lines instead
of one. The exact multiplier would probably depend on the height of the
control, so that it could be the number of rows displayed, or the numbe of
rows minus 1. This could speed things up considerably. I have also used
the scroll bar control to do things similarly.

Thanks for your "tip" on mine!

Tom Ellison
 
T

Tom Ellison

Dear Bruce:

Thanks for your excellent comments.

You cannot place the focus on a label. Hence, you also cannot tab through
it. You can, however, tab though a text box with a zero width (hence it is
invisible without being Visible = False). The events of that text box can
function just as the events of a command button would, making the action
appear as though the label "has the focus" and can be "clicked" with Enter.
If such functionality is essential, it's not hard to implement this. Or,
you could just use a text box and inhibit any typing in it, instead of using
a label. I chose the label because of simplicity.

I, too, am slightly color blind, blue-green. I tend to avoid those
combinations as they may be difficult to distinguish. I've never heard of
yellow-pink color blindness (which are the first colors I tend to use) but
it's still a good point you make. Most of my colored labels are gray and
yellow, and occasionally pink as well.

The point of a tip isn't to assert "here is something new" but to inform
those unfamiliar with a possibility. That's what I'd like to convey with my
brief article. Some of my friends will see this here, and may choose to
post it on their web sites. It's a good thing to open it up for comment,
and get other good ideas. Some of the responses here show that making
colors available on a command button would be helpful. That may even stir
some thinking at Microsoft.

Mr. Leban's work is, as usual, outstanding. The point is not that there are
not alternatives. The first point is to expose the functionality of putting
color options on something you can click on. Which one of many options is
used to do this is not the main thrust of my suggestions. I believe my
article should also make reference to such alternatives. It is certainly
not the point that using a label is the only way to do this, but that there
is utility in doing something like this.

Thanks,
Tom Ellison
 
B

BruceM

Tom, thanks for your courteous reply to what I see now was a confrontational
tone in my remarks. I really must apologize for that. I did intend to
point out that I was familiar with using a label as a command button, as
were the people from whom I borrowed the idea, so I will admit I was puzzled
by what I took to be a request for acknowledgement. On another point, I
have read your many informed replies to questions in this forum, and I could
have assumed that you are familiar with Lebans' site. Also, I have to say
that I honestly thought I was replying to somebody whose name I did not
recognize, perhaps because I looked too hastily at the list of messages in
my newsreader, and clicked the reply button without looking more closely at
the message. No matter who posted, though, a courteous reply would have
been more appropriate. I am familiar with your postings in this forum, and
would certainly not have suggested that you do some research, because I know
that you are well aware of how to search newsgroups.

As for practical matters, I hadn't thought about the zero-width text box.

It is quite curious, and rather frustrating, that Microsoft does not allow
for colored command buttons. As you point out, there is certainly interest
in having that functionality. It is one of many points about which they
could probably do something if they cared to take notice, but the way in
which thinking is stirred at Microsoft is to me an inscrutable mystery. I
do not agree with the thinking that says since gray is the default it's good
enough, but we all make choices. I'm sure some of mine are questionable to
somebody with other priorities.

Thanks again for the kind tone of your reply.
 
T

Tom Ellison

Dear Bruce:

I didn't take that much offense at what you posted. It was informative and
useful. On reason for posting a Tip here is to get feedback and to improve
the Tip before it becomes published. I'd like to include some changes based
on your comments, which were certainly useful and intelligent. Your tone
was not as important to me as your careful expression of issues that do need
attending.

It is my desire to make friends here, and even if I do see things that are
inflamatory, I don't choose to reply in kind. Perhaps I will have made a
friend in you by doing this, which validates my approach, and reinforces it.

I really have seen a bit of flame in this thread, which just tells me I need
to expand and polish this tip before it goes any farther. Also, I need to
be clear as to who is targeted by a tip. This one was meant for those just
getting started in form design, not for those more accomplished. I should
put a section in the Tip for more advanced use, and include what has been
pointed out here, so the Tip can benefit a wider audience. Those using the
simple form of the tip can then look forward to progressing to more complex
methods as time goes along.

Tom Ellison
 

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