1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

UPC CD0602

Discussão em 'Progress 4GL' iniciado por jvsilva, Maio 30, 2011.

  1. jvsilva

    jvsilva Sem Pontuação

    Amigos(as),

    Há vários exemplos aqui para criarmos uma UPC; isso é muito bom. Contudo, tenho uma dúvida: no programa CD0602, temos uma folder com várias pastas. Minha necessidade é criar alguns campos específicos dentro de uma determinada pasta dessa folder.

    Como fazer? Há algum exemplo para ser entendido e seguido?

    Grato!
  2. Rogerio

    Rogerio Moderator Moderador Equipe de Suporte

    Você quer criar um novo folder, ou criar campos num folder já existente?
  3. jdchaves

    jdchaves Membro Participativo

    Código:
    /* CD0204 */
    {utp/ut-glob.i}
    /* Parameter Definitions ****************************************************/
    def input param p-ind-event        as char          no-undo.
    def input param p-ind-object       as char          no-undo.
    def input param p-wgh-object       as handle        no-undo.
    def input param p-wgh-frame        as widget-handle no-undo.
    def input param p-cod-table        as char          no-undo.
    def input param p-row-table        as rowid         no-undo.
    /* global Variable Definitions **********************************************/
    define new global shared var adm-broker-hdl as handle no-undo.
    define new global shared var h-folder       as handle no-undo.
    define new global shared var h-viewer       as handle no-undo.
    def NEW global shared var wh-button         as widget-handle no-undo.
    def new global shared var wh-fill-aluno     as widget-handle no-undo.
    def new global shared var wh-fill-faltas    as widget-handle no-undo.
    def new global shared var wh-fill-prof      as widget-handle no-undo.
    def new global shared var wh-fill-media     as widget-handle no-undo.
    def new global shared var wh-rd-bimestre    as widget-handle no-undo.
    def new global shared var tx-label          as widget-handle no-undo.
    def new global shared var tx-aluno          as widget-handle no-undo.
    def new global shared var tx-faltas         as widget-handle no-undo.
    def new global shared var tx-materia        as widget-handle no-undo.
    def new global shared var tx-serie          as widget-handle no-undo.
    def new global shared var tx-media          as widget-handle no-undo.
    def new global shared var tx-bimestre       as widget-handle no-undo.
    def new global shared var tx-prof           as widget-handle no-undo.
    def new global shared var wh-cbx-serie      as widget-handle no-undo.
    def new global shared var wh-cbx-materia    as widget-handle no-undo.
    def new global shared var tx-label2         as widget-handle no-undo.
    def new global shared var tx-label3         as widget-handle no-undo.
    /* Variable Definitions *****************************************************/
    define var c-folder                 AS character no-undo.
    define var c-objects                AS character no-undo.
    define var h-object                 AS handle    no-undo.
    define var i-objects                AS integer   no-undo.
    define var l-record                 AS logical   no-undo initial no.
    define var l-group-assign           AS logical   no-undo initial no.
    DEF var c-objeto                    AS char no-undo.
    DEFINE VARIABLE l-confirma          AS LOGICAL     NO-UNDO.
    DEFINE VARIABLE h_Frame             AS HANDLE      NO-UNDO.
    DEFINE VARIABLE h_Frame-usuar       AS HANDLE      NO-UNDO.
    DEFINE VARIABLE h_campo             AS HANDLE      NO-UNDO.
    DEFINE VARIABLE h_campo-usuar       AS HANDLE      NO-UNDO.
    DEFINE VARIABLE resultado           AS INTEGER     NO-UNDO.
    DEFINE VARIABLE l-state        AS LOGICAL        NO-UNDO INITIAL NO.
    
    
    {include/i_fclpreproc.i} /* Include que define o processador do Facelift ativado ou nÆo. */ 
    
    &IF "{&aplica_facelift}" = "YES" &THEN
    	{include/i_fcldef.i}
    &endif
    
    /* Main Block ***************************************************************/
    
    assign c-objeto = entry(num-entries(p-wgh-object:private-data, "~/"), p-wgh-object:private-data, "~/").
    
    
    
    IF  p-ind-event  = "INITIALIZE"
    AND c-objeto     = 'cd0204.w'
    AND p-ind-object = "CONTAINER" THEN DO:
    
            RUN get-link-handle IN adm-broker-hdl (INPUT p-wgh-object,
                                                   INPUT "PAGE-SOURCE":U,
                                                   OUTPUT c-folder).
    
            assign h-folder = widget-handle(c-folder) no-error.
    
            if valid-handle(h-folder) then do:
               RUN create-folder-page IN h-folder (INPUT 5, INPUT "Teste Escolar":U).
               RUN create-folder-label IN h-folder (INPUT 5, INPUT "Teste Escolar":U).
               RUN select-page IN p-wgh-object (INPUT 5).
               RUN init-object IN p-wgh-object (INPUT "upc/teste.w":U, /* Nome do Objeto Viewer */
                                                INPUT p-wgh-frame,
                                                INPUT "Layout = ":U,
                                                OUTPUT h-viewer).
               RUN set-position IN h-viewer ( 7.10, 5.00).
               RUN get-link-handle IN adm-broker-hdl (INPUT p-wgh-object,
                                                      INPUT "CONTAINER-TARGET":U,
                                                      OUTPUT c-objects).
               
               do i-objects = 1 to num-entries(c-objects):
                   assign h-object = widget-handle(entry(i-objects, c-objects)).
                   if index(h-object:private-data, "qteste") <> 0 and  /* query principal */
                   not l-record then do:
                       assign l-record = yes.
                       RUN add-link IN adm-broker-hdl (INPUT h-object, 
                                                       INPUT "Record":U,
                                                       INPUT h-viewer).
                   end.
                   if index(h-object:private-data, "v34in172") <> 0 and /* viewer principal do programa que esta ligado com a UPC */
                   not l-group-assign then do:
                       assign l-group-assign = yes.
                       RUN add-link IN adm-broker-hdl (INPUT h-object, 
                                                       INPUT "Group-Assign":U,
                                                       INPUT h-viewer).
                   end.
                   if index(h-object:private-data, "p-cadsim") <> 0 and /* botoes comandos */
                   not l-state then do:
                       assign l-state = yes.
                       RUN add-link IN adm-broker-hdl (INPUT h-object, 
                                                       INPUT "State":U,
                                                       INPUT h-viewer).
                   end.
               end.
    
               RUN dispatch IN h-viewer ("initialize":U).
               RUN select-page IN p-wgh-object (INPUT 1).
            end.
    END.
    
    
    IF (p-ind-event  = 'BEFORE-INITIALIZE':U 
    OR  p-ind-event = "ADD")
    AND c-objeto   = "teste.w" THEN DO:
        
        create button wh-button
            ASSIGN frame   = p-wgh-frame
                   width   = 6
                   height  = 1.25
                   row     = 5.15
                   label   = "Gravar"
                   col     = 78
                   sensitive = NO
                   visible = YES
                   triggers:
                        ON CHOOSE PERSISTENT RUN upc\teste.p('Choose-bt'   ,
                                                             p-ind-object  ,
                                                             p-wgh-object  ,
                                                             p-wgh-frame   ,
                                                             p-cod-table   ,
                                                             p-row-table   ).
                        END triggers.
    
       
        create text tx-aluno
            assign frame        = p-wgh-frame
                   format       = "x(17)"
                   width        = 8
                   screen-value = "Aluno:"
                   row          = 1.56
                   col          = 2.60
                   visible      = YES.
        create fill-in wh-fill-aluno
            assign frame        = p-wgh-frame
                   SIDE-LABEL-HANDLE =  tx-aluno:HANDLE
                   format       = "x(50)" 
                   width        = 20
                   height       = 0.88
                   row          = 1.48
                   col          = 7
                   visible      = yes
                   sensitive    = no.
        create text tx-serie
            assign frame        = p-wgh-frame
                   format       = "x(17)"
                   width        = 8
                   screen-value = "Serie:"
                   row          = 2.53
                   col          = 3
                   visible      = YES.
        CREATE COMBO-BOX wh-cbx-serie
            ASSIGN FRAME        = p-wgh-frame
                   SIDE-LABEL-HANDLE =  tx-serie:HANDLE
                   FORMAT       = "x(30)"
                   WIDTH        = 5
                   ROW          = 2.50
                   COL          = 7
                   LIST-ITEMS   = "1¦,2¦,3¦,4¦,5¦,6¦,7¦,8¦"
                   VISIBLE      = YES
                   sensitive    = NO.
        create text tx-prof
            assign frame        = p-wgh-frame
                   format       = "x(17)"
                   width        = 8
                   screen-value = "Prof.:"
                   row          = 3.53
                   col          = 3.30
                   visible      = YES.
        create fill-in wh-fill-prof
            assign frame        = p-wgh-frame
                   SIDE-LABEL-HANDLE =  tx-prof:HANDLE
                   format       = "x(50)" 
                   width        = 20
                   height       = 0.88
                   row          = 3.46
                   col          = 7
                   visible      = yes
                   sensitive    = no.
        create text tx-materia
            assign frame        = p-wgh-frame
                   format       = "x(17)"
                   width        = 8
                   screen-value = "Materia:"
                   row          = 4.53
                   col          = 1.50
                   visible      = YES.
        CREATE COMBO-BOX wh-cbx-materia
            ASSIGN FRAME        = p-wgh-frame
                   SIDE-LABEL-HANDLE =  tx-materia:HANDLE
                   FORMAT       = "x(30)"
                   WIDTH        = 15
                   ROW          = 4.46
                   COL          = 7
                   LIST-ITEMS   = "Artes,Ciˆncias,Ed. Fisica,Ens. Religioso,Geografia,Hist¢ria,Inglˆs,Matem tica,Portuguˆs"
                   VISIBLE      = YES
                   sensitive    = NO.
        create text tx-faltas
            assign frame        = p-wgh-frame
                   format       = "x(17)"
                   width        = 8
                   screen-value = "Faltas:"
                   row          = 5.53
                   col          = 2.60
                   visible      = YES.
        create fill-in wh-fill-faltas
            assign frame        = p-wgh-frame
                   SIDE-LABEL-HANDLE =  tx-faltas:HANDLE
                   format       = "99" 
                   SCREEN-VALUE = "00"
                   width        = 4
                   height       = 0.88
                   row          = 5.46
                   col          = 7
                   visible      = yes
                   sensitive    = no.
        create text tx-bimestre
            assign frame        = p-wgh-frame
                   format       = "x(17)"
                   width        = 8
                   screen-value = "Bimestre:"
                   row          = 6.53
                   col          = 1.30
                   visible      = YES.
        CREATE RADIO-SET wh-rd-bimestre
            ASSIGN FRAME         = p-wgh-frame
                   SIDE-LABEL-HANDLE =  tx-bimestre:HANDLE               
                   WIDTH         = 20
                   HEIGHT        = 1
                   COL           = 7.70
                   ROW           = 6.40
                   HORIZONTAL    = YES
                   RADIO-BUTTONS = "1§,1,2§,2,3§,3,4§,4"
                   VISIBLE       = YES
                   FONT          = 4.
        create text tx-media
            assign frame        = p-wgh-frame
                   format       = "x(17)"
                   width        = 8
                   screen-value = "M‚dia:"
                   row          = 7.53
                   col          = 2.30
                   visible      = YES.
        create fill-in wh-fill-media
            assign frame        = p-wgh-frame
                   SIDE-LABEL-HANDLE =  tx-media:HANDLE
                   format       = "99,99" 
                   SCREEN-VALUE = "00,00"
                   width        = 6
                   height       = 0.88
                   row          = 7.40
                   col          = 7
                   visible      = yes
                   sensitive    = no.
    
    
    
    
    END.
    
    
    IF p-ind-event = "Choose-bt" THEN DO:
    
        {upc/valida-teste.i}
    
        CREATE escola.
        ASSIGN escola.aluno     = wh-fill-aluno:SCREEN-VALUE.
        assign escola.serie     = wh-cbx-serie:SCREEN-VALUE. 
        assign escola.professor = wh-fill-prof:SCREEN-VALUE.
        assign escola.materia   = wh-cbx-materia:SCREEN-VALUE. 
        assign escola.faltas    = DECIMAL(wh-fill-faltas:SCREEN-VALUE).
        assign escola.bimestre  = IF VALID-HANDLE(wh-rd-bimestre) THEN INT(wh-rd-bimestre:SCREEN-VALUE) ELSE 1.
        assign escola.media     = DECIMAL(wh-fill-media:SCREEN-VALUE).
        
        wh-fill-aluno:SCREEN-VALUE = "".
        wh-fill-prof:SCREEN-VALUE = "".
        wh-fill-faltas:SCREEN-VALUE = "".
        wh-fill-media:SCREEN-VALUE = "".
    
    
    END.
    
    IF (p-ind-event  = 'enable':U 
    OR  p-ind-event = "ADD")
    AND c-objeto = "teste.w" THEN DO:
            wh-fill-aluno:SENSITIVE = YES.
            wh-fill-faltas:SENSITIVE = YES.
            wh-fill-prof:SENSITIVE = YES.
            wh-button:SENSITIVE = YES.
            wh-cbx-serie:SENSITIVE = YES.
            wh-cbx-materia:SENSITIVE = YES.
            wh-rd-bimestre:SENSITIVE = YES.
            wh-fill-media:SENSITIVE = YES.
            
    END.
    
    IF p-ind-event = "disable" and
          c-objeto = "teste.w" THEN DO:
            wh-fill-aluno:SENSITIVE = NO.
            wh-fill-prof:SENSITIVE = NO.
            wh-fill-media:SENSITIVE = NO.
            wh-button:SENSITIVE = NO.
            wh-cbx-serie:SENSITIVE = NO.
            wh-cbx-materia:SENSITIVE = NO.
            wh-fill-faltas:SENSITIVE = NO.
            wh-rd-bimestre:SENSITIVE = NO.
            
    
            wh-fill-aluno:SCREEN-VALUE = "".
            wh-fill-prof:SCREEN-VALUE = "".
            wh-fill-faltas:SCREEN-VALUE = "".
            wh-fill-media:SCREEN-VALUE = "".
    
    
    END.
    
    
    
    
    



    Um ex. do CD0204
    Celso V Alves curtiu isso.
  4. jvsilva

    jvsilva Sem Pontuação

    Rogério, eu quero criar novos campos em uma determinada pasta da folder do programa. Criar os campos eu sei. A minha dúvida está mesmo na inclusão desses campos dentro da pasta "Fiscal" do programa CD0602.

    Obrigado por responder!

    Att,
  5. Celso V Alves

    Celso V Alves Sem Pontuação

    Estou no mesmo dilema! Mas não consegui utilizar o seu exemplo. Preciso inserir campos em um folder, na tab 2, via upc, mas não consegui ainda.
  6. bootstrapmaster

    bootstrapmaster Moderator Moderador Equipe de Suporte

    Cada conteudo de uma pasta do folder é uma viewer, então na UPC vc recebe os eventos, display, update, assign e outros com o nome da frame, então é nesse momento que vc deve criar os seus campos, no display da viewer v01ad097 por exemplo, mais ou menos isso.
    Celso V Alves curtiu isso.

Compartilhe esta Página