PA_NewDialog

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


PA_NewDialog PA_Dial4D

ParameterTypeDescription
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 4th Dimension Dialog.

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

Example

Display a dialog saved in "FO4D" resource named "SuperDialog"

   void DisplaySuperDialog ()
   {
      PA_Dial4D   dial;
      char      cancelOrValidate;
      char      lastVar[256];

   // Create the dialog context
      dial = PA_NewDialog();
   // Open the FO4D 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.


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next