I'm using validators to achieve the same result as wx.TextCtrl.SetEditable() but on different kinds of widgets (wx.CheckBox).
I use the following validator:
I don't know if the default validator of a chekbox is really a wx.Validator(), is it automatically mapped to the underlying wxGenericValidator? Anyway it works.
Is there a simpler/better solution?
Something like Enable(False) on the parent window but without shading out everything?
I'm using validators to achieve the same result as wx.TextCtrl.SetEditable() but on different kinds of widgets (wx.CheckBox).
I use the following validator:
I don't know if the default validator of a chekbox is really a wx.Validator(), is it automatically mapped to the underlying wxGenericValidator? Anyway it works.
You can use the existing wx.DefaultValidator instance.
Also, if you ever use this on a control in a dialog then the dialog will not be able to be OK'ed as long as Validate returns False. You may want to change that to True. (Afterall, the value is Valid regardless of whether the widget is protected or not, right?) Use on a dialog will also require that the validator implement the TransferToWindow and TransferFromWindow methods. They can also just return True for this case.
Is there a simpler/better solution?
Something like Enable(False) on the parent window but without shading out everything?
No, Enable/Disable is the only thing available for all control types.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!