PA_NewDialog



PA_NewDialog → PA_Dial4D

Parameter Type Description
This command does not require any parameters

Description

The routine PA_NewDialog creates a new dialog context and returns a reference to that context. This context will be used in any subsequent call referring to this dialog.

A dialog context handles the dialog variables so that the dialog can be used in compiled mode.

Calling this routine should be the first thing done when using a 4D Dialog.

In the improbable case where it could not allocate the context, PA_NewDialog returns 0L.

Example

Display a dialog saved in plugin resource named "SuperDialog"

   void DisplaySuperDialog ()
   {
      PA_Dial4D   dial;
      char      cancelOrValidate;
      char      lastVar[256];
 
   // Create the dialog context
      dial = PA_NewDialog();
   // Open the dialog stored in plugin resource
      PA_OpenDialog(dial, "SuperDialog", 0);
   // Loop
      do {
         cancelOrValidate = PA_ModalDialog( dial, lastVar );
 
         if (  0 == strcmp( lastVar, "aVar1" ) )
         {
            // user hits variable "aVar1"
            /* . . . */
         }
         else if ( 0 == strcmp( lastVar, "aVar2" ) )
         {
            // user hits variable "aVar2"
            /* . . . */
         }
      } while ( cancelOrValidate == 0 );
 
      if ( cancelOrValidate == 1 )
      {
         // User validates the dialog
         /* . . . */
      }
      else if ( cancelOrValidate == 2 )
      {
         // User cancels the dialog
         /* . . . */
      }
   }

See Also

PA_CloseDialog , PA_ModalDialog , PA_OpenDialog .

Error Handling

None.