I'm creating a plugin and I want to catch when the tab is changed.
I'd like share with you how to reach that. Maybe It could be useful in your applications.
Steps:
1- Create a custom TabBook class
2- Define a function Map to catch the event with message ID = FXTabBook.ID_OPEN_ITEM
3- Define a function to handle the event.
The code would be like:
class cTabBook(FXTabBook):
def __init__(self, owner, *arg, **kw):
FXTabBook.__init__(self, *arg, **kw)
self.owner = owner
# Function Maps
#
FXMAPFUNC(self, SEL_COMMAND, FXTabBook.ID_OPEN_ITEM, cTabBook.onCmdChangeTab)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def onCmdChangeTab(self, sender, sel, ptr):
if(sender.getText() == HOLLOMON):
self.setCurrent(ZERO)
elif(sender.getText() == LUDWIK):
self.setCurrent(ONE)
elif(sender.getText() == SWIFT_KRUPKOWSKI):
self.setCurrent(TWO)
# Call to owner function to do something
#
self.owner.setNoteMessage()
I hope you find it useful
