[Mono-dev] problem: Invalidate does not propagate correctly invalidation to nested controls (+patch)

Ivan Zlatev ivan at ivanz.com
Thu Dec 17 18:45:41 EST 2009


The reason that this code was changed is because on MS.NET Refresh
isn't called recursively and some controls override it and do not
expect that it will be called again and end up in an endless loop. I
think this was also the case with some Mono WinForms controls
especially in MDI forms.

It would be best if you can write an unit test to verify that on
MS.NET when you call Invalidate (true) it recursively calls the same
on the child controls. While you are at it you can also write one that
shows that Refresh() is not called recursively as well which I should
have done myself (sorry). I am sure Calberto will be happy to review
with a test that passes and a patch that also causes no fails on our
test suite.

Kind Regards,

Ivan Zlatev

On Thu, Dec 17, 2009 at 10:19 PM, matteo tesser <matteo.tesser at gmail.com> wrote:
> Hi,
> I noticed that both mono 2.6 and mono 2.4.3 introduce a problem in
> windows.form apps (in  all versions linuxes and os x) : In some
> situations, invalidate and subsequent painting is not propagated
> correctly to nested controls.
> The problem is due to the following change in the Control.Refresh method.
> http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs?r1=140535&r2=141744&sortby=date
> The old version called Control.Refresh method recursively for all
> child controls . The new version  changes strategy and - correctly -
> call Update  method  telling to invalidate  childrend  controls too.
> The problem is in the implementation of method Control.Invalidate .  I
> noticed that in mono 2.6 (2.4.3), when a control contains more than
> one level of nested controls, only first level controls are
> refreshed/painted.
> I think that method invalidate,  when InvalidateChildren parameter is
> true, should propagate recursively the invalidation  to all nested
> controls.
> I send  you a patch, which corrects the problem in the apps I'm working.
> Thanks,
> Matteo
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

More information about the Mono-devel-list mailing list