Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

View file
namewmainten.w
height250


Bloco de código
titleExemplo de utilização do TreeView
linenumberstrue
collapsetrue
// definition area
{utp/ut-treeview.i}

// procedure area
PROCEDURE AfterDisplayFields :
    IF  NOT VALID-HANDLE(h-treeview) THEN DO:
        // instancia o treeview
        RUN utp/ut-treeview.w PERSISTENT SET h-treeview.

       // inicializa o treeview   
       RUN initializeObject IN h-treeview.
   
       // faz a subscricao do evento de click dentro do treeview
        SUBSCRIBE TO "tvNodeEvent" IN h-treeview.
   
       // repositiona o treeview
       RUN repositionObject IN h-treeview ( 2.65 , 1.30 ) NO-ERROR.

       // ajusta o tamanho do componente
       RUN resizeObject IN h-treeview ( 14.35 , 28.00 ) NO-ERROR.
    END.

     // carrega os itens do treeview
    RUN pi-loadNodes.
    
    // faz o refresh do treeview
    RUN pi-atualizaTreeview IN THIS-PROCEDURE.   

    // coloca o cursor no treeview
    RUN applyEntry IN h-treeview (INPUT ""). 
END PROCEDURE.

// esta procedure sera executada toda vez que ocorrer um evento de click em um determinado nó
PROCEDURE pi-ClickTreeView :
    MESSAGE c-codigo-node VIEW_AS ALERT-BOX.
END PROCEDURE.

// retira o treeview da memoria
PROCEDURE beforeDestroyInterface :
   IF VALID-HANDLE(h-treeview) THEN DO:
      RUN destroyObject IN h-treeview.
      DELETE PROCEDURE h-treeview NO-ERROR.
   END.

   RETURN "OK":U.
END PROCEDURE.

...