Fwh19.05 - New Class TDockPnel

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Thu Dec 12, 2019 1:11 pm

leandro wrote:Cristobal, buenas noches

Ahora estoy intentando colocar los datos que requiero mostrar dentro de los paneles, por ahora quiero colocar el resultado de una consulta en el panel 1, pero los datos del recorset no se muestran en el xbrowse (como puedes ver en la imagen la información si esta en el recorset), lo hago de la misma manera en un dialogo y funciona perfectamente.

Code: Select all  Expand view

**********************************
* REPORTE DE KARDEX Y MOVIMIENTO *
**********************************
fTesDock()
FUNCTION fTesDock()

#include "fivewin.ch"
#include "report.ch"
#include "Ado.ch"
#include "vrd.ch"
#include "dtpicker.ch"
#include "xbrowse.ch"
#include "colores.ch"
#include "tgraph.ch"

Local oWChRgr1
Local cFont         := "Liberation Mono"   //TAHOMA   //CALIBRI  //SEGOE UI SYMBOL

Public oFontCtrl,oFont1
Public cPathApp := cFilePath( GetModuleFileName( GetInstance() ) )

DEFINE FONT oFont  NAME cFont SIZE 0,-11
DEFINE FONT oFontB NAME cFont SIZE 0,-14 BOLD     //ARIAL NARROW
DEFINE FONT oFont1 NAME cFont SIZE 0,-11 BOLD
DEFINE FONT oFontE NAME cFont SIZE 0,-14
DEFINE FONT oFont2 NAME cFont SIZE 0,-16
DEFINE FONT oFont3 NAME cFont SIZE 0,-20 //BOLD
DEFINE FONT oFont4 NAME "CALIBRI" SIZE 0,-16
DEFINE FONT oFontCtrl NAME cFont SIZE 0, -9 BOLD
DEFINE FONT oFontS NAME "FIXEDSYS" SIZE 0,-12

DEFINE WINDOW oWChRgr1 MDICHILD TITLE "Reporte Inventario Gráfico" ICON "#8001" OF oWnd

   oDock1  := TDockPnel():New( oWChRgr1 )
   
   WITH OBJECT oDock1
      :SetHeightCaption( 40 )
      :SetCoors( { | o | 10 }, { | o | 10 }, ;
                 { | o | Int( o:oWnd:nHeight / 2 ) }, ;
                 { | o | Int( o:oWnd:nWidth / 2 ) - XEVal( o:nLeft, o ) } )
      :SetCaption( { | o | "Entradas y Salidas Mensuales" } )
      :SetColors( METRO_RED, CLR_WHITE, Rgb( 88, 88, 88 ), CLR_HGRAY )
      :SetFont( oFont4 )
      :SetBorderSize( 1 )
      :SetImgsFiles( { { "C:\fwh1909\bitmaps\16x16\panel.bmp", ;
                        { || oDock1:aBtnBmps[ 1 ]:SetImages( if( oDock1:lSelected, "..\bitmaps\16x16\panel.bmp", "\Fwh\bitmaps\16x16\check.bmp" ) ), ;
                             oDock1:lSelected := !oDock1:lSelected }, "ToolTip" } } )
      :SetCtrlsPnel( { | o, nT, nL, nH, nW, oB | oB := fMovMeses( o, nT, nL, nH, nW ) } )
      :bRClicked   := { || MsgInfo( oDock1:oWnd:aControls[ 1 ]:ClassName() ) }
      :Activate()
   END

   oDock2  := TDockPnel():New( oWChRgr1 )
   WITH OBJECT oDock2
      :SetHeightCaption( 40 )
      :SetCoors( { | o | XEval( o:oWnd:aControls[ 1 ]:nTop, o ) }, ;
                 { | o | XEval( o:oWnd:aControls[ 1 ]:nRight, o ) + 10 }, ;
                 { | o | XEval( o:oWnd:aControls[ 1 ]:nBottom, o ) }, ;
                 { | o | Int( o:oWnd:nWidth / 2 ) + XEval( o:nLeft, o ) - 40 } )
      :SetCaption( { | o | "Kardex Por Artículo" } )
      :SetColors( CLR_WHITE, METRO_AMBER, METRO_AMBER, CLR_WHITE )
      :SetBorderSize( 1 )
      :SetFont( oFont4 )
      :Activate()
   END

   oDock3  := TDockPnel():New( oWChRgr1 )
   WITH OBJECT oDock3
      :SetHeightCaption( 40 )
      :SetCoors( { | o | XEval( o:oWnd:aControls[ 2 ]:nBottom, o ) + 10 }, ;
                 { | o | 10 }, ;
                 { | o | Int( o:oWnd:nHeight / 2 ) + XEval( o:oWnd:aControls[ 2 ]:nHeight, o ) - 34 }, ;
                 { | o | XEVal( o:oWnd:aControls[ 2 ]:nRight, o )  } )
      :SetCaption( { | o | "Graficas Informativas" } )
      :SetBorderSize( 4 )
      :SetColors( CLR_WHITE, METRO_RED, Rgb( 88, 88, 88 ), CLR_WHITE )
      :SetFont( oFont4 )
      :SetImgsFiles( { { "C:\fwh1909\bitmaps\16x16\min.bmp", ;
                       { || oDock1:aBtnBmps[ 1 ]:SetImages( if( oDock1:lSelected, "\Fwh\bitmaps\16x16\panel.bmp", "\Fwh\bitmaps\16x16\check.bmp" ) ), ;
                            oDock1:lSelected := !oDock1:lSelected }, "ToolTip" } } )
      :Activate()
   END

