On Jun 20, 2006, at 4: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.


For Canvas subclasses, I've done the following. Add private properties WindowTop, WindowLeft, WindowWidth, and WindowHeight. Initialize them in the Open event handler --

Sub Open()
  If me.Window <> nil then
  me.WindowLeft = me.Window.Left
  me.WindowTop = me.Window.Top
  me.WindowWidth = me.Window.Width
  me.WindowHeight = me.Window.Height
  Open //call subclass event handler
End Sub

Add events WindowResized and WindowMoved. Then implement the Paint event handler --

Sub Paint(g as Graphics)
  If me.Window <> nil then
If me.WindowLeft <> me.Window.Left or me.WindowTop <> me.Window.Top then
      me.WindowLeft = me.Window.Left
      me.WindowTop = me.Window.Top
      WindowMoved
    End if
If me.WindowWidth <> me.Window.Width or me.WindowHeight <> me.Window.Height then
      me.WindowHeight = me.Window.Height
      me.WindowHeight = me.Window.Height
      WindowResized
    End if
  End if
  Paint g
End Sub


Charles Yeomans
_______________________________________________
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