override virtual method in derived class

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

override virtual method in derived class

Neil Hancock
Hi, I'm hitting my head against something that I think is basic but I haven't got the hang of it.
I'm using WxFormBuilder to generate a Dialog with a read_button on it, and I want to manage the OnButtonEvent.
I can generate the Dialog, and have put a print in the read_button to verify its being processed,
but I can't figure out how to catch the overridden onMpPcReadBtn event.
Any pointers or suggestions appreciated.. thanks

The wxPython calls are in gui.py.
class modifyParamDialog ( wx.Dialog ):
def __init__( self, parent ):
wx.Dialog.__init__ ( self, parent,  .....
... dialog creation... 
 
# Virtual event handlers, overide them in your derived class
def onMpPcReadBtn( self, event ):
#print('vBtn Read Product Codes')#works when enabled
event.Skip()

then in callable.py

class modifyParamActions(gui.modifyParamDialog):
    def __init__(self,parent):
        #initialize parent class
        super(modifyParamActions,self).__init__()
        print('init modifyParamActions') #this doesn't print
        gui.modifyParamDialog.__init__(self,parent)

    #provide overrides for base class
    def onMpPcReadBtn(self,event):
        print('1Btn Read Product Codes')

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: override virtual method in derived class

Neil Hancock
I have managed to get a version working the overide method of Dialog events working, and reconciling the not working v working. Its not clear to me why the version that doesn't work is failing, but I will post the results when I know. 

On Thursday, January 11, 2018 at 12:55:38 AM UTC-8, Neil Hancock wrote:
Hi, I'm hitting my head against something that I think is basic but I haven't got the hang of it.
I'm using WxFormBuilder to generate a Dialog with a read_button on it, and I want to manage the OnButtonEvent.
I can generate the Dialog, and have put a print in the read_button to verify its being processed,
but I can't figure out how to catch the overridden onMpPcReadBtn event.
Any pointers or suggestions appreciated.. thanks

The wxPython calls are in gui.py.
class modifyParamDialog ( wx.Dialog ):
def __init__( self, parent ):
wx.Dialog.__init__ ( self, parent,  .....
... dialog creation... 
 
# Virtual event handlers, overide them in your derived class
def onMpPcReadBtn( self, event ):
#print('vBtn Read Product Codes')#works when enabled
event.Skip()

then in callable.py

class modifyParamActions(gui.modifyParamDialog):
    def __init__(self,parent):
        #initialize parent class
        super(modifyParamActions,self).__init__()
        print('init modifyParamActions') #this doesn't print
        gui.modifyParamDialog.__init__(self,parent)

    #provide overrides for base class
    def onMpPcReadBtn(self,event):
        print('1Btn Read Product Codes')

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: override virtual method in derived class

Tim Roberts
Neil Hancock wrote:
> I have managed to get a version working the overide method of Dialog
> events working, and reconciling the not working v working. Its not
> clear to me why the version that doesn't work is failing, but I will
> post the results when I know.

There really wasn't enough information here for us to make a diagnosis. 
You've omitted too much important code.  It's good that you got it
working, but to figure out your original problem, we'd need to see a
more complete example.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: override virtual method in derived class

Neil Hancock
Yes I apologize - I was trying to frame the issue, and just not knowing how deep to go with wxPython and wxFormBuilder - and simplify it to just the  issue with the overridden virtual events.
I've still got one trial that it doesn't work on, and one that it does - so at this point not able to isolate it sufficiently.
I do appreciate the enormous amount of ongoing work to make it accessible, but I guess there are so many options I'm going down a rabbit hole somehow.
regards


On Thursday, January 11, 2018 at 10:04:28 AM UTC-8, Tim Roberts wrote:
Neil Hancock wrote:
> I have managed to get a version working the overide method of Dialog
> events working, and reconciling the not working v working. Its not
> clear to me why the version that doesn't work is failing, but I will
> post the results when I know.

There really wasn't enough information here for us to make a diagnosis. 
You've omitted too much important code.  It's good that you got it
working, but to figure out your original problem, we'd need to see a
more complete example.

--
Tim Roberts, <a href="javascript:" target="_blank" gdf-obfuscated-mailto="KM_h0r3KCwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ti...@...
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.