ACTIVATE WINDOW oWChRgr1 MAXIMIZED
Return nil

**********************************
*MOVIMIENTO DE ARTICULOS POR MESES
**********************************
function fMovMeses(oP, nT, nL, nH, nW)
    Local cQry
    Local oBrwMs
    Local nWidth := 0

    TEXT INTO cQry
        SELECT mes,SUM(entradas) AS entradas,SUM(salidas) AS salidas,nombre FROM (
        SELECT MONTH(MOV.o_fechas) AS mes,SUM(MOV.o_cansal) AS salidas,SUM(MOV.o_canent) AS entradas,"Leandro" AS nombre
        FROM tbl_movi MOV WHERE MOV.o_articu='CORP012' GROUP BY MONTH(MOV.o_fechas)
        UNION
        SELECT MONTH(FAC.mm_fechas) AS mes,SUM(FAC.mm_cansal) AS salidas,SUM(FAC.mm_canent) AS entradas,"Arevalo" AS nombre
        FROM tbl_mofa FAC WHERE FAC.mm_articu='CORP012' GROUP BY MONTH(FAC.mm_fechas)
        ) MOV GROUP BY mes
    ENDTEXT
   
    Define Font oFont  Name "Calibri" Size 0,-13 BOLD
    Define Font oFont1 Name "Calibri" Size 0,-13
    Define Font oFont2 Name "Calibri" Size 0,-20 BOLD   
   
    //CREAMOS UNA CONEXION PARA EL REPORTE
    vCnd := "DSN=dlyma;Uid="+oLamcla:cUsuario+";Pwd="+oLamcla:cPassword+";"
    oCnMes := FW_OpenAdoConnection( vCnd )
    //Activamos  DB
    vQry := "USE "+oLamcla:cEmpDBda
    TRY
      oCnMes:Execute(vQry)
    CATCH oError
      FW_ShowAdoError(oCnMes)
    END 
   
   
    oRsMes := FW_OPENRECORDSET(oCnMes,cQry,adLockOptimistic,adOpenKeyset)

   
    oBrwMs := TXBrowse():New( oP )
    oBrwMs:nMarqueeStyle         := MARQSTYLE_HIGHLROW
    oBrwMs:nRowDividerStyle      := LINESTYLE_LIGHTGRAY
    oBrwMs:nColDividerStyle      := LINESTYLE_LIGHTGRAY
    oBrwMs:nHeaderLines          := 1
    oBrwMs:lColDividerComplete   := .t.
    oBrwMs:lRecordSelector       := .t.
    oBrwMs:l2007                 := .f.
    oBrwMs:oFont                 := oFont1  
    oBrwMs:bClrRowFocus    := { || { CLR_BLACK, RGB( 185, 220, 255 ) } }
    oBrwMs:bClrStd         := { || { Rgb( 88, 88, 88 ), CLR_WHITE } }
    oBrwMs:nColorPen       := CLR_HGRAY
    oBrwMs:bClrHeader      := { || { CLR_BLACK, CLR_WHITE, CLR_HGRAY } }
    oBrwMs:lFullGrid       := .T.
    oBrwMs:lRecordSelector := .F.
    oBrwMs:lHScroll        := .F.
    oBrwMs:lVScroll        := .F.
    oBrwMs:lFitGridHeight  := .T.
    oBrwMs:nHeaderHeight   := 32
    oBrwMs:nRowHeight      := 27

    oCol          = oBrwMs:AddCol()
    oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "mes" ):Value , "99" ) ) }
    oCol:cHeader  = "Mes"
    oCol:nWidth   = 80
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oCol          = oBrwMs:AddCol()
    oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "entradas" ):Value , "999,999" ) ) }
    oCol:cHeader  = "Entradas"
    oCol:nWidth   = 80
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oCol          = oBrwMs:AddCol()
    oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "salidas" ):Value , "999,999" ) ) }
    oCol:cHeader  = "Salidas"
    oCol:nWidth   = 80
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oCol          = oBrwMs:AddCol()
    oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "entradas" ):Value - oRsMes:Fields( "salidas" ):Value , "999,999" ) ) }
    oCol:cHeader  = "Saldo"
    oCol:nWidth   = 80
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oCol          = oBrwMs:AddCol()
    oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), cValtoChar( oRsMes:Fields( "nombre" ):Value ) ) }
    oCol:cHeader  = "Nombre"
    oCol:nWidth   = 80
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oBrwMs:SetADO( oRsMes ) 
    oBrwMs:CreateFromCode() 

