Phoenix - can't enable custom control

Hi,

I have a custom control which is based on the PopUp control sample in the demo and in Phoenix this control can't be enabled.

In Phoenix I use wx.Control instead of wx.PyControl in 2.9.5 (where it works) and the control has an "Enable" method which enables the two contained controls (a button and a textctrl).

Any idea what might cause this - before I need to create a sample app;-) .

Werner

Werner wrote:

Hi,

I have a custom control which is based on the PopUp control sample in
the demo and in Phoenix this control can't be enabled.

In Phoenix I use wx.Control instead of wx.PyControl in 2.9.5 (where it
works) and the control has an "Enable" method which enables the two
contained controls (a button and a textctrl).

Any idea what might cause this - before I need to create a sample app;-) .

I think I'll need to see a sample on this one. Thanks.

···

--
Robin Dunn
Software Craftsman

I narrowed it down, but don't have a sample app for it yet.

When I create controls I do this (SearchCtrl is my popup based custom control)

     tctrl = searchctrl.SearchCtrl(tpane, wx.ID_ANY, name=ctrlname,
                                   mask = u"*{%i}" % ctrl['dbLength'])
     tctrl.Disable()

Later on when data is loaded I do tctrl.Enable(True), if I replace the tctrl.Disable() with tctrl.Enable(False) then it works fine.

Werner

···

On 30/04/2013 06:29, Robin Dunn wrote:

Werner wrote:

Hi,

I have a custom control which is based on the PopUp control sample in
the demo and in Phoenix this control can't be enabled.

In Phoenix I use wx.Control instead of wx.PyControl in 2.9.5 (where it
works) and the control has an "Enable" method which enables the two
contained controls (a button and a textctrl).

Any idea what might cause this - before I need to create a sample app;-) .

I think I'll need to see a sample on this one. Thanks.

werner wrote:

···

On 30/04/2013 06:29, Robin Dunn wrote:

Werner wrote:

Hi,

I have a custom control which is based on the PopUp control sample in
the demo and in Phoenix this control can't be enabled.

In Phoenix I use wx.Control instead of wx.PyControl in 2.9.5 (where it
works) and the control has an "Enable" method which enables the two
contained controls (a button and a textctrl).

Any idea what might cause this - before I need to create a sample
app;-) .

I think I'll need to see a sample on this one. Thanks.

I narrowed it down, but don't have a sample app for it yet.

When I create controls I do this (SearchCtrl is my popup based custom
control)

tctrl = searchctrl.SearchCtrl(tpane, wx.ID_ANY, name=ctrlname,
mask = u"*{%i}" % ctrl['dbLength'])
tctrl.Disable()

Later on when data is loaded I do tctrl.Enable(True), if I replace the
tctrl.Disable() with tctrl.Enable(False) then it works fine.

Try changing the Enable in the PopupCtrl class to be called DoEnable instead. Then see if calling Enable() and Disable() work as expected. Enable and Disable both call DoEnable, and in Phoenix it is the one that is virtualized. I can also make Enable be virtual again, but I'm curious to see if overriding DoEnable instead of Enable fixes this.

--
Robin Dunn
Software Craftsman

Hi Robin,

...

Try changing the Enable in the PopupCtrl class to be called DoEnable instead. Then see if calling Enable() and Disable() work as expected. Enable and Disable both call DoEnable, and in Phoenix it is the one that is virtualized. I can also make Enable be virtual again, but I'm curious to see if overriding DoEnable instead of Enable fixes this.

Yes, if I override DoEnable in my custom PopupCtrl then all is fine.

Werner

···

On 02/05/2013 02:21, Robin Dunn wrote: