FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Problema con xbrowse en um dialog
Posts: 44
Joined: Tue Nov 21, 2006 04:07 PM
Problema con xbrowse en um dialog
Posted: Fri Mar 27, 2015 08:16 PM
Holas!

Tengo un problema cuando se muestra una matriz de datos con xbrowse / dialog.

La primera opción de ComboBox todo funciona perfectamente.

A partir de la segunda, después de mostrar la nueva matriz de datos, haciendo clic en la línea del registro, la xbrowse muestra la lista anterior.

Code (fw): Select all Collapse
//
Function Ver_Est()

   Private oDlg, oEst, oCon, oSai, oGra, oTip_Est, cTip_Est, aTip_Est, aEst, aLst
    
    aEst     := {}
    aLst     := {}
    cTip_Est := "Data"
    aTip_Est := { "Data", "Hora", "Endereço IP", "Endereço Internet" }

    If ! Abrir_DBF(cUniSer + cDirBas + "\TB_EST.DBF","TB_EST",.t.,"DBFCDX")
        Return(.f.)
    EndIf
    TB_EST->(DBSetOrder(1))

   Define Dialog oDlg Of oWnd Title "Estatística" Font oFonte From 0,0 To 434,700 Pixel

    @ 005,005 Say "Tipo:" Of oDlg Pixel
    @ 005,025 ComboBox oTip_Est Var cTip_Est Items aTip_Est Size 64,100 Of oDlg Pixel ;
             Message "Informe o tipo da estatísitica"

   @ 020,005 Say Space(1) Of oDlg Box Size 340,05 Pixel

    @ 002,250 BTNBMP oCon Size 16,16 Of oDlg Font oFonte 2007 Pixel ToolTip "Atualizar dados" ;
                 Action (Atu_Est(cTip_Est)) File (cUniSer + cDirImg + "\prop.bmp")

    @ 002,290 BTNBMP oGra Size 16,16 Of oDlg Font oFonte 2007 Pixel ToolTip "Mostrar gráfico" ;
                 Action (MsgInfo("Exibir gráfico","Em breve...")) File (cUniSer + cDirImg + "\graph.bmp")

    @ 002,330 BTNBMP oSai Size 16,16 Of oDlg Font oFonte 2007 Pixel ToolTip "Retornar" ;
                 Action (oDlg:End()) File (cUniSer + cDirImg + "\quit.bmp") Default Cancel

    oDlg:lHelpIcon := .f.

    Activate Dialog oDlg Centered On Init (oTip_Est:SetFocus())

    TB_EST->(DBCloseArea())

Return(Nil)
//
Function Atu_Est(cTip)

    Local cRef, cEst, i := 0

    If Empty(cTip)
        MsgAlert("Deve ser informado um tipo de estatística","Aviso")
        Return(Nil)
    EndIf

    aLst := {}
    cRef := Str(aScan(aTip_Est,AllTrim(cTip)),1)

    TB_EST->(DBSeek(cRef,.f.))

    While ! TB_EST->(EOF()) .And. TB_EST->Tip_Est = cRef
        aEst := {}
        cEst := TB_EST->Ref_Est
        While ! TB_EST->(EOF()) .And. TB_EST->Tip_Est = cRef .And. TB_EST->Ref_Est = cEst
            AAdd( aEst, { TB_EST->Ref_Est, TB_EST->Des_Est, TB_EST->Tot_Est } )
            TB_EST->(DBSkip())
      EndDo
        ASort( aEst ,,, {|x,y| x[3] > y[3] } )
      For i := 1 To Len( aEst )
            If cRef = "4"
            If i < 21
                    AAdd( aLst, { aEst[i,1], aEst[i,2], aEst[i,3] } )
                Else
                    Exit
                EndIf
            Else
            If i < 6
                    AAdd( aLst, { aEst[i,1], aEst[i,2], aEst[i,3] } )
                Else
                    Exit
                EndIf
            EndIf 
      Next
    EndDo

    @ 055,000 xBrowse oEst Of oDlg Columns 1,2,3 ;
                 ColSizes 80,510,60 Pictures "@!","@A","999,999,999" Array aLst Pixel Size 700,382 Font oFonte

    oEst:nMarqueeStyle = MARQSTYLE_HIGHLROW
    
    oEst:nRowDividerStyle := 3
    oEst:nColDividerStyle := 2

    oEst:aCols[1]:nDataStrAlign := 2

    oEst:aCols[1]:nHeadStrAlign := 2
    oEst:aCols[2]:nHeadStrAlign := 0

    If cRef = "1"
        oEst:aCols[1]:cHeader = "Data"
        oEst:aCols[1]:Show()
    ElseIf cRef = "2"
        oEst:aCols[1]:cHeader = "Hora"
        oEst:aCols[1]:Show()
    ElseIf cRef = "3"
        oEst:aCols[1]:cHeader = "IP"
        oEst:aCols[1]:Show()
    ElseIf cRef = "4"
        oEst:aCols[1]:cHeader = "Referência"
        oEst:aCols[1]:Hide()
    EndIf

    oEst:CreateFromCode()

    oEst:Refresh()
    oEst:SetFocus()
    