Return oBrwMs
 


Leandro, TDockPnel, no interfiere en ningún caso con el contenido de los controles que se sitúan en su interior como cualquier otro contenedor.
Dicho esto, el problema debe estar en la definición del XBrowse
Prueba algo asi y vamos viendo donde puede estar el problema

Code: Select all  Expand view

**********************************
*MOVIMIENTO DE ARTICULOS POR MESES
**********************************
function fMovMeses(oP, nT, nL, nH, nW)
    Local cQry
    Local oBrwMs
    Local nWidth := 0

    TEXT INTO cQry
        SELECT mes,SUM(entradas) AS entradas,SUM(salidas) AS salidas,nombre FROM (
        SELECT MONTH(MOV.o_fechas) AS mes,SUM(MOV.o_cansal) AS salidas,SUM(MOV.o_canent) AS entradas,"Leandro" AS nombre
        FROM tbl_movi MOV WHERE MOV.o_articu='CORP012' GROUP BY MONTH(MOV.o_fechas)
        UNION
        SELECT MONTH(FAC.mm_fechas) AS mes,SUM(FAC.mm_cansal) AS salidas,SUM(FAC.mm_canent) AS entradas,"Arevalo" AS nombre
        FROM tbl_mofa FAC WHERE FAC.mm_articu='CORP012' GROUP BY MONTH(FAC.mm_fechas)
        ) MOV GROUP BY mes
    ENDTEXT
   
    Define Font oFont  Name "Calibri" Size 0,-13 BOLD
    Define Font oFont1 Name "Calibri" Size 0,-13
    Define Font oFont2 Name "Calibri" Size 0,-20 BOLD   
   
    //CREAMOS UNA CONEXION PARA EL REPORTE
    vCnd := "DSN=dlyma;Uid="+oLamcla:cUsuario+";Pwd="+oLamcla:cPassword+";"
    oCnMes := FW_OpenAdoConnection( vCnd )
    //Activamos  DB
    vQry := "USE "+oLamcla:cEmpDBda
    TRY
      oCnMes:Execute(vQry)
    CATCH oError
      FW_ShowAdoError(oCnMes)
    END 
   
   
    oRsMes := FW_OPENRECORDSET(oCnMes,cQry,adLockOptimistic,adOpenKeyset)

   
    oBrwMs := TXBrowse():New( oP )
    oBrwMs:nTop                        := nT
    oBrwMs:nLeft                       := nL
    oBrwMs:nHeight                   := nH
    oBrwMs:nWidth                    := nW
    //oBrwMs:lAutoCols                 := .T.
    // oBrwMs:nDataType               := DATATYPE_ADO

    oBrwMs:nMarqueeStyle         := MARQSTYLE_HIGHLROW
    oBrwMs:nRowDividerStyle      := LINESTYLE_LIGHTGRAY
    oBrwMs:nColDividerStyle      := LINESTYLE_LIGHTGRAY
    oBrwMs:nHeaderLines          := 1
    oBrwMs:lColDividerComplete   := .t.
    oBrwMs:lRecordSelector       := .t.
    oBrwMs:l2007                 := .f.
    oBrwMs:oFont                 := oFont1  
    oBrwMs:bClrRowFocus    := { || { CLR_BLACK, RGB( 185, 220, 255 ) } }
    oBrwMs:bClrStd         := { || { Rgb( 88, 88, 88 ), CLR_WHITE } }
    oBrwMs:nColorPen       := CLR_HGRAY
    oBrwMs:bClrHeader      := { || { CLR_BLACK, CLR_WHITE, CLR_HGRAY } }
    oBrwMs:lFullGrid       := .T.
    oBrwMs:lRecordSelector := .F.
    oBrwMs:lHScroll        := .F.
    oBrwMs:lVScroll        := .F.
    oBrwMs:lFitGridHeight  := .T.
    oBrwMs:nHeaderHeight   := 32
    oBrwMs:nRowHeight      := 27


    oBrwMs:SetADO( oRsMes, .T., .T. ) 
    oBrwMs:CreateFromCode() 

