Sorry for necro'ing the post, I was looking for code references on Quicktabs.
Regarding Command triggering twice, is it because of the mouse events? mouse up/down
I print the contents of msg[c4d.BFM_ACTION_INDRAG] inside the Command function for testing.
- When I click on the Quicktab, the first event returns True, while the second returns False.
- If I drag over two entries on the Quicktab gadget (click on one entry, then drag to the next entry and let go of the mouse,) Command triggers three times, msg[c4d.BFM_ACTION_INDRAG] returns True the first two times and False for the last one. Also, the first entry returns True for its IsSelected() check on mouse down. After dragging, the the second entry's IsSelected() is True. Second entry's IsSelected() is also true when I let go of the mouse.
So maybe it was by design, in case the interface needs to update as you drag across entries on the Quicktab gadget. And if you only need to update the gui once (regardless of whether the clicked entry was previously selected or not,) just check if msg[c4d.BFM_ACTION_INDRAG] is False (mouse released.)
def Command(self, id, msg):
## check if Quicktab was clicked, and only process when user is finished clicking
if id == ID_QUICKTAB_BAR and not msg[c4d.BFM_ACTION_INDRAG]:
self.RefreshGuiOnQuicktabMouseUp()
return True