Return(Nil)
//


¿Alguien puede ayudarme?

Gracias!

Rodrigo Melo
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Problema con xbrowse en um dialog
Posted: Fri Mar 27, 2015 08:22 PM
ip_ram wrote:Holas!

Tengo un problema cuando se muestra una matriz de datos con xbrowse / dialog.

La primera opción de ComboBox todo funciona perfectamente.

A partir de la segunda, después de mostrar la nueva matriz de datos, haciendo clic en la línea del registro, la xbrowse muestra la lista anterior.

Code (fw): Select all Collapse
//
Function Ver_Est()

   Private oDlg, oEst, oCon, oSai, oGra, oTip_Est, cTip_Est, aTip_Est, aEst, aLst
    
    aEst     := {}
    aLst     := {}
    cTip_Est := "Data"
    aTip_Est := { "Data", "Hora", "Endereço IP", "Endereço Internet" }

    If ! Abrir_DBF(cUniSer + cDirBas + "\TB_EST.DBF","TB_EST",.t.,"DBFCDX")
        Return(.f.)
    EndIf
    TB_EST->(DBSetOrder(1))

   Define Dialog oDlg Of oWnd Title "Estatística" Font oFonte From 0,0 To 434,700 Pixel

    @ 005,005 Say "Tipo:" Of oDlg Pixel
    @ 005,025 ComboBox oTip_Est Var cTip_Est Items aTip_Est Size 64,100 Of oDlg Pixel ;
             Message "Informe o tipo da estatísitica"

   @ 020,005 Say Space(1) Of oDlg Box Size 340,05 Pixel

    @ 002,250 BTNBMP oCon Size 16,16 Of oDlg Font oFonte 2007 Pixel ToolTip "Atualizar dados" ;
                 Action (Atu_Est(cTip_Est)) File (cUniSer + cDirImg + "\prop.bmp")

    @ 002,290 BTNBMP oGra Size 16,16 Of oDlg Font oFonte 2007 Pixel ToolTip "Mostrar gráfico" ;
                 Action (MsgInfo("Exibir gráfico","Em breve...")) File (cUniSer + cDirImg + "\graph.bmp")

    @ 002,330 BTNBMP oSai Size 16,16 Of oDlg Font oFonte 2007 Pixel ToolTip "Retornar" ;
                 Action (oDlg:End()) File (cUniSer + cDirImg + "\quit.bmp") Default Cancel

    oDlg:lHelpIcon := .f.

    Activate Dialog oDlg Centered On Init (oTip_Est:SetFocus())

    TB_EST->(DBCloseArea())

