CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2001
    Location
    Romania, Bucharest
    Posts
    51

    editbox -Text doesn't respond

    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.


  2. #2
    Join Date
    Feb 2002
    Location
    India, Maharashtra
    Posts
    19

    Re: editbox -Text doesn't respond

    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

  3. #3
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: editbox -Text doesn't respond

    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.


  4. #4
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: editbox -Text doesn't respond

    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





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured