mfc >> Disabling buttons on a spinner control

by Alain Dekker » Thu, 27 Nov 2003 20:08:01 GMT

Hi,

Lets say you have a edit field that ranges from 1-1000 with an attached
spinner. Is it possible to disable the "up" button if you have reached 1000,
and the "down" button if the value has reached 1?

Many thanks,
Alain




mfc >> Disabling buttons on a spinner control

by David A. Mair » Fri, 28 Nov 2003 02:17:16 GMT





1000,

If you set the range of the spin control then the up button while staying
enabled will stop functioning at the value you set in the range, similarly
for the down button. From trivial testing with Spy++ it doesn't appear to
me that a spin control is implemented as a window with a child representing
each button. It looks like the buttons are drawn by the implementation of
the control.





mfc >> Disabling buttons on a spinner control

by Alain Dekker » Fri, 28 Nov 2003 23:00:10 GMT

Thanks for the answer David.

I realise that the button remains enabled when the limit is hit. Its just
that someone in our testing department asked this, and I couldn't see an
easy way to do it. Thinking about it, its much better that the button does
remain enabled so tht when you click "up" and the value does not increment
you have visual feedback that the limit has been reached.

Alain





representing




Disabling buttons on a spinner control

by David A. Mair » Sun, 30 Nov 2003 08:37:13 GMT

This is also the "standard" behaviour of a spin control and behaving
differently (i.e. behaving as your test department requested) would also be
to behave differently from most other Windows applications. That's
typically not a good thing to do as it can confuse users when standard
looking controls don't behave in the standard manner.







attached
staying
similarly
to
of




Similar Threads

1. Excel Spinner Control disabled

I want to add a spinner control to my worksheet.  However the controls are 
greyed out.  The worksheet is not protected, nor is it shared, and this 
affects the spinner on the Forms toolbar and the Control Toolbox.

Any ideas?

Thanks


Damien

2. Spinner Control - CSharp/C#

3. NumericUpDown Control - Discoloration if Buttons are Hidden and Control is Disabled

Hey Everyone!

I'm using an inherited version of the NumericUpDown control and hiding
the buttons using a solution I found on this board (sample code to
follow).  This works really well, unless this control is disabled.

Upon disabling the control (i.e. myControl.Enabled = false), the
UpDownEdit portion of the control changes color correctly, but the
region where the UpDownButtons used to be remains white.  Obviously,
this looks awful.

Here's the code:

public class MyNumericUpDown : System.Windows.Forms.NumericUpDown
{
     public MyNumericUpDown()
     {
          Controls[0].Visible = false;
     }
}

Here some things I've already tried that don't seem to work:

-Changing Controls[0].Size to be equal to (0,0), tried it with the
width also.
-Adding an empty event handler (i.e. return;) for the Controls[0].Paint
event.
-Event handler for EnabledChanged to change the controls BackColor
correctly (the white box still remains, go figure)

Also, if you add this as a second line to the constructor, the entire
control's back color remains constant (no white box, but no changing
color on "Enabled" changing)

this.BackColor = System.Drawing.Color.Firebrick; //color chosen for
dramatic effect

Any help you can offer is _extremely_ appreciated!  Thanks so much in
advance!

-Dave

4. How to disable the 'Number of Copies' spinner? - Visual Basic/VB

5. send message to win32 app to press button control - remote control button

Hi

I want to be able from my csharp button to start an application ( which I 
can do) and then somehow send a message to the win32 application that says 
"press the button"

The win32 application ( borland app) has a button on it that I need to click 
in order for it to start correctly.  Is this possible from csharp??

thanks
Danny 


6. [News] SCO Spinners Go Bananas or Suddenly Disappear - Linux

7. Setting Spinner and its Buddy

Hello 

I want to put a Spinner and set an Edit to its Buddy. I have some
problems:

1- I want the spinner to add/subtract 0.01 to/from the number shown in
Edit, but it just works with integers(0,1,2,3,etc.)

2-When I press ENTER on the Edit box, it terminates my program and
returns to my code (without any error)

Could anyone help me?

8. Getting Update Notification from a Spinner