Return(Nil)
//
Function Atu_Est(cTip)

    Local cRef, cEst, i := 0

    If Empty(cTip)
        MsgAlert("Deve ser informado um tipo de estatística","Aviso")
        Return(Nil)
    EndIf

    aLst := {}
    cRef := Str(aScan(aTip_Est,AllTrim(cTip)),1)

    TB_EST->(DBSeek(cRef,.f.))

    While ! TB_EST->(EOF()) .And. TB_EST->Tip_Est = cRef
        aEst := {}
        cEst := TB_EST->Ref_Est
        While ! TB_EST->(EOF()) .And. TB_EST->Tip_Est = cRef .And. TB_EST->Ref_Est = cEst
            AAdd( aEst, { TB_EST->Ref_Est, TB_EST->Des_Est, TB_EST->Tot_Est } )
            TB_EST->(DBSkip())
      EndDo
        ASort( aEst ,,, {|x,y| x[3] > y[3] } )
      For i := 1 To Len( aEst )
            If cRef = "4"
            If i < 21
                    AAdd( aLst, { aEst[i,1], aEst[i,2], aEst[i,3] } )
                Else
                    Exit
                EndIf
            Else
            If i < 6
                    AAdd( aLst, { aEst[i,1], aEst[i,2], aEst[i,3] } )
                Else
                    Exit
                EndIf
            EndIf 
      Next
    EndDo

    @ 055,000 xBrowse oEst Of oDlg Columns 1,2,3 ;
                 ColSizes 80,510,60 Pictures "@!","@A","999,999,999" Array aLst Pixel Size 700,382 Font oFonte

    oEst:nMarqueeStyle = MARQSTYLE_HIGHLROW
    
    oEst:nRowDividerStyle := 3
    oEst:nColDividerStyle := 2

    oEst:aCols[1]:nDataStrAlign := 2

    oEst:aCols[1]:nHeadStrAlign := 2
    oEst:aCols[2]:nHeadStrAlign := 0

    If cRef = "1"
        oEst:aCols[1]:cHeader = "Data"
        oEst:aCols[1]:Show()
    ElseIf cRef = "2"
        oEst:aCols[1]:cHeader = "Hora"
        oEst:aCols[1]:Show()
    ElseIf cRef = "3"
        oEst:aCols[1]:cHeader = "IP"
        oEst:aCols[1]:Show()
    ElseIf cRef = "4"
        oEst:aCols[1]:cHeader = "Referência"
        oEst:aCols[1]:Hide()
    EndIf

    oEst:CreateFromCode()

    oEst:Refresh()
    oEst:SetFocus()
    
Return(Nil)
//


¿Alguien puede ayudarme?

Gracias!

Rodrigo Melo


Prueba asi

Code (fw): Select all Collapse
Function Atu_Est(cTip)

    Local cRef, cEst, i := 0

    If Empty(cTip)
        MsgAlert("Deve ser informado um tipo de estatística","Aviso")
        Return(Nil)
    EndIf

    aLst := {}
    cRef := Str(aScan(aTip_Est,AllTrim(cTip)),1)

    TB_EST->(DBSeek(cRef,.f.))

    While ! TB_EST->(EOF()) .And. TB_EST->Tip_Est = cRef
        aEst := {}
        cEst := TB_EST->Ref_Est
        While ! TB_EST->(EOF()) .And. TB_EST->Tip_Est = cRef .And. TB_EST->Ref_Est = cEst
            AAdd( aEst, { TB_EST->Ref_Est, TB_EST->Des_Est, TB_EST->Tot_Est } )
            TB_EST->(DBSkip())
      EndDo
        ASort( aEst ,,, {|x,y| x[3] > y[3] } )
      For i := 1 To Len( aEst )
            If cRef = "4"
            If i < 21
                    AAdd( aLst, { aEst[i,1], aEst[i,2], aEst[i,3] } )
                Else
                    Exit
                EndIf
            Else
            If i < 6
                    AAdd( aLst, { aEst[i,1], aEst[i,2], aEst[i,3] } )
                Else
                    Exit
                EndIf
            EndIf 
      Next
    EndDo

   if Empty( oEst )    // Aqui

    @ 055,000 xBrowse oEst Of oDlg Columns 1,2,3 ;
                 ColSizes 80,510,60 Pictures "@!","@A","999,999,999" Array aLst Pixel Size 700,382 Font oFonte

    oEst:nMarqueeStyle = MARQSTYLE_HIGHLROW
    
    oEst:nRowDividerStyle := 3
    oEst:nColDividerStyle := 2

    oEst:aCols[1]:nDataStrAlign := 2

    oEst:aCols[1]:nHeadStrAlign := 2
    oEst:aCols[2]:nHeadStrAlign := 0

    If cRef = "1"
        oEst:aCols[1]:cHeader = "Data"
        oEst:aCols[1]:Show()
    ElseIf cRef = "2"
        oEst:aCols[1]:cHeader = "Hora"
        oEst:aCols[1]:Show()
    ElseIf cRef = "3"
        oEst:aCols[1]:cHeader = "IP"
        oEst:aCols[1]:Show()
    ElseIf cRef = "4"
        oEst:aCols[1]:cHeader = "Referência"
        oEst:aCols[1]:Hide()
    EndIf

    oEst:CreateFromCode()
   else
      oEst:SetArray( aLst )
   endif
    oEst:Refresh()
    oEst:SetFocus()
    
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
Posts: 44
Joined: Tue Nov 21, 2006 04:07 PM
Re: Problema con xbrowse en um dialog
Posted: Fri Mar 27, 2015 08:31 PM

Cristobal,

Muchas gracias.

Continue the discussion