Pegar valor alterado browse freeform

Discussão em 'Progress 4GL' iniciado por lorenzi, Abril 17, 2013.

  1. lorenzi

    lorenzi Membro Participativo

    Seguinte o any-key nao faz nada coloquei uma msg la e nunca dispara...
  2. ClaudineyToledo

    ClaudineyToledo Sem Pontuação

    Que teste você fez? Manda o código...
  3. lorenzi

    lorenzi Membro Participativo

    Nao fiz teste nenhum, somente na procedure anykey coloquei uma message la, mas a message nunca executa.
  4. ClaudineyToledo

    ClaudineyToledo Sem Pontuação

    mas vc tem que fazer o teste para ver qual tecla está pressionando... colocou o "LASTKEY(KEYLABEL)"?
  5. lorenzi

    lorenzi Membro Participativo

    Mas assim se eu colocar uma message la sem teste nenhum deveria disparar.
    Se puder da uma analisada abaixo bem simples mas representa o que desejo.

    Código:
    &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v9r12 GUI
    &ANALYZE-RESUME
    /* Connected Databases 
              dbsia            PROGRESS
    */
    &Scoped-define WINDOW-NAME C-Win
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS C-Win 
    /*------------------------------------------------------------------------
    
      File: 
    
      Description: 
    
      Input Parameters:
          <none>
    
      Output Parameters:
          <none>
    
      Author: 
    
      Created: 
    
    ------------------------------------------------------------------------*/
    /*          This .W file was created with the Progress AppBuilder.      */
    /*----------------------------------------------------------------------*/
    
    /* Create an unnamed pool to store all the widgets created 
         by this procedure. This is a good default which assures
         that this procedure's triggers and internal procedures 
         will execute in this procedure's storage, and that proper
         cleanup will occur on deletion of the procedure. */
    
    CREATE WIDGET-POOL.
    
    /* ***************************  Definitions  ************************** */
    
    /* Parameters Definitions ---                                           */
    
    /* Local Variable Definitions ---                                       */
    
    DEFINE TEMP-TABLE tmp
        FIELD cod AS INT
        FIELD descr AS CHAR
        FIELD cod-2 AS INT.
    
    CREATE tmp.
    ASSIGN tmp.cod = 1
           tmp.descr = "a1"
           tmp.cod-2 = 0.
    CREATE tmp.
    ASSIGN tmp.cod = 2
           tmp.descr = "k2"
           tmp.cod-2 = 0.
    
    CREATE tmp.
    ASSIGN tmp.cod = 3
           tmp.descr = "b1"
           tmp.cod-2 = 0.
    
    CREATE tmp.
    ASSIGN tmp.cod = 4
           tmp.descr = "f4"
           tmp.cod-2 = 0.
    
    CREATE tmp.
    ASSIGN tmp.cod = 5
           tmp.descr = "x5"
           tmp.cod-2 = 0.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK 
    
    /* ********************  Preprocessor Definitions  ******************** */
    
    &Scoped-define PROCEDURE-TYPE Window
    &Scoped-define DB-AWARE no
    
    /* Name of first Frame and/or Browse and/or first Query                 */
    &Scoped-define FRAME-NAME frm-trab
    &Scoped-define BROWSE-NAME BROWSE-20
    
    /* Internal Tables (found by Frame, Query & Browse Queries)             */
    &Scoped-define INTERNAL-TABLES tmp
    
    /* Definitions for BROWSE BROWSE-20                                     */
    &Scoped-define FIELDS-IN-QUERY-BROWSE-20 tmp.cod tmp.descr tmp.cod-2   
    &Scoped-define ENABLED-FIELDS-IN-QUERY-BROWSE-20 tmp.cod-2   
    &Scoped-define ENABLED-TABLES-IN-QUERY-BROWSE-20 tmp
    &Scoped-define FIRST-ENABLED-TABLE-IN-QUERY-BROWSE-20 tmp
    &Scoped-define SELF-NAME BROWSE-20
    &Scoped-define OPEN-QUERY-BROWSE-20 OPEN QUERY {&SELF-NAME} FOR EACH tmp.
    &Scoped-define TABLES-IN-QUERY-BROWSE-20 tmp
    &Scoped-define FIRST-TABLE-IN-QUERY-BROWSE-20 tmp
    
    
    /* Definitions for FRAME frm-trab                                       */
    &Scoped-define OPEN-BROWSERS-IN-QUERY-frm-trab ~
        ~{&OPEN-QUERY-BROWSE-20}
    
    /* Standard List Definitions                                            */
    &Scoped-Define ENABLED-OBJECTS BROWSE-20 
    
    /* Custom List Definitions                                              */
    /* List-1,List-2,List-3,List-4,List-5,List-6                            */
    
    /* _UIB-PREPROCESSOR-BLOCK-END */
    &ANALYZE-RESUME
    
    
    
    /* ***********************  Control Definitions  ********************** */
    
    /* Define the widget handle for the window                              */
    DEFINE VAR C-Win AS WIDGET-HANDLE NO-UNDO.
    
    /* Definitions of the field level widgets                               */
    /* Query definitions                                                    */
    &ANALYZE-SUSPEND
    DEFINE QUERY BROWSE-20 FOR 
          tmp SCROLLING.
    &ANALYZE-RESUME
    
    /* Browse definitions                                                   */
    DEFINE BROWSE BROWSE-20
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS BROWSE-20 C-Win _FREEFORM
      QUERY BROWSE-20 DISPLAY
          tmp.cod
     tmp.descr
     tmp.cod-2
    ENABLE tmp.cod-2
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
        WITH NO-ASSIGN NO-ROW-MARKERS SEPARATORS SIZE 199 BY 23.33 EXPANDABLE.
    
    
    /* ************************  Frame Definitions  *********************** */
    
    DEFINE FRAME frm-trab
         BROWSE-20 AT ROW 2.43 COL 2
        WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY 
             SIDE-LABELS NO-UNDERLINE THREE-D 
             AT COL 1 ROW 1
             SIZE 200.4 BY 25.
    
    
    /* *********************** Procedure Settings ************************ */
    
    &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
    /* Settings for THIS-PROCEDURE
       Type: Window
       Allow: Basic,Browse,DB-Fields,Window,Query
       Other Settings: COMPILE
     */
    &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
    
    /* *************************  Create Window  ************************** */
    
    &ANALYZE-SUSPEND _CREATE-WINDOW
    IF SESSION:DISPLAY-TYPE = "GUI":U THEN
      CREATE WINDOW C-Win ASSIGN
             HIDDEN             = YES
             TITLE              = "<insert window title>"
             HEIGHT             = 25.81
             WIDTH              = 200.4
             MAX-HEIGHT         = 25.81
             MAX-WIDTH          = 200.4
             VIRTUAL-HEIGHT     = 25.81
             VIRTUAL-WIDTH      = 200.4
             RESIZE             = yes
             SCROLL-BARS        = no
             STATUS-AREA        = no
             BGCOLOR            = ?
             FGCOLOR            = ?
             KEEP-FRAME-Z-ORDER = yes
             THREE-D            = yes
             MESSAGE-AREA       = no
             SENSITIVE          = yes.
    ELSE {&WINDOW-NAME} = CURRENT-WINDOW.
    /* END WINDOW DEFINITION                                                */
    &ANALYZE-RESUME
    
    
    
    /* ***********  Runtime Attributes and AppBuilder Settings  *********** */
    
    &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
    /* SETTINGS FOR WINDOW C-Win
      VISIBLE,,RUN-PERSISTENT                                               */
    /* SETTINGS FOR FRAME frm-trab
                                                                            */
    /* BROWSE-TAB BROWSE-20 1 frm-trab */
    IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(C-Win)
    THEN C-Win:HIDDEN = no.
    
    /* _RUN-TIME-ATTRIBUTES-END */
    &ANALYZE-RESUME
    
    
    /* Setting information for Queries and Browse Widgets fields            */
    
    &ANALYZE-SUSPEND _QUERY-BLOCK BROWSE BROWSE-20
    /* Query rebuild information for BROWSE BROWSE-20
         _START_FREEFORM
    OPEN QUERY {&SELF-NAME} FOR EACH tmp.
         _END_FREEFORM
         _Query            is OPENED
    */  /* BROWSE BROWSE-20 */
    &ANALYZE-RESUME
    
     
    
    
    
    /* ************************  Control Triggers  ************************ */
    
    &Scoped-define SELF-NAME C-Win
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL C-Win C-Win
    ON END-ERROR OF C-Win /* <insert window title> */
    OR ENDKEY OF {&WINDOW-NAME} ANYWHERE DO:
      /* This case occurs when the user presses the "Esc" key.
         In a persistently run window, just ignore this.  If we did not, the
         application would exit. */
      IF THIS-PROCEDURE:PERSISTENT THEN RETURN NO-APPLY.
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL C-Win C-Win
    ON WINDOW-CLOSE OF C-Win /* <insert window title> */
    DO:
      /* This event will close the window and terminate the procedure.  */
      APPLY "CLOSE":U TO THIS-PROCEDURE.
      RETURN NO-APPLY.
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &Scoped-define BROWSE-NAME BROWSE-20
    &Scoped-define SELF-NAME BROWSE-20
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL BROWSE-20 C-Win
    ON ANY-KEY OF BROWSE-20 IN FRAME frm-trab /* Browse 20 */
    DO:
      MESSAGE "asdasd"
          VIEW-AS ALERT-BOX INFO BUTTONS OK.
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL BROWSE-20 C-Win
    ON PAGE-DOWN OF BROWSE-20 IN FRAME frm-trab /* Browse 20 */
    DO:
        MESSAGE "asd"
            VIEW-AS ALERT-BOX INFO BUTTONS OK.
      APPLY "ENTRY" TO  BROWSE-20 IN FRAME frm-trab.
      /*RETURN NO-APPLY.                        */
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL BROWSE-20 C-Win
    ON VALUE-CHANGED OF BROWSE-20 IN FRAME frm-trab /* Browse 20 */
    DO:
      DEF VAR h AS HANDLE.
      DEF VAR i AS INT.
      /*BROWSE-20:DESELECt-selected-ROW().
      /*h = BROWSE-17:FIRST-COLUMN IN FRAME {&FRAME-NAME}.*/
      /* MESSAGE "alterou" h:NAME h:SCREEN-VALUE VIEW-AS ALERT-BOX INFO BUTTONS OK.*/
      h = browse-20:GET-BROWSE-COLUMN(3). */
      MESSAGE browse-20:PRIVATE-DATA   browse-20:ROW VIEW-AS ALERT-BOX.
      /*DO i = 1 T:BROWSE-20:NUM-COLUMNS:
    	   MESSAGE browse-20:GET-BROWSE-COLUMN(i)  VIEW-AS ALERT-BOX INFO BUTTONS OK.
           /*MESSAGE browse-17:QUERY:GET-BUFFER-HANDLE(browse-17:GET-BROWSE-COLUMN(i):TABLE):BUFFER-FIELD(browse-17:GET-BROWSE-COLUMN(i):NAME):BUFFER-VALUE VIEW-AS ALERT-BOX.*/
    
    	  /* h = h:NEXT-COLUMN.*/
        END.
      */
      /* /* h = BROWSE-17:FIRST-COLUMN IN FRAME {&FRAME-NAME}.
            DO i = 1 TO BROWSE-17:NUM-COLUMNS:
    	   MESSAGE h:NAME h:TABLE  browse-17:num-results h:num-results   VIEW-AS ALERT-BOX INFO BUTTONS OK.
           /*MESSAGE browse-17:QUERY:GET-BUFFER-HANDLE(browse-17:GET-BROWSE-COLUMN(i):TABLE):BUFFER-FIELD(browse-17:GET-BROWSE-COLUMN(i):NAME):BUFFER-VALUE VIEW-AS ALERT-BOX.*/
    
    	   h = h:NEXT-COLUMN.
        END.*/
        MESSAGE browse-17:NUM-SELECTED-ROWS VIEW-AS ALERT-BOX INFO BUTTONS OK.
        ASSIGN wh-browse = BROWSE {&BROWSE-NAME}:HANDLE
               wh-column = wh-browse:CURRENT-COLUMN.
            DO WHILE wh-column <> ?:
                 /*IF wh-column:NAME = "whatever" THEN
                 DO:
                  ASSIGN scr-value = wh-column:SCREEN-VALUE.
            LEAVE.
            END.
            ASSIGN */
                MESSAGE wh-column:NAME  wh-column:SCREEN-VALUE VIEW-AS ALERT-BOX INFO BUTTONS OK.
               ASSIGN wh-column = wh-browse:NEXT-COLUMN.
      END.*/
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    &UNDEFINE SELF-NAME
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK C-Win 
    
    
    /* ***************************  Main Block  *************************** */
    
    /* Set CURRENT-WINDOW: this will parent dialog-boxes and frames.        */
    ASSIGN CURRENT-WINDOW                = {&WINDOW-NAME} 
           THIS-PROCEDURE:CURRENT-WINDOW = {&WINDOW-NAME}.
    
    /* The CLOSE event can be used from inside or outside the procedure to  */
    /* terminate it.                                                        */
    ON CLOSE OF THIS-PROCEDURE 
       RUN disable_UI.
    
    /* Best default for GUI applications is...                              */
    PAUSE 0 BEFORE-HIDE.
    
    /* Now enable the interface and wait for the exit condition.            */
    /* (NOTE: handle ERROR and END-KEY so cleanup code will always fire.    */
    MAIN-BLOCK:
    DO ON ERROR   UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
       ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
      RUN enable_UI.
      IF NOT THIS-PROCEDURE:PERSISTENT THEN
        WAIT-FOR CLOSE OF THIS-PROCEDURE.
    END.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    /* **********************  Internal Procedures  *********************** */
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI C-Win  _DEFAULT-DISABLE
    PROCEDURE disable_UI :
    /*------------------------------------------------------------------------------
      Purpose:     DISABLE the User Interface
      Parameters:  <none>
      Notes:       Here we clean-up the user-interface by deleting
                   dynamic widgets we have created and/or hide 
                   frames.  This procedure is usually called when
                   we are ready to "clean-up" after running.
    ------------------------------------------------------------------------------*/
      /* Delete the WINDOW we created */
      IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(C-Win)
      THEN DELETE WIDGET C-Win.
      IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
    END PROCEDURE.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI C-Win  _DEFAULT-ENABLE
    PROCEDURE enable_UI :
    /*------------------------------------------------------------------------------
      Purpose:     ENABLE the User Interface
      Parameters:  <none>
      Notes:       Here we display/view/enable the widgets in the
                   user-interface.  In addition, OPEN all queries
                   associated with each FRAME and BROWSE.
                   These statements here are based on the "Other 
                   Settings" section of the widget Property Sheets.
    ------------------------------------------------------------------------------*/
      ENABLE BROWSE-20 
          WITH FRAME frm-trab IN WINDOW C-Win.
      {&OPEN-BROWSERS-IN-QUERY-frm-trab}
      VIEW C-Win.
    END PROCEDURE.
    
    /* _UIB-CODE-BLOCK-END */
    &ANALYZE-RESUME
    
    
    
  6. lorenzi

    lorenzi Membro Participativo

    RESOLVIDO Pegar valor alterado browse freeform

    Pessoal resolvido:

    Coloquei no evento row-leave
    def var v-it-br as int.
    v-it-br = INPUT BROWSE browse-17 tmp-item-rel.cd-item-emp.


    Ai faco a leitura no banco de dados e mostro o valor:
    FIND FIRST tabela NO-LOCK WHERE campo = v-it-br NO-ERROR.
    IF AVAILABLE tabela THEN
    DO:
    ASSIGN temp-table.valor = tabela.campo.
    temp-table.valor:SCREEN-VALUE IN BROWSE browse-17 = tabela.campo

    END.

    Valeu. :D

Compartilhe esta Página