whoes Validate method to call

Hi,

I'm wondering why I can't just call a control's Validate - if I do so nothing
happens. Instead I have to call its parent. Is there a good reason for that
behaviour? I'm on linux, wxPython 2.8.

Christian

Christian wrote:

Hi,

I'm wondering why I can't just call a control's Validate - if I do so nothing
happens. Instead I have to call its parent. Is there a good reason for that behaviour? I'm on linux, wxPython 2.8.

Because Validate is intended to be used on a dialog, panel or other container widget to make sure that all of it's child widgets pass validation. (IOW, that the whole container is valid.) So it does a "for child in self.GetChildren():..." type of loop. If you try that on a widget that has no children then the loop is effectively empty.

If you need to validate a specific widget then you can do something like widget.GetValidator().Validate().

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!