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. How to implement edit box and spin control

How to implement edit box and spin control

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
12 Posts 3 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
    deadlyabbas
    wrote on last edited by
    #1

    Hi, I am creating a dialog in which I have to use the Spin control.Firstly I am code for the very first time in MFC. I have created the dialog and drag dropped the controls on it. I have taken the Edit control and on its right side I have placed the Spin control. Please tell me that how I will attach the two controls and what are the property setting to be done in both the control. Thanks

    A K 2 Replies Last reply
    0
    • D deadlyabbas

      Hi, I am creating a dialog in which I have to use the Spin control.Firstly I am code for the very first time in MFC. I have created the dialog and drag dropped the controls on it. I have taken the Edit control and on its right side I have placed the Spin control. Please tell me that how I will attach the two controls and what are the property setting to be done in both the control. Thanks

      A Offline
      A Offline
      Adam Roderick J
      wrote on last edited by
      #2

      Dear friend, i think it will better if you try a hand with the book "Programming Windows with MFC(Jeff prosise)" [^]. The properties you need depends on your requirement, by default some properties are set.

      Величие не Бога может быть недооценена.

      D 1 Reply Last reply
      0
      • A Adam Roderick J

        Dear friend, i think it will better if you try a hand with the book "Programming Windows with MFC(Jeff prosise)" [^]. The properties you need depends on your requirement, by default some properties are set.

        Величие не Бога может быть недооценена.

        D Offline
        D Offline
        deadlyabbas
        wrote on last edited by
        #3

        Thanks Adam for your reply Regarding properties I want to is that "Can we do it by setting the property or we have to do it by programming."

        A 1 Reply Last reply
        0
        • D deadlyabbas

          Hi, I am creating a dialog in which I have to use the Spin control.Firstly I am code for the very first time in MFC. I have created the dialog and drag dropped the controls on it. I have taken the Edit control and on its right side I have placed the Spin control. Please tell me that how I will attach the two controls and what are the property setting to be done in both the control. Thanks

          K Offline
          K Offline
          KingsGambit
          wrote on last edited by
          #4

          You can set 'Auto Buddy' property of the spin control to True. This property will automatically attach spin control to the pervious window (editbox in this case) in z-order. You may have to set the 'Set Buddy Integer' property to True as well.

          D 1 Reply Last reply
          0
          • K KingsGambit

            You can set 'Auto Buddy' property of the spin control to True. This property will automatically attach spin control to the pervious window (editbox in this case) in z-order. You may have to set the 'Set Buddy Integer' property to True as well.

            D Offline
            D Offline
            deadlyabbas
            wrote on last edited by
            #5

            I have made the Auto Buddy property of spin control as true and also set the Set Buddy Integer as true. I didn't get "in z-order" Is there any changes to be done in the properties of edit box

            K 1 Reply Last reply
            0
            • D deadlyabbas

              I have made the Auto Buddy property of spin control as true and also set the Set Buddy Integer as true. I didn't get "in z-order" Is there any changes to be done in the properties of edit box

              K Offline
              K Offline
              KingsGambit
              wrote on last edited by
              #6

              You will have to make sure that edit box comes before the spin control in tab order. You can open the dialog in resource view and press Ctrl+D to make sure that the tab order is correct.

              D 2 Replies Last reply
              0
              • K KingsGambit

                You will have to make sure that edit box comes before the spin control in tab order. You can open the dialog in resource view and press Ctrl+D to make sure that the tab order is correct.

                D Offline
                D Offline
                deadlyabbas
                wrote on last edited by
                #7

                I made the tab order as u said.One more question can we give the range say for example 0 - 40 in the edit box which can be incremented or decremented by the spin control (by clicking upward and downward arrow).If yes then where to put it. Thanks

                1 Reply Last reply
                0
                • K KingsGambit

                  You will have to make sure that edit box comes before the spin control in tab order. You can open the dialog in resource view and press Ctrl+D to make sure that the tab order is correct.

                  D Offline
                  D Offline
                  deadlyabbas
                  wrote on last edited by
                  #8

                  Thanks, I did the same. Now please tell me how set the range

                  K 1 Reply Last reply
                  0
                  • D deadlyabbas

                    Thanks Adam for your reply Regarding properties I want to is that "Can we do it by setting the property or we have to do it by programming."

                    A Offline
                    A Offline
                    Adam Roderick J
                    wrote on last edited by
                    #9

                    It depends on your need, if you want to set at run time then surely depend on APIs. else you can set some properties are default.

                    Величие не Бога может быть недооценена.

                    D 1 Reply Last reply
                    0
                    • A Adam Roderick J

                      It depends on your need, if you want to set at run time then surely depend on APIs. else you can set some properties are default.

                      Величие не Бога может быть недооценена.

                      D Offline
                      D Offline
                      deadlyabbas
                      wrote on last edited by
                      #10

                      I want to set it through properties.I have done with all the other part by the help of Rajeesh. Can u please tell me how to set the range

                      A 1 Reply Last reply
                      0
                      • D deadlyabbas

                        I want to set it through properties.I have done with all the other part by the help of Rajeesh. Can u please tell me how to set the range

                        A Offline
                        A Offline
                        Adam Roderick J
                        wrote on last edited by
                        #11

                        For a spin control, for setting range property you have depend on CSpinButtonCtrl::SetRange() [^] function itself.

                        Величие не Бога может быть недооценена.

                        1 Reply Last reply
                        0
                        • D deadlyabbas

                          Thanks, I did the same. Now please tell me how set the range

                          K Offline
                          K Offline
                          KingsGambit
                          wrote on last edited by
                          #12

                          You can use CSpinButtonCtrl class for setting the range for spin control. You can use CSpinButtonCtrl::SetRange() function. For details on how to use the class please refer http://msdn.microsoft.com/en-us/library/sfac27cz(VS.80).aspx[^] You can refer the sample application in that URL as well.

                          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