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. EditBox with focus but no cursor [modified]

EditBox with focus but no cursor [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
14 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.
  • C Code o mat

    Doesn't come back even if you move the mouse?

    > The problem with computers is that they do what you tell them to do and not what you want them to do. <

    B Offline
    B Offline
    BadJerry
    wrote on last edited by
    #5

    No it's most strange - I can select text (and it gets higlighted) but there is no way of knowing where the cursor is (and the edit box is enabled, typing works!) . The only thing that works is to give the focus to another control (with mouse or tab) and then come back to it... strangest thing I have seen in a while!

    C 1 Reply Last reply
    0
    • B BadJerry

      No it's most strange - I can select text (and it gets higlighted) but there is no way of knowing where the cursor is (and the edit box is enabled, typing works!) . The only thing that works is to give the focus to another control (with mouse or tab) and then come back to it... strangest thing I have seen in a while!

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #6

      3 questions: 1. Is the edit box customized in any way or is it just the default edit box? So did you overwrite any message handlers like WM_SETCURSOR or maybe WM_CHAR? 2. Does the cursor disappear when you start typing only or when you move the mouse cursor over your edit or maybe TAB to it? 3. Does this happen if you don't use your own cursor?

      > The problem with computers is that they do what you tell them to do and not what you want them to do. <

      B 1 Reply Last reply
      0
      • C Code o mat

        3 questions: 1. Is the edit box customized in any way or is it just the default edit box? So did you overwrite any message handlers like WM_SETCURSOR or maybe WM_CHAR? 2. Does the cursor disappear when you start typing only or when you move the mouse cursor over your edit or maybe TAB to it? 3. Does this happen if you don't use your own cursor?

        > The problem with computers is that they do what you tell them to do and not what you want them to do. <

        B Offline
        B Offline
        BadJerry
        wrote on last edited by
        #7

        Thanks for taking the time to answer by the way! 1) No it's a simple CEdit... I did override WM_KEYDOWN (with PreTranslateMessage in the parent window)... I am doing a custom control where you can view some html and view the source code... and switch with a custom tab control from one to the other. Hoping I make sense... 2) The cursor disappears when the user clicks on the tab control... it hides the other window, displays the edit, gives it focus and voila - you can type but you have no idea where you are 3) Not sure I understand... do you want me to change the cursor? I certainly have not changed it manually so far

        C 1 Reply Last reply
        0
        • B BadJerry

          Thanks for taking the time to answer by the way! 1) No it's a simple CEdit... I did override WM_KEYDOWN (with PreTranslateMessage in the parent window)... I am doing a custom control where you can view some html and view the source code... and switch with a custom tab control from one to the other. Hoping I make sense... 2) The cursor disappears when the user clicks on the tab control... it hides the other window, displays the edit, gives it focus and voila - you can type but you have no idea where you are 3) Not sure I understand... do you want me to change the cursor? I certainly have not changed it manually so far

          C Offline
          C Offline
          Code o mat
          wrote on last edited by
          #8

          Ah, i think i see the confusement here, when i hear cursor i think of the mouse cursor, while you are talking about the caret, right? The little blinking line that shows where you type...Are you sure the control receives the WM_SETFOCUS message when it gets the focus?

          > The problem with computers is that they do what you tell them to do and not what you want them to do. <

          B 1 Reply Last reply
          0
          • C Code o mat

            Ah, i think i see the confusement here, when i hear cursor i think of the mouse cursor, while you are talking about the caret, right? The little blinking line that shows where you type...Are you sure the control receives the WM_SETFOCUS message when it gets the focus?

            > The problem with computers is that they do what you tell them to do and not what you want them to do. <

            B Offline
            B Offline
            BadJerry
            wrote on last edited by
            #9

            of course you're right - it's called the caret and not the cursor... my mistake. Yes the control does get the focus: when I type, it gets updated... The temporary fix I have done is to give the focus to the tab control and then with a timer give it back to the edit... madness but at least it works... most bizarre

            C 1 Reply Last reply
            0
            • B BadJerry

              of course you're right - it's called the caret and not the cursor... my mistake. Yes the control does get the focus: when I type, it gets updated... The temporary fix I have done is to give the focus to the tab control and then with a timer give it back to the edit... madness but at least it works... most bizarre

              C Offline
              C Offline
              Code o mat
              wrote on last edited by
              #10

              I have seen this happening too but i can't remember anymore what the problem actually was... :( If you hit the ALT key, do you maybe see the focus rect appearing on the tab control? I have seen strange behaviour appearing when setting the focus in an unapropriate time. I think you could simply use PostMessage to overcome this, so no need for a timer. Try posting (not sending) WM_SETFOCUS to the edit when it has been shown, or maybe post a custom message (like WM_USER) to the tab control which will set the focus on the shown page when it receives it. (I'd try the later aproach)

              > The problem with computers is that they do what you tell them to do and not what you want them to do. <

              1 Reply Last reply
              0
              • B BadJerry

                I am trying to build this custom control - one of the child windows is an edit control and at one point it gets the focus (you can type in it) but the cursor has disappeared... what could cause this and how can I fix this? Thanks in advance

                modified on Monday, December 8, 2008 9:43 AM

                B Offline
                B Offline
                bob16972
                wrote on last edited by
                #11

                Are you using CreateSolidCaret. Does your custom edit control use an offscreen memory buffer for drawing?

                B 1 Reply Last reply
                0
                • B bob16972

                  Are you using CreateSolidCaret. Does your custom edit control use an offscreen memory buffer for drawing?

                  B Offline
                  B Offline
                  BadJerry
                  wrote on last edited by
                  #12

                  No (CreateSolidCaret) and no (memory buffer)... it's is a simple MFC CEdit with no customisation whatsoever... it's simply a child window of a CWnd derived control!

                  B 1 Reply Last reply
                  0
                  • B BadJerry

                    No (CreateSolidCaret) and no (memory buffer)... it's is a simple MFC CEdit with no customisation whatsoever... it's simply a child window of a CWnd derived control!

                    B Offline
                    B Offline
                    bob16972
                    wrote on last edited by
                    #13

                    In your initial comment you stated, "I am trying to build this custom cursor" and later you clarified that you meant "caret" so I naturally assumed you were creating a custom "caret" but apparently not so just ignore my question. I apologize for misunderstanding.

                    B 1 Reply Last reply
                    0
                    • B bob16972

                      In your initial comment you stated, "I am trying to build this custom cursor" and later you clarified that you meant "caret" so I naturally assumed you were creating a custom "caret" but apparently not so just ignore my question. I apologize for misunderstanding.

                      B Offline
                      B Offline
                      BadJerry
                      wrote on last edited by
                      #14

                      oh thanks for pointing this out - I meant custom control - gee not my day!

                      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