Results 1 to 3 of 3

Thread: can't find my kiddies :)

  1. #1

    Thread Starter
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930

    Question

    I have a program with an MDI form and several children, and to keep track of them as a new child is loaded, I assign each a unique tag, and use a variable to hold the tag of the currently used child. The problem is that I have the command that sets the variable to a specific window inside the main child form's GetFocus event:
    Code:
    Private Sub Form_GetFocus()
    
       CurrentWindowTag = Me.Tag
    
    End Sub
    I would think this works, but for some reason the GetFocus event for the child forms doesn't seem to fire. I set up a thing to print CurrentWindowTag, but when I switch between different child windows, the tag never seems to change, even though each window has a unique tag. Is there something weird about MDI child forms and how they get/lose the focus? Does a form get the focus when any control on it gets the focus?
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    Try the Activate event instead.

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    well there's also a property called activeform in the MDIform that returns the child form that has the focus, so you could access it's Tag by:
    Code:
    MDIForm1.ActiveForm.Tag
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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