Click to See Complete Forum and Search --> : editbox -Text doesn't respond


dafi
August 31st, 2001, 02:12 AM
I made an MDI application with 2 form docked on it by using SetParent function linking them to picture objects set on the MDI.
I have one big problem: my text boxes (edit box) don't respond when clicking on them except if I catch the click message and I say in there Text1.SetFocus for example. They don't respond to TAB to circle throuh my controls.
That is the situation when I set my forms as MDIChildren (MDIChild = True).
If I set this to False they respond well but my forms aren't docked.
How can I resolve this problem.
I have to finish this program in 3 weeks and I can't test my forms because they're not user friendly (I can't circle through them)

Thankx in advance.

satishchavan
February 18th, 2002, 02:40 AM
Hi,
Just check the TabStop Property of Text boxes I think that is False. Actually Tabstop should be True if u want to get focus by 'Tab'


Regards
Satish

DSJ
February 18th, 2002, 01:05 PM
The reason your application is behaving as it is is because you are setting the parent to a picturebox. The functionality of tabbing between the controls, giving them focus, etc. is handled by the WinProc function of it's parent control. Forms know how to handle the associated windows messages, pictureboxes do not. You need to come up with a different method of "docking" the forms.

DSJ
February 18th, 2002, 01:22 PM
A work around is to "steal" the form's WinProc and tell the picturebox to use it...

option Explicit
private Declare Function SetParent Lib "user32" (byval hWndChild as Long, byval hWndNewParent as Long) as Long
private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (byval hwnd as Long, byval nIndex as Long) as Long
private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (byval hwnd as Long, byval nIndex as Long, byval dwNewLong as Long) as Long
private Const GWL_WNDPROC = (-4)

private Sub Form_Load()
SetWindowLong Form1.Picture1.hwnd, GWL_WNDPROC, GetWindowLong(Form1.hwnd, GWL_WNDPROC)
SetParent me.hwnd, Form1.Picture1.hwnd
End Sub