/*
    oCol          = oBrwMs:AddCol()
    oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "mes" ):Value , "99" ) ) }
    oCol:cHeader  = "Mes"
    oCol:nWidth   = 80
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oCol          = oBrwMs:AddCol()
    oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "entradas" ):Value , "999,999" ) ) }
    oCol:cHeader  = "Entradas"
    oCol:nWidth   = 80
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oCol          = oBrwMs:AddCol()
    oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "salidas" ):Value , "999,999" ) ) }
    oCol:cHeader  = "Salidas"
    oCol:nWidth   = 80
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oCol          = oBrwMs:AddCol()
    oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "entradas" ):Value - oRsMes:Fields( "salidas" ):Value , "999,999" ) ) }
    oCol:cHeader  = "Saldo"
    oCol:nWidth   = 80
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oCol          = oBrwMs:AddCol()
    oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), cValtoChar( oRsMes:Fields( "nombre" ):Value ) ) }
    oCol:cHeader  = "Nombre"
    oCol:nWidth   = 80
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oBrwMs:SetADO( oRsMes ) 
    oBrwMs:CreateFromCode() 
*/


Return oBrwMs
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby leandro » Thu Dec 12, 2019 2:47 pm

Gracias por responder Cristobal,

Excelente, todo hasta ahí bien, ya muestra los datos, ahora necesito poder seleccionar las columnas y hacer algunas operaciones con ellas, pero cuando agrego manualmente la columna, no muestra la información.

Image

Code: Select all  Expand view
function fMovMeses(oP, nT, nL, nH, nW)
    Local cQry
    Local oBrwMs
    Local nWidth := 0

    TEXT INTO cQry
        SELECT mes,SUM(entradas) AS entradas,SUM(salidas) AS salidas,nombre FROM (
        SELECT MONTH(MOV.o_fechas) AS mes,SUM(MOV.o_cansal) AS salidas,SUM(MOV.o_canent) AS entradas,"Leandro" AS nombre
        FROM tbl_movi MOV WHERE MOV.o_articu='CORP012' GROUP BY MONTH(MOV.o_fechas)
        UNION
        SELECT MONTH(FAC.mm_fechas) AS mes,SUM(FAC.mm_cansal) AS salidas,SUM(FAC.mm_canent) AS entradas,"Arevalo" AS nombre
        FROM tbl_mofa FAC WHERE FAC.mm_articu='CORP012' GROUP BY MONTH(FAC.mm_fechas)
        ) MOV GROUP BY mes
    ENDTEXT
   
    msginfo(cQry)
   
    Define Font oFont  Name "Calibri" Size 0,-13 BOLD
    Define Font oFont1 Name "Calibri" Size 0,-13
    Define Font oFont2 Name "Calibri" Size 0,-20 BOLD   
   
    //CREAMOS UNA CONEXION PARA EL REPORTE
    vCnd := "DSN=dlyma;Uid="+oLamcla:cUsuario+";Pwd="+oLamcla:cPassword+";"
    oCnMes := FW_OpenAdoConnection( vCnd )
    //Activamos  DB
    vQry := "USE "+oLamcla:cEmpDBda
    TRY
      oCnMes:Execute(vQry)
    CATCH oError
      FW_ShowAdoError(oCnMes)
    END 
   
   
    oRsMes := FW_OPENRECORDSET(oCnMes,cQry,adLockOptimistic,adOpenKeyset)
   
    oBrwMs := TXBrowse():New( oP )
    oBrwMs:nTop                        := nT
    oBrwMs:nLeft                       := nL
    oBrwMs:nHeight                   := nH
    oBrwMs:nWidth                    := nW

    oBrwMs:nMarqueeStyle         := MARQSTYLE_HIGHLROW
    oBrwMs:nRowDividerStyle      := LINESTYLE_LIGHTGRAY
    oBrwMs:nColDividerStyle      := LINESTYLE_LIGHTGRAY
    oBrwMs:nHeaderLines          := 1
    oBrwMs:lColDividerComplete   := .t.
    oBrwMs:lRecordSelector       := .t.
    oBrwMs:l2007                 := .f.
    oBrwMs:oFont                 := oFont1  
    oBrwMs:bClrRowFocus    := { || { CLR_BLACK, RGB( 185, 220, 255 ) } }
    oBrwMs:bClrStd         := { || { Rgb( 88, 88, 88 ), CLR_WHITE } }
    oBrwMs:nColorPen       := CLR_HGRAY
    oBrwMs:bClrHeader      := { || { CLR_BLACK, CLR_WHITE, CLR_HGRAY } }
    oBrwMs:lFullGrid       := .T.
    oBrwMs:lRecordSelector := .F.
    oBrwMs:lHScroll        := .F.
    oBrwMs:lVScroll        := .F.
    oBrwMs:lFitGridHeight  := .T.
    oBrwMs:nHeaderHeight   := 32
    oBrwMs:nRowHeight      := 27

    oCol          = oBrwMs:AddCol()
    oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), cValtoChar( oRsMes:Fields( "nombre" ):Value ) ) }
    oCol:cHeader  = "Manipulando Col"
    oCol:nWidth   = 80
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oBrwMs:SetADO( oRsMes, .T. , .T. )
    oBrwMs:CreateFromCode()

Return oBrwMs
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1481
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Thu Dec 12, 2019 6:21 pm

Por qué no intentas en lugar de utilizar ADDCOLUMN, definir tus columnas previamente en el SETADO, y después ya solo tienes que definir los aspectos estéticos de cada columna?

