override virtual method in derived class

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’)

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’)

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, timr@probo.com
Providenza & Boekelheide, Inc.

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, ti...@probo.com

Providenza & Boekelheide, Inc.