AppDialog Method (CLIENT)


PLB Web Only, 9.9

 

The AppDialog method allows access to a mobile device dialog UI elements. The method uses the following format:

 

[label]

{object}.AppDialog

[GIVING {return}] USING [*Text=]{text}[:

 

 

[*Title=](title}][,[*Button=]{button}][:

 

 

[*DefaultText=]{defaultText}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A CLIENT object.

return

Optional. A Numeric Variable that returns the success or failure of the method.

text

Required. A Character String Variable or string literal giving the text to be displayed in the dialog.

title

Optional. A Character String Variable or string literal giving the title to be displayed in the dialog.

button

Optional. A Character String Variable or string literal that contains one or more button names. Button names are separated by ';' characters.

defaultText

Optional. A Character String Variable or string literal giving the default text for an edit field used in a Prompt dialog.

Flags Affected: OVER, ZERO

Note the following:

  1. This method is only used for a Sunbelt PL/B Web Client App using Cordova\PhoneGap operations. See the following link for details on the Cordova plugin used:

  2.  

         https://www.npmjs.com/package/cordova-plugin-dialogs

     

  3. The ZERO flag is set when the {return} value is zero.

  4. The OVER flag is set if the value returned is too large to be stored into the {return} variable.

  5. The type of mobile device dialog is determined by which parameters are specified for the AppDialog method as follows:

  6.  

    Generate/bullet1.gif    If a single button is used with no 'DefaultText' text, an Alert dialog is used.

     

    Generate/bullet1.gif    If multiple buttons are used with no 'DefaultText' text, a Confirm Dialog is used.

     

    Generate/bullet1.gif    If 'DefaultText' text is provided, a Prompt Dialog is used which prompts the end-user for data input.

     

  7. This method starts an asynchronous operation on the mobile device which returns the result using the 'AppEventDialog' CLIENT object event where the event data is returned in ARG1 which contains a JSON notation stream.

  8.  

    The event number used in EVENTREG is:

     

    AppEventDialog EQU 107 //Event number for EVENTREG.

     

    The event result is defined as follows:

    Alert Dialog

    Field

    Description

    ARG1

    No data returned on event.

    Modifier

    The button number (always 1)

    Confirm Dialog

    Field

    Description

    ARG1

    No data returned on event.

    Modifier

    The button number

    Prompt Dialog

    Field

    Description

    ARG1

    Prompt edit text data returned as plain text (i.e., not JSON).

    Modifier

    The button number

Example Code

 

Bnum FORM 3 //Expect value from 1 to N.

FullData DIM 200 //Plain data returned for event.

.

          EventReg Client,AppEventDialog,DialogEvent:

                   Modifier=Bnum,ARG1=FullData

.

          Client.AppDialog Using "How much should be added?":

                   "Numbers","One;Two"

 

 

See Also: CLIENT, Client Methods, Method Syntax



PL/B Language Reference AppCapture Method (CLIENT) AppDirAdd Method (CLIENT)