Re: setfocus() endless loop

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Yes, this is a known problem. The easiest way to avoid it is to not set focus to a
disabled control. It is very annoying. Worse still, if you are deactivating a control
that has the focus, life becomes more confused, although the program does not actually
hang.
joe

On Mon, 23 Apr 2007 03:40:00 -0700, vKey <vKey@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

I've got two dialogs, one embedded within the other. I'd like to set the
focus on a Edit-control of the embedded dialog, by calling setFocus() in
onInitDialog() (return FALSE) of the embedded dialog. This works fine so far,
as long as the edit fields of both dialogs are activ.
However, when the edit controls are set inactiv, the application gets stuck
and the cursor is blinking in a control of the outer dialog, although it is
never set there in the code. If I remove the desired setFocus(), everything
works fine, also with inactiv controls.
Probably, the setFocus() on the desired edit control is causing an endless
loop. Can anyone help, how to fix the problem?
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Setfocus - Error 2108
    ... Not really sure what the purpose of all this is, but you cannot SetFocus to ... > Well how do I clear the events for the control. ... >> - the KeyDown, KeyPress, KeyUp, and Error events of ... rather than allenbrowne at mvps dot org. ...
    (microsoft.public.access.forms)
  • Re: Setfocus - Error 2108
    ... well I fixed this by changing the event to AfterUpdate and now SetFocus ... > Well how do I clear the events for the control. ... > Jarryd. ... >> - the KeyDown, KeyPress, KeyUp, and Error events of ...
    (microsoft.public.access.forms)
  • Re: ON_CONTROL_REFLECT
    ... man nicht selber versenden soll! ... zum Control, und es freute sich darüber, seither funktioniert alles, bei ... // CPropTreeItemButton message handlers ... Das senden von WM_SETFOCUS hat nämlich nichts mit SetFocus zu ...
    (microsoft.public.de.vc)
  • RE: SetFocus not working properly
    ... MsgBox "The SKU field must be numeric. ... ItemDescription = .Fields ... This SetFocus line stubbornly refuses to work. ... the control is cleared, but the focus moves to the next control no matter ...
    (microsoft.public.access.formscoding)
  • SetFocus not working as I would expect
    ... Sub txtbxStartTime_AfterUpdate ... Don't need to operate on empty inputs. ... What happens is that the focus ends up on the next tab stop control ... I have tried the SetFocus in the called NUMBERCHECK function, ...
    (microsoft.public.excel.programming)