On Jun 20, 2006 9:19 PM, GregO wrote:
> Is there any way for a Custom Control to hook into the event of a
> parent application? Specifically, I'd like my control to be
> "notified" if the resized event of a window fires, but I'd
> like it to
> occur for ALL of my controls without having to specifically code it.

I had a similar problem and I solved it in the following way.

1. Added a Class Interface "WindowResizingNotifier" and add a method
"WindowResized"

2. On Windows' Resized event used the following code:
  Dim i As Integer
  For i = 0 To Self.ControlCount-1
    If Self.Control(i) IsA WindowResizingNotifier then
      WindowResizingNotifier( Self.Control(i)).WindowResized
    End If
  Next

3. If you have LiveResize set on the Window you can use:
  If Me.LiveResize Then
    Dim i As Integer
    For i = 0 To Self.ControlCount-1
      If Self.Control(i) IsA WindowResizingNotifier then
        WindowResizingNotifier( Self.Control(i)).WindowResized
      End If
    Next
  End If

4. On my Custom Controls I set the Interface to
"WindowResizingNotifier" and added the method "WindowResized". On this
method I do whatever I want.

So, everytime the window resizes, it notifies all controls that
implements the "WindowResizingNotifier" interface.

HTH
Carlos

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to