Progress
AppBuilder
Developer’s Guide


Example Using AppBuilder’s API

The following example shows how to call AppBuilder’s API procedures:

/* This example shows how to replace the string "v-credit" to      */
/* "v-debit" in a trigger code block of a radio-set named rs-disc  */

DEFINE VARIABLE char-hndl    AS CHARACTER                    NO-UNDO.
DEFINE VARIABLE my-widget    AS CHARACTER                    NO-UNDO.
DEFINE VARIABLE trig-context AS INTEGER                      NO-UNDO.
DEFINE VARIABLE trig-code    AS CHARACTER                    NO-UNDO.

/* Get the context-id of the radio-set called rs-discounts         */
RUN adeuib/_uibinfo.p
   (INPUT ?,                    /* We don’t have the context id but
                                   the radio-set is in the current
                                   design window                   */
    INPUT "rs-disc",            /* The name of the radio-set       */
    INPUT "CONTEXT",            /* Please return the context id    */
    OUTPUT my-widget).          /* This is the context-id we need  */

/* Fetch the trigger code to be modified                           */
trig-context = ?.               /* This is IMPORTANT, otherwise
                                   _accsect.p will attempt to use
                                   this trig-context instead of
                                   my-widget and
                                   TRIGGER:VALUE-CHANGED           */
RUN adeuib/_accsect.p
   (INPUT "GET",                /* We want to read the code        */
    INPUT INTEGER(my-widget),   /* The context id from above       */
    INPUT "TRIGGER:VALUE-CHANGED", /* The trigger we want          */
    INPUT-OUTPUT trig-context,  /* The trigger context so we can
                                   reference this block directly
                                   in the future. IMPORTANT: This
                                   must be ? intially or _accsect
                                   will attempt to use it instead
                                   of parameter 2                  */
    INPUT-OUTPUT trig-code).    /* The code block                  */

/* Replace the string */
trig-code = REPLACE(trig-code, "v-credit", "v-debit"). 
/* Store the trigger */
RUN adeuib/_accsect.p
   (INPUT "SET",                /* Write the code back             */
    INPUT ?,                    /* We have code context, use it    */
    INPUT ?,                    /* We have code context, use it    */
    INPUT-OUTPUT trig-context,  /* We are using it directly        */
    INPUT-OUTPUT trig-code).    /* We are writing this back        */

/* Mark the window as having been modified since last save         */

/* First get the handle of the design window                       */
RUN adeuib/_uibinfo.p
   (INPUT ?,                    /* We don’t know the context id    */
    INPUT "WINDOW ?",           /* We want the handle of the
                                   design window                   */
    INPUT "HANDLE",             /* We want the HANDLE              */
    OUTPUT char-hndl).          /* Returns a string of the handle  */

/* Now indicate that the window needs to be saved again            */
RUN adeuib/_winsave.p (WIDGET-HANDLE(char-hndl), FALSE). 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095