Form constructor

You begin writing a form mode by deriving a new class from AFXForm.

In the body of the AFXForm constructor you must call the base class constructor and pass in the owner, which is the module or toolset GUI to which this form belongs.

You then define the commands and keywords that the mode will use. The keywords are stored as members of the mode so that they can be accessed by dialog boxes. If you set registerQuery=True in the AFXGuiCommand constructor, the mode will query the kernel object specified by the command when it is activated and will automatically set the values of the command's keywords. For more information, see Keeping the GUI and commands up-to-date. If there is no kernel object associated with your command (for example, when creating a new object), you can set the keyword values by specifying a default value in the constructor.

If you have a default object that you want to use to reestablish default values for the dialog box, you can use the mode’s registerDefaultsObject method to register an object whose values will be queried when the user presses the Defaults button in the dialog box. For more information, see Defaults objects.

By default, dialog boxes are posted as modeless or nonmodal. You can change the behavior by calling setModal(True) to have a dialog box posted as modal. In most cases you set the behavior only once; however, you can change the behavior as often as needed by calling the setModal method in the getFirstDialog or getNextDialog methods. For more information, see Modal versus modeless.