Jump to content
Fivewin Brasil

Problema com xBrowse em Dialog (resolvido)


ram_bh

Recommended Posts

Olás!

Estou com um problema ao exibir uma matriz de dados com xbrowse numa dialog.

Na primeira escolha do combobox tudo funciona perfeitamente.

A partir da segunda escolha, após exibir a nova matriz de dados, ao clicar sobre a linha do registro, o xbrowse exibe a lista anterior.

//
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)
//

Alguém pode ajudar?

Obrigado!



Rodrigo Melo

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...