Results 1 to 10 of 26

Thread: Dynamic Objects Library Alpha 1 now available for download!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #21

    Default Re: Dynamic Objects Library Alpha 1 now available for download!

    Hi,

    I changed my code, now is working fine.


    Code:
    Use cWebView.pkg
    Use cWebPanel.pkg
    Use cWebButton.pkg
    Use cWebForm.pkg
    Use cWebLabel.pkg
    Use cWebHtmlBox.pkg
    Use cWebGrid.pkg
    Use cWebColumn.pkg
    Use cWebFileUploadForm.pkg
    Use cWebFileUploadButton.pkg
    Use cWebTreeView.pkg
    Use cvVendas_BIWSDataDictionary.dd
    Use cWebEdit.pkg
    Use cWebDynamicObjectContainer.pkg
    Use cWebSuggestionForm.pkg
    
    
    Register_Object oAnaliseVendas
    
    
    Struct sFiltros
        String  sCampo
        Integer iTipoCampo
        Integer piColumnIndex
        Integer piColumnSpan
        Integer peLabelPosition
        String  psLabel
        String  psValue    
    End_Struct
    
    
    Object oAnaliseVendas is a cWebView
        {WebProperty = Client }
        Property String[] psNomeCampos
    
    
        {WebProperty=Client}
        Property sFiltros[] psFiltros
    
    
         
        Object ovVendas_BI_DD is a cvVendas_BIWSDataDictionary
        End_Object
    
    
        Set Main_DD to ovVendas_BI_DD
        Set Server to ovVendas_BI_DD
    
    
    //    {WebProperty=Client}
    //    Property sCampos[] pCampos // estrutura com todos os dados dos campos
        
    
    
        Set piWidth to 1240
        Set psCaption to "Designer"
        Set piColumnCount to 100
        Set pbFindKeys to False
        Set pbFillHeight to True
        Set pbClearAfterSave to False
        Set pbClearKeys to False
        Set pbDeleteKeys to False
        Set pbDrillDownDynamicConstraints to False
        Set pbSaveKeys to False
        Set pbServerOnShow to True
        
        // Your DDO structure will go here
    
    
        Object oWebTopPanel is a cWebPanel
            Set peRegion to prTop
            Set psBackgroundColor to "#EEEEEE"
            
            Object oFerramentas is a cWebToolBar
    
    
                Object oAbreModelos is a cWebMenuitem
                    Set psToolTip to 'Novo Relatório.'
                    Set psCSSClass to "WebPromptMenuItem"
    
    
                    Procedure OnClick
                        Forward Send OnClick
                        Boolean bStatus
                        
                        WebGet pbRender of oMenuBar to bStatus
                        WebSet pbRender of oMenuBar to (not(bStatus))
                        If (bStatus) Send Show of oWebMenuEsquerdo
                        Else Send Hide of oWebMenuEsquerdo
    //                    Send Show of oWebMenuEsquerdo
                    End_Procedure
                End_Object  
    
    
    
    
    
    
            End_Object
    
    
        End_Object 
    
    
    
    
    
    
        Object oWebMainPanel is a cWebPanel
            Set piColumnCount to 100
    
    
            Object oWebFiltro is a cWebDynamicObjectContainer
    
    
                Set pbFillHeight to False
    //            Set pbShowLabel to True
                Set piColumnCount to 100
                Set piMinHeight to 150
    
    
                Procedure carga
                    Integer Icontador
                    sFiltros[] sFiltros
                    Handle hObj
                    Send ResetContainer 
                    WebGet psFiltros of oAnaliseVendas to sFiltros
    
    
                    For Icontador from 0 to (SizeOfArray(sFiltros) -1)
                        Get CreateDynamicObject of oWebFiltro (RefClass(cWebForm)) sFiltros[Icontador].sCampo "" to hObj
        
                        Send InitDynamicProp of hObj "piColumnIndex"   sFiltros[Icontador].piColumnIndex
                        Send InitDynamicProp of hObj "piColumnSpan"    sFiltros[Icontador].piColumnSpan
                        Send InitDynamicProp of hObj "peLabelPosition" sFiltros[Icontador].peLabelPosition
                        Send InitDynamicProp of hObj "psLabel"         sFiltros[Icontador].sCampo
                        Send InitDynamicProp of hObj "psValue"         sFiltros[Icontador].psValue
                    Loop
    
    
                    Send Activate to owebfiltro
                    
                End_Procedure
    
    
    
    
            End_Object
    
    
            Object oWebButton1 is a cWebButton
                Set piColumnSpan to 0
                Set psCaption to "button"
            
                Procedure OnClick
                    WebSet pbActivated of oWebFiltro to False
                    Send Activate to oWebFiltro
                End_Procedure
            End_Object
    
    
        End_Object 
    
    
        Object oWebLeftPanel is a cWebPanel
            Set peRegion to prLeft
            Set psBackgroundColor to "#EEEEEE"
            Set piWidth to 200
    
    
            Object oWebArquivoCampos is a cWebTreeView
                {WebProperty=Client}
                Property Integer piNextID 1
                Set pbServerOnSelect to True
    
    
                Function tipo_campo String sCampo Returns Integer
                    Integer iQtCampos iContador iTipoCampo
                    String sScampo
                    Get_Attribute DF_FILE_NUMBER_FIELDS of vVendas_BI.File_Number to iQtCampos
                    For iContador from 1 to iQtCampos
                            // Desconsiderando campos Overlap e Binary
                            Get_Attribute DF_FIELD_TYPE of vVendas_BI.File_Number iContador to iTipoCampo
                            Get_Attribute DF_FIELD_NAME of vVendas_BI.File_Number iContador to sScampo
                            
                            If (sScampo = sCampo) ;
                            Function_Return iTipoCampo
                        Loop        
    
    
                    Function_Return -1
                End_Function
    
    
    
    
                Function cria_filtro String sCampo Returns Boolean
                    
                    // verifica se o campo / objeto existe.
                    Integer iTipoCampo Icontador
                    sFiltros[] sFiltros
                    Handle hObj
    
    
                    WebGet psFiltros of oAnaliseVendas to sFiltros
                    
                    For Icontador from 0 to (SizeOfArray(sFiltros) -1)
                        If (sCampo = sFiltros[Icontador].sCampo) Function_Return False
                    Loop
                    
                    Move (SizeOfArray(sFiltros)) to Icontador
                    Move sCampo to sFiltros[Icontador].sCampo
                    Move (tipo_campo(Self,sCampo)) to sFiltros[Icontador].iTipoCampo                
                   
                    If (sFiltros[Icontador].iTipoCampo = DF_ASCII) ;
                    Begin
                        Move 0      to sFiltros[Icontador].piColumnIndex
                        Move 0      to sFiltros[Icontador].piColumnSpan
                        Move lpTop  to sFiltros[Icontador].peLabelPosition
                        Move sCampo to sFiltros[Icontador].psLabel
                        Move ''     to sFiltros[Icontador].psValue
    
    
                    End
                    
                    WebSet psFiltros of oAnaliseVendas to sFiltros
    
    
                    Send carga of oWebFiltro
                End_Function
    
    
    
    
                Procedure OnSelect String sId String sValue Integer iLevel
                    Forward Send OnSelect sId sValue iLevel
                    Boolean bRet
                    If (sValue<> '') ;
                    Begin
                        Case Begin
                            Case (sId <= 200)
                            Get cria_filtro sValue to bRet
                            
                            Case Break
                        Case End
                        
                    End
                    
                End_Procedure
    
    
                Function OnLoadChildNodes String sId String sValue Integer iLevel Returns tWebTreeItem[]
                    tWebTreeItem[] RetVal
                    Forward Get OnLoadChildNodes sId sValue iLevel to RetVal
                    
                    Integer iQtCampos iContador iTipoCampo
                    Integer iID
                    String sParentId
    
    
                    String[] sNomeCampo
                    WebGet psNomeCampos of oAnaliseVendas to sNomeCampo
    
    
                    If ((SizeOfArray(sNomeCampo)) <= 0) ;
                    Begin
                    
                        Get_Attribute DF_FILE_NUMBER_FIELDS of vVendas_BI.File_Number to iQtCampos
                        For iContador from 1 to iQtCampos
                            // Desconsiderando campos Overlap e Binary
                            Get_Attribute DF_FIELD_TYPE of vVendas_BI.File_Number iContador to iTipoCampo
                            
                            If (iTipoCampo <> DF_OVERLAP and iTipoCampo <> DF_BINARY)  ;
                            Begin
                                Get_Attribute DF_FIELD_NAME of vVendas_BI.File_Number iContador to sNomeCampo[(SizeOfArray(sNomeCampo))]
                //                Move (ToOEM(sNomeCampo[(SizeOfArray(sNomeCampo)-1)])) to sNomeCampo[(SizeOfArray(sNomeCampo)-1)]
                            End
                        Loop        
                
                        WebSet psNomeCampos of oAnaliseVendas to sNomeCampo
                    End
                    
                    
                    If (iLevel = 0) ;
                    Begin
                        Move 0         to RetVal[0].sId
                        Move True      to RetVal[0].bFolder
                        Move 'Filtros' to RetVal[0].sName
                        Move True      to RetVal[0].bLoadChildren
    
    
                        Move 1         to RetVal[1].sId
                        Move True      to RetVal[1].bFolder
                        Move 'Colunas' to RetVal[1].sName
                        Move True      to RetVal[1].bLoadChildren
    
    
                        Move 2         to RetVal[2].sId
                        Move True      to RetVal[2].bFolder
                        Move 'Linhas'  to RetVal[2].sName
                        Move True      to RetVal[2].bLoadChildren
    
    
                    End
                    Move (sId + 1 * 100) to iID
    
    
                    If (iLevel = 1) ;
                    For iContador from 0 to ((SizeOfArray(sNomeCampo)) -1)
    
    
                        Increment iID                    
                        Move iID                   to RetVal[iContador].sId
                        Move sId                   to RetVal[iContador].sParentId
                        Move sNomeCampo[iContador] to RetVal[iContador].sName
                        Move sNomeCampo[iContador] to RetVal[iContador].sValue
                        Move False                 to RetVal[iContador].bFolder
                        Move True                  to RetVal[iContador].bExpanded  
                        Move False                 to RetVal[iContador].bLoadChildren
                    Loop
    
    
                    Function_Return RetVal
                End_Function
    
    
                
            End_Object
            
    
    
        End_Object 
    
    
        Object oWebRightPanel is a cWebPanel
            Set peRegion to prRight
            Set psBackgroundColor to "#EEEEEE"
            Set piWidth to 100
            
            Object oButtonSample is a cWebButton
                Set psCaption to "Right"
            End_Object
    
    
        End_Object 
    
    
        Object oWebBottomPanel is a cWebPanel
            Set peRegion to prBottom
            Set psBackgroundColor to "#DDDDDD"
            
            Object oButtonSample is a cWebButton
                Set psCaption to "Bottom"
            End_Object
            
        End_Object 
    
    
        Procedure OnShow
            Forward Send OnShow
        End_Procedure
    
    
    End_Object
    Last edited by sandrobrz; 4-Dec-2019 at 12:20 PM. Reason: Change my code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •