On Mar 23, 2007 8:59 PM, Arnaud Nicolet wrote:
> Le 22 mars 07 à 18:34 Soir, Carlos M a écrit:
>
> > Other example:
> > I had a problem once with some custom controls on a window that
> > needed to know
> > when a resized event occured on the window in order to do some
> > stuff. This would
> > be easy if I had just one or two. But with several this would
> > require some more
> > work everytime I wanted to add or remove a control. By using an
> > interface, when
> > the window resizes, all controls that implements the interface are
> > automatically
> > notified. Sure there are other ways to do this (and maybe even
> > better) but to me
> > it seemed, at that time, the best approach to solve the problem.
>
> Thanks for the example.
> I tried to reproduce it, but I run into a problem.
>
> I wanted to have a class of push buttons and another of edit field
> that both are notified of the window's resized event.
>
> I added an interface (I keep the name "Interface1").
> In it, I added that method: Resized(NewWidth As integer,NewHeight As
> integer,OldWidth As integer,OldHeight As integer)
[snip]
> How can I "broadcast" the message to every Interface1 (my push button
> and my edit field)?
Here's the code I used on the window Resized event:
// Call the WindowResized method for the controls on the window that
// implement the WindowResizingNotifier class interface.
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
In your case change the interface name and method.
Also don't forget to use it on Resizing Event if LiveResize is enabled. Check on
XP because (if I remember correctly) even if LiveResize is not enabled for a
window it shows live resizing - I mainly develop on Win2K so I can't remember
but there was a problem with live resizing.
HTH
Carlos
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>