The difference between the two prototypes is the occluding behavior of the dialog box, as illustrated in the following examples:
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. |