Excluir widget

Discussão em 'Progress 4GL' iniciado por kikofr, Abril 4, 2011.

  1. kikofr

    kikofr Membro Participativo

    Bom dia,

    Desenvolvi um sistema que cria um widget na tela dinamicamente, a partir de um Radio-set, quando seleciono pela primeira vez uma opção no radio-set, a geração funciona corretamente, mas quando altero a opção, da erro na geração do widget.

    Segue abaixo o código que desenvolvi.

    Código:
    DEFINE INPUT  PARAMETER ip-ano-pesquisa     AS INTEGER     NO-UNDO.
    DEFINE INPUT  PARAMETER ip-dt-inicial       AS DATE        NO-UNDO.
    DEFINE INPUT  PARAMETER ip-dt-fim-pesquisa  AS DATE        NO-UNDO.
    DEFINE INPUT  PARAMETER ip-cod-categoria    AS INTEGER     NO-UNDO.
    DEFINE INPUT  PARAMETER ip-cod-pergunta     AS INTEGER     NO-UNDO.
    DEFINE INPUT  PARAMETER ip-cod-resposta     AS INTEGER     NO-UNDO.
    DEFINE INPUT  PARAMETER ip-frame            AS WIDGET-HANDLE   NO-UNDO.
    DEFINE INPUT  PARAMETER ip-linha AS INTEGER     NO-UNDO.
    DEFINE VARIABLE iContResp AS INTEGER     NO-UNDO.
    DEFINE VARIABLE cListItens  AS CHARACTER   NO-UNDO.
    
    FOR EACH tt-sub-respostas
       WHERE tt-sub-respostas.cod-categoria = tt-respostas.cod-categoria
         AND tt-sub-respostas.cod-pergunta  = tt-respostas.cod-pergunta:
        DELETE tt-sub-respostas.
    
    END.
    ASSIGN ip-linha = ip-linha + 1
           cListItens = ""
           iContResp  = 0.
    
    FIND FIRST tt-respostas
        WHERE tt-respostas.ano-pesquisa    = ip-ano-pesquisa   
          AND tt-respostas.dt-inicial      = ip-dt-inicial     
          AND tt-respostas.dt-fim-pesquisa = ip-dt-fim-pesquisa
          AND tt-respostas.cod-categoria   = ip-cod-categoria  
          AND tt-respostas.cod-pergunta    = ip-cod-pergunta   
          AND tt-respostas.cod-resposta    = ip-cod-resposta NO-LOCK NO-ERROR.
    IF AVAIL tt-respostas THEN DO:
        FOR EACH pesquisa-sub-respostas
           WHERE pesquisa-sub-respostas.cod-categoria = tt-respostas.cod-categoria
             AND pesquisa-sub-respostas.cod-pergunta  = tt-respostas.cod-pergunta
             AND pesquisa-sub-respostas.cod-resposta  = integer(tt-respostas.whResp:SCREEN-VALUE) NO-LOCK:
            ASSIGN cListItens = cListItens + "," + pesquisa-sub-respostas.descricao-resposta + "," + STRING(pesquisa-sub-respostas.cod-sub-resposta)
                   iContResp  = iContResp + 1.       
        END.
    
    
        FIND FIRST tt-sub-respostas 
             WHERE tt-sub-respostas.cod-categoria = tt-respostas.cod-categoria
               AND tt-sub-respostas.cod-pergunta  = tt-respostas.cod-pergunta
               AND tt-sub-respostas.cod-resposta  = integer(tt-respostas.whResp:SCREEN-VALUE) NO-LOCK NO-ERROR.
        IF NOT AVAIL tt-sub-respostas THEN DO:
            CREATE tt-sub-respostas.
            ASSIGN tt-sub-respostas.cod-categoria = tt-respostas.cod-categoria               
                   tt-sub-respostas.cod-pergunta  = tt-respostas.cod-pergunta                
                   tt-sub-respostas.cod-resposta  = integer(tt-respostas.whResp:SCREEN-VALUE).
        END.
        ASSIGN cListItens = SUBSTRING(cListItens, 2).       
        CREATE RADIO-SET tt-sub-respostas.whResp NO-ERROR
          ASSIGN FRAME = tt-categorias.whFrame
                 SENSITIVE = TRUE
                 ROW = ip-linha + 1
                 COLUMN = 5
                 WIDTH = 80
                 HEIGHT = iContResp
                 RADIO-BUTTONS = cListItens
                 VISIBLE   = TRUE.
    
    
    END.
    
    Obrigado desde já.

Compartilhe esta Página