Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. SpinControl Help

SpinControl Help

Scheduled Pinned Locked Moved C / C++ / MFC
helplounge
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VanHlebar
    wrote on last edited by
    #1

    I have a dialog with 6 spin controls on it. The controls are populated with a random number in the OnInitDialog method. Once one of the spin controls is increased I would like to turn off the other 5 so that they can't be changed. If the original control was then later decreased then I need to turn on the all of the controls again so that they may be changed. I have tried to do this the VScroll message handler but it seems that the buddy window is updated before or independant of this message handler. Thanks for the help, -Eric

    I 1 Reply Last reply
    0
    • V VanHlebar

      I have a dialog with 6 spin controls on it. The controls are populated with a random number in the OnInitDialog method. Once one of the spin controls is increased I would like to turn off the other 5 so that they can't be changed. If the original control was then later decreased then I need to turn on the all of the controls again so that they may be changed. I have tried to do this the VScroll message handler but it seems that the buddy window is updated before or independant of this message handler. Thanks for the help, -Eric

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      You might be able to lock out the buddy changing by looking at EN_UPDATE (or is it EN_CHANGE...) Alternatively, turn off the buddying on the other controls with UDM_SETBUDDY (NULL) and re- connect them when your changed spinner goes back to its initial value. Iain.

      V 2 Replies Last reply
      0
      • I Iain Clarke Warrior Programmer

        You might be able to lock out the buddy changing by looking at EN_UPDATE (or is it EN_CHANGE...) Alternatively, turn off the buddying on the other controls with UDM_SETBUDDY (NULL) and re- connect them when your changed spinner goes back to its initial value. Iain.

        V Offline
        V Offline
        VanHlebar
        wrote on last edited by
        #3

        Iain, Thanks for the help. I have used the EN_CHANGE message for each edit control and then I turned off the other spin controls if one was increased. The problem is that when the user clicks up again it will turn them all back on again. Here is a snippet of my code. Any ideas? I want to be able to only increase one of the 6 spin controls then turn off the rest. If the users then decreases the one spin control by one then it needs to turn the other controls back on again. void CMyDialog::OnChangeEditOne() { if(!bFirstRun) { if(!bOne) { m_cTwo.EnableWindow(FALSE); m_cThree.EnableWindow(FALSE); m_cFour.EnableWindow(FALSE); m_cFive.EnableWindow(FALSE); m_cSix.EnableWindow(FALSE); m_cOk.EnableWindow(TRUE); bOne = TRUE; } else { m_cTwo.EnableWindow(TRUE); m_cThree.EnableWindow(TRUE); m_cFour.EnableWindow(TRUE); m_cFive.EnableWindow(TRUE); m_cSix.EnableWindow(TRUE); m_cOk.EnableWindow(FALSE); bOne = FALSE; } } else bFirstRun = FALSE; } Thanks again. -Eric

        1 Reply Last reply
        0
        • I Iain Clarke Warrior Programmer

          You might be able to lock out the buddy changing by looking at EN_UPDATE (or is it EN_CHANGE...) Alternatively, turn off the buddying on the other controls with UDM_SETBUDDY (NULL) and re- connect them when your changed spinner goes back to its initial value. Iain.

          V Offline
          V Offline
          VanHlebar
          wrote on last edited by
          #4

          Iain, Thanks for the help. I have used the EN_CHANGE message for each edit control and then I turned off the other spin controls if one was increased. The problem is that when the user clicks up again it will turn them all back on again. Here is a snippet of my code. Any ideas? I want to be able to only increase one of the 6 spin controls then turn off the rest. If the users then decreases the one spin control by one then it needs to turn the other controls back on again. void CMyDialog::OnChangeEditOne() { if(!bFirstRun) { if(!bOne) { m_cTwo.EnableWindow(FALSE); m_cThree.EnableWindow(FALSE); m_cFour.EnableWindow(FALSE); m_cFive.EnableWindow(FALSE); m_cSix.EnableWindow(FALSE); m_cOk.EnableWindow(TRUE); bOne = TRUE; } else { m_cTwo.EnableWindow(TRUE); m_cThree.EnableWindow(TRUE); m_cFour.EnableWindow(TRUE); m_cFive.EnableWindow(TRUE); m_cSix.EnableWindow(TRUE); m_cOk.EnableWindow(FALSE); bOne = FALSE; } } else bFirstRun = FALSE; } Thanks again. -Eric

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups