Constructors

There are two prototypes of the AFXDataDialog constructor.

The difference between the two prototypes is the occluding behavior of the dialog box, as illustrated in the following examples:

  • The following statement creates a dialog box that always occludes the main window when overlapping with the main window:

    AFXDataDialog(mode, title, actionButtonIds=0,
        opts=DIALOG_NORMAL, x = 0, y = 0, w = 0, h = 0 )   
  • The following statement creates a dialog box that always occludes its owner widget (usually a dialog box) when overlapping with the widget.

    AFXDataDialog(mode, owner, title, actionButtonIds=0,
        opts=DIALOG_NORMAL, x = 0, y = 0, w = 0, h = 0 )

When you construct a dialog box, you will start by deriving from the AFXDataDialog class. The first thing you should do in the constructor body is call the base class constructor to properly initialize the dialog. Then, you would build the contents of your dialog by adding widgets. For example:

class MyDB(AFXDataDialog):

    # My constructor
    def __init__(self):

        # Call base class constructor
        AFXDataDialog.__init__(self, form,  'My Dialog',
            self.OK|self.CANCEL)

        # Add widgets next...

When a dialog box is unposted, it is removed from the screen. By default, a dialog box is deleted when it is unposted. Deleting a dialog box removes both the GUI resources associated with the dialog box and the dialog box's data structures. In contrast, you can choose to destroy a dialog box when it is unposted. Destroying a dialog box removes only the GUI resources and retains the dialog box's data structures.

If there is some dialog box GUI state that you want to retain between postings of the dialog box, you should specify that the dialog box is destroyed only when it is unposted. Therefore, when the dialog box is posted again, it retains its data structures and the old state is still intact. For example, assume that your dialog box contains a table and the user resizes one of the columns of the table. If you only destroy the dialog box when it is unposted, the table column sizes will be remembered the next time the dialog box is posted. To specify that a dialog box should be destroyed when unposted, add the DIALOG_UNPOST_DESTROY flag to the dialog box constructor's opts argument.