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

Criação de UPC

Discussão em 'Progress 4GL' iniciado por jaozi_nho, Outubro 24, 2012.

  1. jaozi_nho

    jaozi_nho Membro Participativo

    Olá, tenho uma duvida em relação a UPC, para criar uma UPC o processo é feito pelo AppBuilder ou apenas editando um .p normal?

    Se puderem me passar um manual, alguns exemplos e dicas de construção de UPC agradeço, pois me mandaram fazer manutenção em uma UPC aqui e estou completamente perdido.

    Obrigado.
  2. mcarril

    mcarril Membro Participativo

    As upc(s) trabalham junto aos programas .w do Progress. Geralmente são .p


    Veja exemplo de uma UPC que cria um campo.
    Apos isso vc deve associa a UPC no programa men/men012aa.w. (Este passo faz o sistema entender que quando você rodar a tela "X" de um ".w" qualquer seu .p (UPC) deve ser executado.

    Obs.: Observe que a linha que cria o campo e CREATE text.....

    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.

    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_campo AS HANDLE NO-UNDO.
    assign c-objeto = entry(num-entries(p-wgh-object:private-data, "~/"), p-wgh-object:private-data, "~/").

    /* message "EVENTO" p-ind-event skip */
    /* "OBJETO" p-ind-object skip */
    /* "NOME OBJ" c-objeto skip */
    /* "FRAME" p-wgh-frame skip */
    /* "TABELA" p-cod-table skip */
    /* "ROWID" string(p-row-table) view-as alert-box. */

    def NEW global shared var wh-button as widget-handle no-undo.
    def new global shared var wh-fill as widget-handle no-undo.
    def new global shared var tx-label as widget-handle no-undo.


    IF p-ind-event = "initialize" and
    c-objeto = "v36in172.w" THEN DO:

    create text tx-label
    assign frame = p-wgh-frame
    format = "x(17)"
    width = 14.2
    screen-value = "Inf Marketing:"
    row = 7.3
    col = 16.2
    fgcolor = 0
    visible = yes.

    create fill-in wh-fill
    assign frame = p-wgh-frame
    side-label-handle = tx-label:handle
    DATA-TYPE = "Character"
    format = "x(100)"
    width = 40
    height = 0.88
    row = 7.2
    col = 27.5
    /* bgcolor = 1 */
    fgcolor = 0
    visible = yes.


    ASSIGN h_Frame = p-wgh-frame:FIRST-CHILD. /* pegando o Field-Group */
    ASSIGN h_Frame = h_Frame:FIRST-CHILD. /* pegando o 1o. Campo */

    DO WHILE h_Frame <> ? :

    if h_frame:type <> "field-group" then do:
    IF h_Frame:NAME = "inform-compl" THEN
    DO :
    assign h_campo = h_Frame.
    leave.
    END.
    ASSIGN h_Frame = h_Frame:NEXT-SIBLING.
    END.
    else do:
    assign h_frame = h_frame:first-child.

    END.
    END.

    h_campo:WIDTH = 40.
    END.

    IF p-ind-event = "enable" and
    c-objeto = "v36in172.w" THEN DO:

    wh-fill:SENSITIVE = YES.

    END.

    IF p-ind-event = "disable" and
    c-objeto = "v36in172.w" THEN DO:

    wh-fill:SENSITIVE = NO.

    END.

    IF p-ind-event = "display" and
    c-objeto = "v36in172.w" AND
    VALID-HANDLE(wh-fill) THEN DO:

    FIND ITEM NO-LOCK WHERE
    rowid(ITEM) = p-row-table NO-ERROR.
    IF AVAIL ITEM THEN DO:
    FIND esp-item NO-LOCK WHERE
    esp-item.it-codigo = ITEM.it-codigo NO-ERROR.
    IF AVAIL esp-item THEN
    wh-fill:SCREEN-VALUE = esp-item.inf-mkt.
    ELSE
    wh-fill:SCREEN-VALUE = "".
    END.

    END.


    IF p-ind-event = "assign" and
    c-objeto = "v36in172.w" THEN DO:


    FIND ITEM NO-LOCK WHERE
    rowid(ITEM) = p-row-table NO-ERROR.
    IF AVAIL ITEM THEN DO:
    FIND esp-item EXCLUSIVE-LOCK WHERE
    esp-item.it-codigo = ITEM.it-codigo NO-ERROR.
    IF NOT AVAIL esp-item THEN DO:
    CREATE esp-item.
    ASSIGN esp-item.it-codigo = ITEM.it-codigo.
    END.
    ASSIGN esp-item.inf-mkt = wh-fill:SCREEN-VALUE.
    END.
    END.

Compartilhe esta Página