Action area

The AFXDataDialog class provides standard handling for all the buttons that can appear in the action area.

Table 1 shows the action that the application takes when each of these buttons is clicked.

Table 1. Action area buttons.
Button Action
OK Send the form an (ID_COMMIT, SEL_COMMAND) message and its button ID.
Apply Send the form an (ID_COMMIT, SEL_COMMAND) message and its button ID.
Continue Send the form an (ID_GET_NEXT, SEL_COMMAND) message.
Defaults Send the form an (ID_SET_DEFAULTS, SEL_COMMAND) message.
Cancel Check for bailout, send the form an (ID_DEACTIVATE, SEL_COMMAND) message.
x” in title bar Perform the Cancel button action.

If your dialog has more than one “apply” button, you can handle this by routing messages from the button to the apply message handler in the form. In the form, you can use the getPressedButtonId method to determine which button was pressed and take the appropriate action. For example, in your dialog constructor:

self.appendActionButton('Plot', self, self.ID_PLOT)
FXMAPFUNC(self, SEL_COMMAND, self.ID_PLOT, 
    AFXDataDialog.onCmdApply)
self.appendActionButton('Highlight', self, self.ID_HIGHLIGHT)
FXMAPFUNC(self, SEL_COMMAND, self.ID_HIGHLIGHT, 
    AFXDataDialog.onCmdApply)

and in your form code:

def doCustomChecks(self):
    
    if self.getPressedButtonId() == self.getCurrentDialog().ID_PLOT:
        # Enable plot commands, disable highlight commands
    else:
        # Enable highlight commands, disable plot commands
    return True