Code: Select all  Expand view

oBrwMs:SetADO( oRsMes, .T. , .T., { "nombre", ..... } )
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby leandro » Fri Dec 13, 2019 6:34 pm

Cristobal buenas tardes....

Pues finalmente después de desmenuzar el código logre que funcionara, así quedo el código.
Code: Select all  Expand view

**********************************
*MOVIMIENTO DE ARTICULOS POR MESES
**********************************
function fMovMeses(oP, nT, nL, nH, nW)
    Local cQry
    Local oBrwMs
    Local nWidth := 0
    Local aDatos := {}
    Local nTotEnt := 0
    Local nTotSal := 0
    Local nTotSld := 0

    TEXT INTO cQry
        SELECT mes,SUM(entradas) AS entradas,SUM(salidas) AS salidas FROM (
           
            SELECT MONTH(MOV.o_fechas) AS mes,SUM(MOV.o_cansal) AS salidas,SUM(MOV.o_canent) AS entradas  
            FROM tbl_movi MOV WHERE MOV.o_articu='&cDato' GROUP BY MONTH(MOV.o_fechas)
           
            UNION ALL
           
            SELECT MONTH(FAC.mm_fechas) AS mes,SUM(FAC.mm_cansal) AS salidas,SUM(FAC.mm_canent) AS entradas  
            FROM (tbl_mofa FAC LEFT JOIN tbl_fact CAB ON FAC.mm_docume=CAB.ll_docume AND
            FAC.mm_consec=CAB.ll_consec ) WHERE FAC.mm_articu='&cDato' AND CAB.ll_anulad<>'A'
            GROUP BY MONTH(FAC.mm_fechas)
           
        ) MOV GROUP BY mes
    ENDTEXT
   
    Define Font oFont  Name "Calibri" Size 0,-13 BOLD
    Define Font oFont1 Name "Calibri" Size 0,-13
    Define Font oFont2 Name "Calibri" Size 0,-20 BOLD   
   
    oRsMes := FW_OPENRECORDSET(oCnMes,cQry,adLockOptimistic,adOpenKeyset)
    nRegistros := oRsMes:RecordCount()
    if nRegistros#0
        aDatos := RsToHash( oRsMes )
    endif
   
    FOR m:=1 TO len(aDatos)
        nEnt := aDatos[m]["entradas"]
        nSal := aDatos[m]["salidas"]
        nSaldo := nEnt - nSal
       
        nTotEnt := nTotEnt + nEnt
        nTotSal := nTotSal + nSal
       
        if m==1
            aDatos[m]["saldo"] :=  nSaldo
            nNuevo := nSaldo
        endif      
       
        nSaldo := nNuevo + nEnt - nSal
        if m#1
            aDatos[m]["saldo"] :=  nSaldo
            nNuevo := nSaldo
            nTotSld := nSaldo
        endif      
       
    NEXT   
   
    oBrwMs := TXBrowse():New( oP )
    oBrwMs:nTop                        := nT
    oBrwMs:nLeft                       := nL
    oBrwMs:nHeight                   := nH
    oBrwMs:nWidth                    := nW

    oBrwMs:nMarqueeStyle         := MARQSTYLE_HIGHLROW
    oBrwMs:nRowDividerStyle      := LINESTYLE_LIGHTGRAY
    oBrwMs:nColDividerStyle      := LINESTYLE_LIGHTGRAY
    oBrwMs:nHeaderLines          := 1
    oBrwMs:lColDividerComplete   := .t.
    oBrwMs:lRecordSelector       := .t.
    oBrwMs:l2007                 := .f.
    oBrwMs:oFont                 := oFont1  
    oBrwMs:nStretchCol           := STRETCHCOL_LAST
    oBrwMs:bClrRowFocus    := { || { CLR_BLACK, RGB( 185, 220, 255 ) } }
    oBrwMs:bClrStd         := { || { Rgb( 88, 88, 88 ), CLR_WHITE } }
    oBrwMs:nColorPen       := CLR_HGRAY
    oBrwMs:bClrHeader      := { || { CLR_BLACK, CLR_WHITE, CLR_HGRAY } }
    oBrwMs:bClrFooter      := { || { CLR_BLACK, CLR_WHITE, CLR_HGRAY } }
    oBrwMs:lFullGrid       := .T.
    oBrwMs:lRecordSelector := .F.
    oBrwMs:lHScroll        := .F.
    oBrwMs:lVScroll        := .F.
    oBrwMs:lFitGridHeight  := .T.
    oBrwMs:nHeaderHeight   := 32
    oBrwMs:nRowHeight      := 27
    oBrwMs:lFooter         := .t.
    oBrwMs:nFooterLines    := 1
    oBrwMs:nFooterHeight   := 30  
   
    //Calculamos el Ancho del xBrowse
    nAnchoCols := (oBrwMs:nWidth-15)/4

    oCol          = oBrwMs:AddCol()
    oCol:bStrData := {|| if(Len( aDatos ) > 0 , aMeses[ aDatos[oBrwMs:nArrayAt]["mes"] ] ,"" ) }
    oCol:cHeader  = "Mes"
    oCol:nWidth   = nAnchoCols
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont
    oCol:cFooter      = "TOTALES"   
    oCol:oFooterFont = oFont

    oCol          = oBrwMs:AddCol()
    oCol:bStrData := {|| if(Len( aDatos ) > 0 ,  Transform( aDatos[oBrwMs:nArrayAt]["entradas"] , "9,999,999") ,"" ) }
    oCol:cHeader  = "Entradas"
    oCol:nWidth   = nAnchoCols
    oCol:nHeadStrAlign = AL_RIGHT
    oCol:nDataStrAlign = AL_RIGHT   
    oCol:oHeaderFont = oFont
    oCol:bFooter       = {|| Transform(nTotEnt,oLamcla:PIC7) }
    oCol:nFootStrAlign = 1
    oCol:oFooterFont = oFont

    oCol          = oBrwMs:AddCol()
    oCol:bStrData := {|| if(Len( aDatos ) > 0 ,  Transform( aDatos[oBrwMs:nArrayAt]["salidas"] , "9,999,999") ,"" ) }
    oCol:cHeader  = "Salidas"
    oCol:nWidth   = nAnchoCols
    oCol:nHeadStrAlign = AL_RIGHT
    oCol:nDataStrAlign = AL_RIGHT   
    oCol:oHeaderFont = oFont
    oCol:bFooter       = {|| Transform(nTotSal,oLamcla:PIC7) }
    oCol:nFootStrAlign = 1
    oCol:oFooterFont = oFont

    oCol          = oBrwMs:AddCol()
    oCol:bStrData := {|| if(Len( aDatos ) > 0 ,  Transform( aDatos[oBrwMs:nArrayAt]["saldo"] , "9,999,999") ,"" ) }
    oCol:cHeader  = "Saldo"
    oCol:nWidth   = nAnchoCols
    oCol:nHeadStrAlign = AL_RIGHT
    oCol:nDataStrAlign = AL_RIGHT   
    oCol:oHeaderFont = oFont
    oCol:bFooter       = {|| Transform(nTotSld,oLamcla:PIC7) }
    oCol:nFootStrAlign = 1
    oCol:oFooterFont = oFont
   
    oBrwMs:SetArray( aDatos )

    oBrwMs:CreateFromCode()

