There is a project in MFC into which forms C # are built.

The first problem - TabIndex does not affect the focus, but it is not critical.

The second problem - after switching to the tab from the last element, the program freezes. / Perhaps the reason is that the form C # parent = null .

How can I solve the 2nd problem?

ps at the moment I try to embed an element at the end, and with gotFocus force the focus to the 1st element.

  • one
    ASP.NET MVC is a web application framework. Forms is a desktop. I hardly understand the connection between these two concepts. - mrakolice
  • I apologize, it was sealed)) MFC - IVsevolod
  • What exactly does “freeze” mean? Are the controls reacting to the mouse? Or just “swallow” the focus? What does the debugger say? - VladD
  • > What exactly does "hang" mean? > Controls react to the mouse? completely ceases to respond to the outside world, including controls do not respond. > And what does the debugger say? If you click on pause, it goes to the winocc.cpp function of the mfc BOOL CWnd :: IsDialogMessage (LPMSG lpMsg) {ASSERT (:: IsWindow (m_hWnd)); if (m_nFlags & WF_OLECTLCONTAINER) return afxOccManager-> IsDialogMessage (this, lpMsg); else return :: IsDialogMessage (m_hWnd, lpMsg); } and then says nothing, all the way through, but the form does not respond. - IVsevolod
  • one
    Strange. And this will not help you: social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/… ? - VladD


1 answer 1

This problem at the moment turned out to be done with the help of a patch, when I add a new control with focus, and with GotFocus I transfer to the following focus:

  TextBoxVisualizer x = new TextBoxVisualizer(); x.v_value.Text = "sfaas"; this.vf_panel.Controls.Add(x); x.v_value.GotFocus += delegate { this.vf_container.SelectNextControl(x, true, true, true, true); }; 

if I find nothing better I will leave this method.