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. Spin Control Problem!!!

Spin Control Problem!!!

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelplearning
6 Posts 4 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.
  • D Offline
    D Offline
    Daniel Strigl
    wrote on last edited by
    #1

    I have added a CEdit control and CSpin control to my dialog in the resource editor. So I attached the CSpin control to my CEdit control to inc and dec the value in the edit! But now, I have the problem, that the spin is working the wrong way! When I click the up button of the spin, the value in the edit will dec, and when I click the down button the value will inc! That's not what I am want! How can I change this???? -- Nice greets, Daniel.

    D G N 3 Replies Last reply
    0
    • D Daniel Strigl

      I have added a CEdit control and CSpin control to my dialog in the resource editor. So I attached the CSpin control to my CEdit control to inc and dec the value in the edit! But now, I have the problem, that the spin is working the wrong way! When I click the up button of the spin, the value in the edit will dec, and when I click the down button the value will inc! That's not what I am want! How can I change this???? -- Nice greets, Daniel.

      D Offline
      D Offline
      Dimitri Rochette
      wrote on last edited by
      #2

      The "wrong way" is the default way for spin controls. you will have to use a SetRange32( int nLower, int nUpper ); Set nLower to the MAXIMUN set nUpper to the MINIMUM

      D 1 Reply Last reply
      0
      • D Dimitri Rochette

        The "wrong way" is the default way for spin controls. you will have to use a SetRange32( int nLower, int nUpper ); Set nLower to the MAXIMUN set nUpper to the MINIMUM

        D Offline
        D Offline
        Daniel Strigl
        wrote on last edited by
        #3

        Thanks! -- Nice greets, Daniel.

        1 Reply Last reply
        0
        • D Daniel Strigl

          I have added a CEdit control and CSpin control to my dialog in the resource editor. So I attached the CSpin control to my CEdit control to inc and dec the value in the edit! But now, I have the problem, that the spin is working the wrong way! When I click the up button of the spin, the value in the edit will dec, and when I click the down button the value will inc! That's not what I am want! How can I change this???? -- Nice greets, Daniel.

          G Offline
          G Offline
          Gero Gerber
          wrote on last edited by
          #4

          Hi Daniel, use CSpinButtonCtrl::SetRange(MIN_VALUE, MAX_VALUE) - this adjusts in which direction you have to press the arrows in order to de- or increase the value in the buddy CEdit box. Gero

          1 Reply Last reply
          0
          • D Daniel Strigl

            I have added a CEdit control and CSpin control to my dialog in the resource editor. So I attached the CSpin control to my CEdit control to inc and dec the value in the edit! But now, I have the problem, that the spin is working the wrong way! When I click the up button of the spin, the value in the edit will dec, and when I click the down button the value will inc! That's not what I am want! How can I change this???? -- Nice greets, Daniel.

            N Offline
            N Offline
            Nilesh Karkhanis
            wrote on last edited by
            #5

            Hi Daniel, You can either give the ranges other way round or you can override CWnd's OnNotify method BOOL YourClass::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { LPNMHDR pnmh = (LPNMHDR) lParam; if(pnmh->code == UDN_DELTAPOS ) { NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pnmh; // Check whether the value should be incremented or decremented if(pNMUpDown->iDelta < 0) { //value should be decremented } else { // value should be incremented } } return true; } -ve value of delta would suggest decrement and +ve would suggest increment you can reverse the ways if you like. Hope that would be of your help. Nilesh :)

            D 1 Reply Last reply
            0
            • N Nilesh Karkhanis

              Hi Daniel, You can either give the ranges other way round or you can override CWnd's OnNotify method BOOL YourClass::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { LPNMHDR pnmh = (LPNMHDR) lParam; if(pnmh->code == UDN_DELTAPOS ) { NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pnmh; // Check whether the value should be incremented or decremented if(pNMUpDown->iDelta < 0) { //value should be decremented } else { // value should be incremented } } return true; } -ve value of delta would suggest decrement and +ve would suggest increment you can reverse the ways if you like. Hope that would be of your help. Nilesh :)

              D Offline
              D Offline
              Daniel Strigl
              wrote on last edited by
              #6

              Thanks! -- Nice greets, Daniel.

              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