Return oBrwMs
 
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1481
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Fwh19.05 - New Class TDockPnel

Postby leandro » Fri Dec 13, 2019 6:55 pm

Cristobal, de nuevo molestando...

Me gustaría hacer algo similar a lo que muestras en el ejemplo que esta en la WIKI, una imagen dice mas que mil palabras.
Image

Quiero colocar algunos botones y un GET, se puede hacer? me indicarías como?

De antemano gracias
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1481
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Fri Dec 13, 2019 7:07 pm

Leandro eso que he mostrado es el XBROWSER ( XBROWSER.PRG ) comando modificado para convertirlo en un control integrable como cualquier otro sin que aparezca en un diálogo separado.
Para hacerlo necesitas crear en el dockpnel una buttonbar y un xbrowse debajo en la function que llamas desde
Code: Select all  Expand view

:SetCtrlsPnel( { | o, nT, nL, nH, nW | MyTest( o, nT, nL, nH, nW, 13 ) } )
 


O sea en la function MyTest, exactamente igual que harías si quisieras hacer una buttonbar y un xbrowse dentro de un diálogo o ventana

Qué tal la clase TDockPnel?
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Sun Dec 15, 2019 12:43 pm

Esto es una implementación que demuestra otras posibilidades de la clase ( como sabemos en un TDockPnel se pueden incluir uno o varios TDockPnel )
Hay que darle unas cuantas vueltas más al tema, pero creo que puede quedar bien

Image
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby vilian » Mon Mar 09, 2020 7:55 pm

Cristobal,
Is possible to use splitter with TdockPanel ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Mon Mar 09, 2020 9:20 pm

Dear Vilian
I designed the control to accept any type of control inside. There should be no problem putting a splitter. If I have a while I can prepare an example more simple

Yo diseñé el control para que aceptara cualquier tipo de control en su interior. No debe de haber ningún problema en poner un splitter. Si tengo un rato puedo preparar un ejemplo más simple

viewtopic.php?f=6&t=37272&p=223739&hilit=dock10#p223739
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Tue Mar 10, 2020 12:59 am

Sample with Splitter

Code: Select all  Expand view

#include "Fivewin.ch"
#include "Splitter.ch"

REQUEST HB_LANG_ES
REQUEST HB_CODEPAGE_ESWIN

Static nPop   := 0
Static oItems
Static aChecks

