Collecting input from the GUI

To collect input from the user via the GUI, the keywords defined in the mode must be connected to widgets in the dialog box.

The AFXDataDialog class takes a mode argument in its constructor. Because the form stores keywords, the dialog box can access these keywords and assign them to be targets of widgets in the dialog box. As a result, the GUI can update the keywords; or, if the kernel is updated while the dialog box is posted, the keywords can update the GUI. For more information, see Dialog boxes. The following example shows how the form's keywords are connected to the widgets in the dialog box:

class PlateDB(AFXDataDialog):

    def __init__(self, mode):

        AFXDataDialog.__init__(self, mode, 'Create Plate',
            self.OK|self.CANCEL, DIALOG_ACTIONS_SEPARATOR)
        
        va = AFXVerticalAligner(self)
        AFXTextField(va, 15, 'Name:', mode.nameKw, 0)
        AFXTextField(va, 15, 'Width:', mode.widthKw, 0)
        AFXTextField(va, 15, 'Height:', mode.heightKw, 0)