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. Using SpinButtonCtrl

Using SpinButtonCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 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.
  • S Offline
    S Offline
    Shuang Wu
    wrote on last edited by
    #1

    To change the buttons' size of a SpinButton, I need to use CSpinButtonCtrl::Create() function. Now I added a SpinButton control on my dialog, what shall I do next?


    |-|3llo Wo|2ld

    B 1 Reply Last reply
    0
    • S Shuang Wu

      To change the buttons' size of a SpinButton, I need to use CSpinButtonCtrl::Create() function. Now I added a SpinButton control on my dialog, what shall I do next?


      |-|3llo Wo|2ld

      B Offline
      B Offline
      bneacetp
      wrote on last edited by
      #2

      Shuang. Wu wrote: what shall I do next? What is it that you are wanting to use the Spinner control for? Are you wanting it to be used with a Edit Control? Happy Programming and God Bless! "Your coding practices might be buggy, but your code is always right." Internet::WWW::CodeProject::bneacetp

      S 1 Reply Last reply
      0
      • B bneacetp

        Shuang. Wu wrote: what shall I do next? What is it that you are wanting to use the Spinner control for? Are you wanting it to be used with a Edit Control? Happy Programming and God Bless! "Your coding practices might be buggy, but your code is always right." Internet::WWW::CodeProject::bneacetp

        S Offline
        S Offline
        Shuang Wu
        wrote on last edited by
        #3

        Yes, with an Edit Control.


        |-|3llo Wo|2ld

        B 1 Reply Last reply
        0
        • S Shuang Wu

          Yes, with an Edit Control.


          |-|3llo Wo|2ld

          B Offline
          B Offline
          bneacetp
          wrote on last edited by
          #4

          Place code something like this (minus the lengthly comments) in your host dialog's OnInitDialog() function like:

          // Sets the spinner control's buddy. This can be done either by using the
          // below method (using GetDlgItem()) or passing the edit box's variable
          // by reference like SetBuddy(&m_editBox);.
          m_spinner.SetBuddy(GetDlgItem(IDC_EDIT_BOX));
          // This next step would greatly depend on your personal preference according
          // to your needs. I just done this to set a value in the edit box. This
          // also should be done according to your program's needs.
          GetDlgItem(IDC_EDIT_BOX)->SetWindowText("0");
          // Next, I set the range of the spinner control. the first parameter is the
          // minimum value and the second parameter is the maximum value.
          m_spinner.SetRange(0, 100);
          // Next, I set told the spinner to deal with the edit box in terms of
          // integers. The boolean at the end is for determining whether the value
          // should ever be signed or not.
          m_spinner.SetDlgItemInt(IDC_EDIT_BOX, 0, FALSE);

          That should do it! I hope this clarifies things for you and aids you in your programming efforts. Best of luck on your projects! :-D Happy Programming and God Bless! "Your coding practices might be buggy, but your code is always right." Internet::WWW::CodeProject::bneacetp

          S 1 Reply Last reply
          0
          • B bneacetp

            Place code something like this (minus the lengthly comments) in your host dialog's OnInitDialog() function like:

            // Sets the spinner control's buddy. This can be done either by using the
            // below method (using GetDlgItem()) or passing the edit box's variable
            // by reference like SetBuddy(&m_editBox);.
            m_spinner.SetBuddy(GetDlgItem(IDC_EDIT_BOX));
            // This next step would greatly depend on your personal preference according
            // to your needs. I just done this to set a value in the edit box. This
            // also should be done according to your program's needs.
            GetDlgItem(IDC_EDIT_BOX)->SetWindowText("0");
            // Next, I set the range of the spinner control. the first parameter is the
            // minimum value and the second parameter is the maximum value.
            m_spinner.SetRange(0, 100);
            // Next, I set told the spinner to deal with the edit box in terms of
            // integers. The boolean at the end is for determining whether the value
            // should ever be signed or not.
            m_spinner.SetDlgItemInt(IDC_EDIT_BOX, 0, FALSE);

            That should do it! I hope this clarifies things for you and aids you in your programming efforts. Best of luck on your projects! :-D Happy Programming and God Bless! "Your coding practices might be buggy, but your code is always right." Internet::WWW::CodeProject::bneacetp

            S Offline
            S Offline
            Shuang Wu
            wrote on last edited by
            #5

            Thx. But what i want is to change spin button contro's size. I know CSpinButtonCtrl::Create can do, see: BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID ); ... Parameters ... rect Specifies the spin button contro's size and position. It can be either a CRect object or a RECT structure Thus, I want to know when I can call CSpinButtonCtrl::Create. Or, do you have any idea to change the spin button contro's size?


            |-|3llo Wo|2ld

            B 1 Reply Last reply
            0
            • S Shuang Wu

              Thx. But what i want is to change spin button contro's size. I know CSpinButtonCtrl::Create can do, see: BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID ); ... Parameters ... rect Specifies the spin button contro's size and position. It can be either a CRect object or a RECT structure Thus, I want to know when I can call CSpinButtonCtrl::Create. Or, do you have any idea to change the spin button contro's size?


              |-|3llo Wo|2ld

              B Offline
              B Offline
              bneacetp
              wrote on last edited by
              #6

              Shuang. Wu wrote: Or, do you have any idea to change the spin button contro's size? You can use the MoveWindow() function to resize the control anytime. Here is MSDN Documentation on the function: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cwnd.3a3a.movewindow.asp [^] Happy Programming and God Bless! "Your coding practices might be buggy, but your code is always right." Internet::WWW::CodeProject::bneacetp

              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