Static oWindow
Static nWAncho
Static nWAlto
Static nCol  
Static nRow  

Static oFont
Static oFontB
Static oFontD
Static oFontE
Static oFontS
Static oFontCtrl
Static cPathApp

Static oPanelExplorer
Static oPanelCalex
Static oVSplit

Static oDock3
Static oDock4
Static oDock5
Static oDock6

//----------------------------------------------------------------------------//

Function Main()

   local cFont         := "Liberation Mono"   //TAHOMA   //CALIBRI  //SEGOE UI SYMBOL

   //SetResDebug( .T. )
   //? HB_OSIS64BIT()

   //StartFWLog( , 650, 622, 600, .F., .T., , )    //.F.

   HB_CDPSELECT("ESWIN")
   HB_LangSelect( "ES" )

   SET DATE FORMAT "MM/DD/YYYY"
   SET DELETE ON
   oItems   := Array( 6 )
   aChecks  := { .F., .F., .F., .F., .F., .F. }

   cPathApp        := cFilePath( GetModuleFileName( GetInstance() ) )

   //FErase( cPathApp + "Checkres.txt" )

   DEFINE FONT oFont  NAME cFont SIZE 0,-11
   DEFINE FONT oFontB NAME cFont SIZE 0,-14 BOLD     //ARIAL NARROW
   DEFINE FONT oFontE NAME cFont SIZE 0,-14
   DEFINE FONT oFontCtrl NAME cFont SIZE 0, -9 BOLD
   DEFINE FONT oFontS NAME "Segoe UI Symbol" SIZE 0,-12

   TestDockPnel()

   oFont:End()
   oFontB:End()
   oFontE:End()
   oFontCtrl:End()
   oFontS:End()

   //Checkres()
   
Return nil

//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//

Static Function TestDockPnel()

   local nCol
   local nRow

   TDockPnel():lAllowMove  := .T.

   nWAncho   := Int( GetSysMetrics( 0 ) * 0.95 )
   nWAlto    := Int( GetSysMetrics( 1 ) * 0.95 )
   nCol      := Int( ( GetSysMetrics( 0 ) - nWAncho ) / 2 )
   nRow      := Int( ( GetSysMetrics( 1 ) - nWAlto  ) / 2 ) // + 2

   DEFINE WINDOW oWindow FROM nRow, nCol TO nWAlto + nRow, nWAncho + nCol ; //MDI ;
      PIXEL COLOR CLR_WHITE, Rgb( 220, 220, 220 ) ; //Rgb( 182, 182, 182 ) ; //, CLR_WHITE ;
      STYLE WS_POPUP

      CreaDocks6()
     
   ACTIVATE WINDOW oWindow // ON INIT CreaDocks6()

Return nil

//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//

Function CreaDocks6()

   oDock6  := TDockPnel():New( oWindow )
   WITH OBJECT oDock6

      :SetHeightCaption( 40 )
      :SetBorderSize( 1 )
      :SetCoors( { | o | 5 }, ;
                 { | o | 5 }, ;
                 { | o | o:oWnd:nBottom - o:oWnd:nTop  - 5 }, ; //- 5 * 10 }, ;
                 { | o | o:oWnd:nRight  - o:oWnd:nLeft - 5 } ) //- 3 * 10 } )
      :SetCaption( { | o | "Test TDockPanel Class  - " + FWVERSION + " -" } )
      //:SetPosTitle( .T. )
      :SetStyle( 30 )
      :SetFont( oFontE )
      :SetImgsFiles( { { 57678, { | o | MyPopupMnu( o ) }, } } )
      :SetCtrlsPnel( { | o, nT, nL, nH, nW | CreaControl( o, nT, nL, nH, nW ) } )

      :Activate()
   END

Return nil

//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//

Function MyPopupMnu( o )

   local oMnu
   local nRow  := o:nTop  + Int( o:nHeight / 2 )
   local nCol  := o:nLeft + Int( o:nWidth / 2 )

   MENU oMnu POPUP 2013 ;
      COLORSELECT METRO_STEEL, METRO_STEEL, CLR_WHITE ;
      COLORMENU CLR_WHITE, CLR_BLUE ;
      COLORSEPARATOR METRO_STEEL ;
      COLORLEFT CLR_WHITE ;
      FONT oFontE

      MENUITEM "Show Log"    ACTION MsgLog( o:oWnd:ClassName() )
      SEPARATOR
      MENUITEM "Info" ACTION MsgInfo( o:ClassName() )
      MENUITEM "Exit" ACTION o:oWnd:oWnd:End()

   ENDMENU
   ACTIVATE MENU oMnu AT nRow, nCol OF o:oWnd

Return oMnu

//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//

Function CreaControl( o, nT, nL, nH, nW )

   BuildPanels( o )
   BuildSplitterV( o )
   BuildExplorer( o )

Return nil

//----------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------//

