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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Spin Control

Spin Control

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
2 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.
  • D Offline
    D Offline
    Daniel Visan
    wrote on last edited by
    #1

    How to make spin control work with double or float data types?

    R 1 Reply Last reply
    0
    • D Daniel Visan

      How to make spin control work with double or float data types?

      R Offline
      R Offline
      Roger Allen
      wrote on last edited by
      #2

      This is fairly easy to do. Do the following steps: 1: Set the range of value: If you want a step of 0.1 and a min equal to 0.0 and a max equal to 10.0, the range of value of your spin control must be 0-100 (100 = 10/0.1) 2: Add a message handler for WM_VSCROLL

      void CDialog::OnVScroll ( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
      {
      if (nSBCode == SB_ENDSCROLL)
      return ;

      if (pScrollBar->GetDlgCtrlID() === IDC\_SPIN) // your spin ID here
      	{
      	CString strValue ;
      	strValue.Format("%3.1f", (double)(nPos / 10.0)) ;
      	((CSpinButtonCtrl\*)pScrollBar)->GetBuddy()->SetWindowText(strValue) ;
      	}
      

      }

      Roger Allen Sonork 100.10016 If I'm not breathing, I'm either dead or holding my breath. A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?

      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