Thread: Spin :q

  1. #1
    Newbie Finneous's Avatar
    Join Date
    Aug 2005
    Location
    Finland
    Posts
    7

    Spin :q

    Hello,

    I'm experiencing a problem with a spin control associated with an editbox. It's supposed to act normally (increment or decrement the value by one) unless a certain condition is met, when it should add an additional 2 to the value. Eg. if the lower range was 8 and I would increment it, it would increase normally like 8, 9, 10.. but if this condition is met, it should be - in the same situation - 10, 11, 12.. Erm, if you don't understand what I'm going for, feel free to ask and I will try and explain more.

    My program checks for this certain condition in the editbox's change event, and it looks somewhat like this (I can't view the code right now):

    Code:
    void MyDialog::EditBoxChange()
    {
        int nCheck = GetCondition();
    
        if (nCheck == CERTAIN_CONDITION)
        {
             // increase the current value by additional 2 points and update the editbox
    
            return;
        }
    
        // default code
    }
    and the problem is that when the condition is met and that event launches, the fact that I've to update the editbox causes the change event to launch again. This goes on until the spin reaches its maximum value which produces an error and ends the circle. And obviously that's not my purpose ;(

    Any help is appreciated. I'm probably doing something wrong, lol

    Thank you

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    the problem is that when the condition is met and that event launches, the fact that I've to update the editbox causes the change event to launch again.
    It should be pretty obvious you can't use the onchange event. Hint: what other event occurs when the user interacts with your control?

  3. #3
    Newbie Finneous's Avatar
    Join Date
    Aug 2005
    Location
    Finland
    Posts
    7
    It should be pretty obvious you can't use the onchange event. Hint: what other event occurs when the user interacts with your control?
    Well, I would say the spin button's position change (whatever it's called)?

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    How about onclick?

  5. #5
    Newbie Finneous's Avatar
    Join Date
    Aug 2005
    Location
    Finland
    Posts
    7
    I don't see no OnClick event.. there seems to be NM_OUTOFMEMORY and UDN_DELTAPOS for the spin. I tried it with the Deltapos event, too, but basically got the same problem :s

  6. #6
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    I don't see no OnClick event..
    I assumed there must be onclick, but now that I check, you're right, there isn't one. You can ask your question in the windows programming forum, where I think you'll have better luck.

  7. #7
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    I'm not sure about MFC, but with Win32, you can use the UDM_SETACCEL message to specify the rate of increment for an up-down control.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Spin down harddrives. Worth it?
    By cyberfish in forum Tech Board
    Replies: 24
    Last Post: 06-08-2009, 01:53 PM
  2. spin control
    By rakan in forum Windows Programming
    Replies: 4
    Last Post: 01-14-2008, 11:37 AM
  3. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM
  4. Spin A Drive and such
    By Seph_31 in forum C Programming
    Replies: 15
    Last Post: 11-20-2003, 06:04 PM
  5. spin controls in Win32
    By loobian in forum Windows Programming
    Replies: 4
    Last Post: 10-21-2001, 07:49 PM