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 change the cursor for a Text Control

How to change the cursor for a Text Control

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
16 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.
  • P pandit84

    Hi i am using a Text Control having caption as "SHOW" . i want to change to cursor when the user makes a mouse move over it . I am unable to do that .. Please provide the comments so that i can change the mouse from standard arrow to hand cursor.

    I Offline
    I Offline
    Iain Clarke Warrior Programmer
    wrote on last edited by
    #4

    I like CPallini's reply - it's a good hacky one! But if you're using MFC, it's also worth reading the following article: http://www.codeproject.com/KB/miscctrl/hyperlink.aspx[^] You can just remove the painting stuff from his article, and it will still show a cursor of your choice. And it should be a good learning exercise for the future. Iain.

    Codeproject MVP for C++, I can't believe it's for my lounge posts...

    1 Reply Last reply
    0
    • C CPallini

      You possibly need

      SetClassLong(hTextWnd, GCL_HCURSOR, (LONG) LoadCursor(NULL,IDC_HAND));

      see [^]. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      modified on Tuesday, March 10, 2009 7:10 AM

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #5

      Wouldn't that replace all STATIC's cursors, rather than just one particular one? Cattivo Carlo, cattivo. Iain.

      Codeproject MVP for C++, I can't believe it's for my lounge posts...

      C P 2 Replies Last reply
      0
      • P Paresh Chitte

        Is API SetCursor helpful ? Regards, Paresh.

        P Offline
        P Offline
        pandit84
        wrote on last edited by
        #6

        Yes ...sir ... Got a success thanks....

        1 Reply Last reply
        0
        • I Iain Clarke Warrior Programmer

          Wouldn't that replace all STATIC's cursors, rather than just one particular one? Cattivo Carlo, cattivo. Iain.

          Codeproject MVP for C++, I can't believe it's for my lounge posts...

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #7

          Iain Clarke wrote:

          Wouldn't that replace all STATIC's cursors, rather than just one particular one?

          Yessir, that's done deliberately, of course, to maintain GUI consistency :rolleyes:

          Iain Clarke wrote:

          Cattivo Carlo, cattivo.

          Carlo brutto e cattivo. :-D

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          I 1 Reply Last reply
          0
          • I Iain Clarke Warrior Programmer

            Wouldn't that replace all STATIC's cursors, rather than just one particular one? Cattivo Carlo, cattivo. Iain.

            Codeproject MVP for C++, I can't believe it's for my lounge posts...

            P Offline
            P Offline
            pandit84
            wrote on last edited by
            #8

            yes its for a particular static text... Now what i have done - i have done subclassing for a class i which i have handle Mouse Move event and i my project i have created an object of that class and used my static control in it.

            1 Reply Last reply
            0
            • C CPallini

              Iain Clarke wrote:

              Wouldn't that replace all STATIC's cursors, rather than just one particular one?

              Yessir, that's done deliberately, of course, to maintain GUI consistency :rolleyes:

              Iain Clarke wrote:

              Cattivo Carlo, cattivo.

              Carlo brutto e cattivo. :-D

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              I Offline
              I Offline
              Iain Clarke Warrior Programmer
              wrote on last edited by
              #9

              If you're the Cattivo e Brutto, can I be the Bene[+]? We'll have our own spaghetti[*] western! Signor Iain. [+] No google help required for that one! [*] insert chorus of groaning here.

              Codeproject MVP for C++, I can't believe it's for my lounge posts...

              C 1 Reply Last reply
              0
              • I Iain Clarke Warrior Programmer

                If you're the Cattivo e Brutto, can I be the Bene[+]? We'll have our own spaghetti[*] western! Signor Iain. [+] No google help required for that one! [*] insert chorus of groaning here.

                Codeproject MVP for C++, I can't believe it's for my lounge posts...

                C Offline
                C Offline
                CPallini
                wrote on last edited by
                #10

                Well I'll be 'il brutto e il cattivo', you'll be 'il buono' (aka Iain-Clint) and the THHB's action is completed, today. :) BTW [^] :-D

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                I 1 Reply Last reply
                0
                • C CPallini

                  Well I'll be 'il brutto e il cattivo', you'll be 'il buono' (aka Iain-Clint) and the THHB's action is completed, today. :) BTW [^] :-D

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

                  I Offline
                  I Offline
                  Iain Clarke Warrior Programmer
                  wrote on last edited by
                  #11

                  Bene would have been fine if you hadn't gone and changed your mind about how to speak over the last 2000 years. Sheesh, some people are so short term... Iain.

                  Codeproject MVP for C++, I can't believe it's for my lounge posts...

                  C 1 Reply Last reply
                  0
                  • I Iain Clarke Warrior Programmer

                    Bene would have been fine if you hadn't gone and changed your mind about how to speak over the last 2000 years. Sheesh, some people are so short term... Iain.

                    Codeproject MVP for C++, I can't believe it's for my lounge posts...

                    C Offline
                    C Offline
                    CPallini
                    wrote on last edited by
                    #12

                    If you, crazy English people, didn't change your mind, we would share the same language, laws, etc... :rolleyes: --Carlo Augusto the Emperor. BTW would still be 'bonus', not 'bene'.__ ;P BTW2 what county of England are you from?

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    I 1 Reply Last reply
                    0
                    • C CPallini

                      If you, crazy English people, didn't change your mind, we would share the same language, laws, etc... :rolleyes: --Carlo Augusto the Emperor. BTW would still be 'bonus', not 'bene'.__ ;P BTW2 what county of England are you from?

                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                      [My articles]

                      I Offline
                      I Offline
                      Iain Clarke Warrior Programmer
                      wrote on last edited by
                      #13

                      ;P to you too! As for BTW2... Born: Kent. Grew up: Middle east Educated: Scotland / US. Living: Herefordshire - but off to Sweden in a few weeks! ps, Any Swedes want to give me a job!?

                      Codeproject MVP for C++, I can't believe it's for my lounge posts...

                      C 1 Reply Last reply
                      0
                      • I Iain Clarke Warrior Programmer

                        ;P to you too! As for BTW2... Born: Kent. Grew up: Middle east Educated: Scotland / US. Living: Herefordshire - but off to Sweden in a few weeks! ps, Any Swedes want to give me a job!?

                        Codeproject MVP for C++, I can't believe it's for my lounge posts...

                        C Offline
                        C Offline
                        CPallini
                        wrote on last edited by
                        #14

                        Iain Clarke wrote:

                        Living: Herefordshire - but off to Sweden in a few weeks! ps, Any Swedes want to give me a job!?

                        WOW, are you going to live in Sweden? Good luck & best wishes! [edit] now we're awarded in the THHB's page [/edit]. [edit2] since I'm going to move in Herefordshire, could I apply for your current job (since you're leaving)?[/edit2] :-D

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                        [My articles]

                        I 2 Replies Last reply
                        0
                        • C CPallini

                          Iain Clarke wrote:

                          Living: Herefordshire - but off to Sweden in a few weeks! ps, Any Swedes want to give me a job!?

                          WOW, are you going to live in Sweden? Good luck & best wishes! [edit] now we're awarded in the THHB's page [/edit]. [edit2] since I'm going to move in Herefordshire, could I apply for your current job (since you're leaving)?[/edit2] :-D

                          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                          [My articles]

                          I Offline
                          I Offline
                          Iain Clarke Warrior Programmer
                          wrote on last edited by
                          #15

                          I'd reply to you more directly if I thought the [email] button worked... Iain.

                          Codeproject MVP for C++, I can't believe it's for my lounge posts...

                          1 Reply Last reply
                          0
                          • C CPallini

                            Iain Clarke wrote:

                            Living: Herefordshire - but off to Sweden in a few weeks! ps, Any Swedes want to give me a job!?

                            WOW, are you going to live in Sweden? Good luck & best wishes! [edit] now we're awarded in the THHB's page [/edit]. [edit2] since I'm going to move in Herefordshire, could I apply for your current job (since you're leaving)?[/edit2] :-D

                            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                            [My articles]

                            I Offline
                            I Offline
                            Iain Clarke Warrior Programmer
                            wrote on last edited by
                            #16

                            Can you email me on: mm603008@spamcorptastic.com It's a self destructing email address, so you'll need to be a little speedy! If you'd rather stay private, I'll respect that too. Iain.

                            Codeproject MVP for C++, I can't believe it's for my lounge posts...

                            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