Function BuildSplitterV( oParent )

   @ 1, oPanelExplorer:nWidth + 2 SPLITTER oVSplit ;
        VERTICAL ;
        PREVIOUS CONTROLS oPanelExplorer ;
        HINDS CONTROLS oPanelCalex ;
        LEFT MARGIN 10 ;
        RIGHT MARGIN 80 ;
        SIZE 2, ScreenHeight() - 70 ;
        PIXEL ;
        COLOR CLR_GRAY ;
        OF oParent UPDATE ;
        ON CHANGE Ajusta()

Return nil

//----------------------------------------------------------------------------//

Function Ajusta( n )

   // Adjust widht of FolderEx

Return nil

//----------------------------------------------------------------------------//

Function BuildExplorer()

   local oPanel
   local nOption := 5
   local oExBar
   local oFld
   
   oExBar := TExplorerBar():New( 0, 0, 280, 630, oPanelExplorer )
   
   oPanel := oExBar:AddPanel( Upper( "Jump To Date" ), "..\bitmaps\32x32\calendar.bmp", 200 )
             
   oPanel := oExBar:AddPanel( Upper( "View" ), "c:\fwh\bitmaps\32x32\view.bmp", 130 )
   oPanel:AddLink( "View Daily"  , { || MsgInfo( "DayView" ) }, "..\bitmaps\16x16\inspect.bmp" )
   oPanel:AddLink( "View Weekly" , { || MsgInfo( "WeekView" ) }, "..\bitmaps\16x16\additem.bmp" )
   oPanel:AddLink( "View Monthly", { || MsgInfo( "MonthView" ) }, "..\bitmaps\16x16\calendar.bmp" )

   oPanel := oExBar:AddPanel( Upper( "Actions" ), "..\bitmaps\32x32\index2.bmp", 140 )
   oPanel:AddLink( "New record",  { || msginfo("New")  }, "..\bitmaps\16x16\adddbf.bmp" )
   oPanel:AddLink( "Modify record", { || msginfo("Modify")  }, "..\bitmaps\16x16\edit.bmp" )
   oPanel:AddLink( "Delete record",  { || msginfo("Delete")  }, "..\bitmaps\16x16\deldbf.bmp" )
   oPanel:AddLink( "Informes",  { || MsgInfo( "Imprime" )  }, "..\bitmaps\16x16\print.bmp" )
   oPanel:AddLink( "View Database",  { || MsgInfo( "ViewDatabase" ) }, "..\bitmaps\16x16\prg.bmp" )
   oPanel:AddLink( "Exit",  { || oWindow:End()  }, "..\bitmaps\16x16\exit2.bmp" )

   oPanelExplorer:oClient := oExBar
   //oPanelExplorer:oClient:bMouseWheel := { || MsgInfo( "ok" ) }

   @ 1, 1 FOLDEREX oFld ;
         PROMPTS "Clients", "Reports" OF oPanelCalex ;
         TAB HEIGHT 22 ;
         SIZE  oPanelCalex:nWidth , oPanelCalex:nHeight - 5 ;
         PIXEL FONT oFontE

Return nil

//---------------------------------------------------//

Function BuildPanels( oParent, nT, nL, nH, nW )

   local oBrush
   oPanelExplorer := TPanel():New( 1, 1, oDock6:oWnd:nHeight - 53, 280, oParent )
   oPanelCalex    := TPanel():New( 1, oPanelExplorer:nWidth + 6, oDock6:oWnd:nHeight - 53, ;
                                     oDock6:oWnd:nWidth - 14, oParent )

   DEFINE BRUSH oBrush COLOR CLR_WHITE
   oPanelExplorer:SetBrush( oBrush )
   oPanelCalex:SetBrush( oBrush )
   oBrush:End()

Return nil

//---------------------------------------------------//
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby vilian » Tue Mar 10, 2020 11:03 am

Thank you ;)
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Wed Mar 11, 2020 12:13 am

Vilian, run ok for you this sample?
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Fwh19.05 - New Class TDockPnel

Postby vilian » Wed Mar 11, 2020 1:27 am

Yes, perfectly !
Thank you.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Fwh19.05 - New Class TDockPnel

Postby joseluispalma » Sat Apr 11, 2020 5:32 pm

¿Y cómo podría insertar una página web por favor?
joseluispalma
 
Posts: 109
Joined: Mon Apr 30, 2012 9:10 am

Re: Fwh19.05 - New Class TDockPnel

Postby cnavarro » Sat Apr 11, 2020 9:28 pm

Pues, como he dicho TDockPnel es un control "contenedor" genérico, por lo que puedes incluir en él los controles que desees, en este caso un control activex que abriera la página web. Cualquier ejemplo de los que aparecen en el enlace del primer post de este hilo te sirve.
Y para mostrar la página pues harías la function que crea los activex haciendo referencia como "parent" del activex el control dockpnel donde quieres que sea incrustado. Si tengo un ratillo hago un ejemplo.
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

PreviousNext

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests