Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent Window from loosing focus when (non-MDI) child is activated

Status
Not open for further replies.

MrSandman666

Programmer
Feb 5, 2001
54
0
0
DE
Ok, this problem is somewhat intricate.
I load a form into a picturebox by setting the picturebox as the forms parent with the API function SetParent. That way I can display forms inside the picture box. I use this to have a somewhat interchangable interface. More specifically, I use it in combination with a TabStrip controll, so that the content of each register is stored in a seperate form.
This works great and helps me organize my project a lot and makes designing the several input masks a hell of a lot easier but everytime I display a form in the picturebox, the main form looses the focus. This doesn't distract from functionality in any way but it's really annoying. Is there a way to have the child form be treated in a way so that you won't notice that it's not actually part of the main form?

If I expressed myself unclearly, please ask! I'll try to make things clearer.

Thanks a lot for your help.
 

after loading and showing the form in the picture box you might be able to use

[tt]Me.SetFocus[/tt]
 
Well, this is sort of a work around but not what I meant. Still, when the form is displayed, the main form snaps out of focus quickly, which makes it even more annoying. And I do something on that new form, the main form looses focus again. So, I would have to place a frmMain.SetFocus in pretty much each event which causes the loaded form to get the focus. And still this would cause the main form to snap out of focus every time I click on the loaded form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top