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. Focus issues

Focus issues

Scheduled Pinned Locked Moved C / C++ / MFC
visual-studiocomdockerdebugginghelp
1 Posts 1 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.
  • G Offline
    G Offline
    greekgoddj
    wrote on last edited by
    #1

    Hello hello, So...I am working on a ActiveX control, where when the user clicks the mouse and lets go of the mouse with the cursor over a specific area in the control, a CEdit control is made visible at the position of the ActiveX control. The user can enter a number into the CEdit control, and then when clucking outside the CEdit control, that value entered gets stored in a variable and the CEdit control becomes invinsible. The problem comes when trying to click on that area of the ActiveX control again. the CEdit control will apear but can no longer enter any values. I cannot get that vertical line in the CEdit box that allows me to type in characters/numbers. If I run it in debugging mode, with breakpoints at the point where the CEdit is to be shown, and where the CEdit is to be hidden, then it works pefrectly as many times as I like. I can keep clicking on that area of the control, showing the CEdit, entering a number, clicking elsehwere and hiding the CEdit, and so on and so forth. It turns out that the reason why it works when debugging and not when not debugging is that when I have breakpoints in parts of the code, the focus leaves my control in the ActiveX control container, and goes to the VS window to show me the break point. Then when I press F5 and return back to the ActiveX container then it all works again. Similarly, when I run the control out of debug mode, clicking on other windows or applications solves it and makes the control work. so a sequence like this works: 1)click on the area over which the CEdit should appear, 2)CEdit appears 3)Enter a value 4)click outside the CEdit 5)CEdit disapears 6) >>click on other window/application/desktop etc<< 7)click back on ActiveX container 8) Go to step 1. Without step 6, I canot get step 2 to happen more than once. We thought it maybe a matter of focus. So, the code was changed so that when the CEdit control appears it also gets the focus, and when the user clicks elsewhere and the CEdit hides, that the parent control gets the focus. I have put the code below...anybody who has actually read so far into this post might as well have a look at it. thanks! :-D LRESULT CKnob::OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { m_bMouseDown = false; RECT tempRect; GetClientRect(&tempRect); int nLeft = (tempRect.right - tempRect.left) / 2 - KNOBSIZE / 2; int nTop = (tempRect.bottom - tempRect.top) / 2 + KNOBSIZE / 2; //If mouse Up WITHIN the text area if((LOWORD(lParam)

    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