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

Spin control

Scheduled Pinned Locked Moved C / C++ / MFC
help
11 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.
  • A Offline
    A Offline
    ashish dogra
    wrote on last edited by
    #1

    hi i want to know that how spin control can be attached to its buddy that is some edit control and i want to know that CWnd *pParent is used in dialpog based. if we use pParent in pWndbuddy in followng statement: m_spin.SetBuddy(CWnd *pWndbuddy) then it gives error so tellme wat can i use here. Ashish Dogra MCA Noida

    _ P 2 Replies Last reply
    0
    • A ashish dogra

      hi i want to know that how spin control can be attached to its buddy that is some edit control and i want to know that CWnd *pParent is used in dialpog based. if we use pParent in pWndbuddy in followng statement: m_spin.SetBuddy(CWnd *pWndbuddy) then it gives error so tellme wat can i use here. Ashish Dogra MCA Noida

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      You can set the buddy for the spin control as //m_spinCtrl is variable for the spin control and m_editctrl for edit box m_spinCtrl .SetBuddy (m_editctrl.GetWindow(IDC_EDIT1)); Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

      A 1 Reply Last reply
      0
      • A ashish dogra

        hi i want to know that how spin control can be attached to its buddy that is some edit control and i want to know that CWnd *pParent is used in dialpog based. if we use pParent in pWndbuddy in followng statement: m_spin.SetBuddy(CWnd *pWndbuddy) then it gives error so tellme wat can i use here. Ashish Dogra MCA Noida

        P Offline
        P Offline
        Parthi_Appu
        wrote on last edited by
        #3

        hi can explain clearly .. and if u r using the exact code in ur program then it won't work, remove the CWnd* and use pWndbuddy alone

        A 1 Reply Last reply
        0
        • _ _AnsHUMAN_

          You can set the buddy for the spin control as //m_spinCtrl is variable for the spin control and m_editctrl for edit box m_spinCtrl .SetBuddy (m_editctrl.GetWindow(IDC_EDIT1)); Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

          A Offline
          A Offline
          ashish dogra
          wrote on last edited by
          #4

          sir thanks for reply but it does not work as i use this in oninitdialog function m_spin.SetBuddy(m_edit.GetWindow(IDC_EDIT2)); whwre m_spin is variable of spin control and m_edit is variable of edit control. Ashish Dogra MCA Noida

          _ 1 Reply Last reply
          0
          • A ashish dogra

            sir thanks for reply but it does not work as i use this in oninitdialog function m_spin.SetBuddy(m_edit.GetWindow(IDC_EDIT2)); whwre m_spin is variable of spin control and m_edit is variable of edit control. Ashish Dogra MCA Noida

            _ Offline
            _ Offline
            _AnsHUMAN_
            wrote on last edited by
            #5

            You need to override the function for OnDeltaposSpin1:

            void CTestDlg::OnDeltaposSpin1(NMHDR *pNMHDR, LRESULT *pResult)
            {
            	LPNMUPDOWN pNMUpDown = reinterpret_cast(pNMHDR);
            	CString s;s.Format ("%d",pNMUpDown->iPos );
            	m_edit.SetWindowText (s);
            	// TODO: Add your control notification handler code here
            	*pResult = 0;
            }
            

            Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

            A 1 Reply Last reply
            0
            • _ _AnsHUMAN_

              You need to override the function for OnDeltaposSpin1:

              void CTestDlg::OnDeltaposSpin1(NMHDR *pNMHDR, LRESULT *pResult)
              {
              	LPNMUPDOWN pNMUpDown = reinterpret_cast(pNMHDR);
              	CString s;s.Format ("%d",pNMUpDown->iPos );
              	m_edit.SetWindowText (s);
              	// TODO: Add your control notification handler code here
              	*pResult = 0;
              }
              

              Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

              A Offline
              A Offline
              ashish dogra
              wrote on last edited by
              #6

              sir where is this OnDeltaposSpin1 function as this is not in the classwizard or message handler Ashish Dogra MCA Noida

              _ 1 Reply Last reply
              0
              • P Parthi_Appu

                hi can explain clearly .. and if u r using the exact code in ur program then it won't work, remove the CWnd* and use pWndbuddy alone

                A Offline
                A Offline
                ashish dogra
                wrote on last edited by
                #7

                ya thanks as in many function that include CWnd pointer and i check in application the CWnd pointer is *pParent what when i use this one it gives error Ashish Dogra MCA Noida

                1 Reply Last reply
                0
                • A ashish dogra

                  sir where is this OnDeltaposSpin1 function as this is not in the classwizard or message handler Ashish Dogra MCA Noida

                  _ Offline
                  _ Offline
                  _AnsHUMAN_
                  wrote on last edited by
                  #8

                  In message map add ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaposSpin1) //add in the header file afx_msg void OnDeltaposSpin1(NMHDR *pNMHDR, LRESULT *pResult); and copy and paste the code for the implementation of the function as in my above post. You can right click on the spin control if you are working with an MFC Dialog based application and then go to property window to implement this function. Declaring functions/definitions are more error prone if they are done by hand and are not recommended. Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

                  A 1 Reply Last reply
                  0
                  • _ _AnsHUMAN_

                    In message map add ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaposSpin1) //add in the header file afx_msg void OnDeltaposSpin1(NMHDR *pNMHDR, LRESULT *pResult); and copy and paste the code for the implementation of the function as in my above post. You can right click on the spin control if you are working with an MFC Dialog based application and then go to property window to implement this function. Declaring functions/definitions are more error prone if they are done by hand and are not recommended. Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

                    A Offline
                    A Offline
                    ashish dogra
                    wrote on last edited by
                    #9

                    thanks sir can we use this methode to add function and why this function is not in the message handler Ashish Dogra MCA Noida

                    _ H 2 Replies Last reply
                    0
                    • A ashish dogra

                      thanks sir can we use this methode to add function and why this function is not in the message handler Ashish Dogra MCA Noida

                      _ Offline
                      _ Offline
                      _AnsHUMAN_
                      wrote on last edited by
                      #10

                      Yes we can use this method to add a function but it is not recommended as with this method there are more chances of committing an error and then creating troubles.You can't remember the prototypes for all the handler's etc. Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

                      1 Reply Last reply
                      0
                      • A ashish dogra

                        thanks sir can we use this methode to add function and why this function is not in the message handler Ashish Dogra MCA Noida

                        H Offline
                        H Offline
                        Hamid Taebi
                        wrote on last edited by
                        #11

                        When you Rclick in Spin control and use Event HAndle then you can see UDN_DELTAPOS_**


                        **_

                        whitesky


                        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