oribeiro Posted May 8, 2014 Report Share Posted May 8, 2014 Pessoal, Como faço para que, quando o usuário clicar na coluna de um browse (criado com xBrowse), ele automaticamente reclassifique a planilha pela coluna? Estou criando assim: ******************************************************************************************** Static function detal_Res(cDbf_p,cPro,wTit) ******************************************************************************************** Select(cDbf_p) DbGoTop() If wTit = "PD" cTit := "RESUMO DOS PEDIDOS PENDENTES DO PRODUTO: "+Alltrim(cPro) Elseif wTit = "CP" cTit := "RESUMO DOS PEDIDOS DE COMPRA PENDENTES DO PRODUTO: "+Alltrim(cPro) Else cTit := "RESUMO DAS ORDENS DE MANUFATURA PENDENTES DO PRODUTO: "+Alltrim(cPro) Endif DEFINE DIALOG oDlg SIZE 800,420 FONT WndMain():oFont TITLE cTit TRANSPARENT @ 10,10 XBROWSE oBrw OF oDlg SIZE 380,180 PIXEL; ALIAS (cDbf_p); AUTOSORT AUTOCOLS FOOTERS LINES CELL oBrw:DT_EMISS:cEditPicture := 'dd/mm/yyyy' oBrw:DT_PREV:cEditPicture := 'dd/mm/yyyy' oBrw:DelCol( 1 ) // Deleta Coluna AEval( oBrw:aCols, { |o| o:cToolTip := { 'Column :' + CRLF + o:cHeader, 'ToolTip' } } ) // ToolTip nas colunas oBrw:bClrStd := {|| {CLR_BLACK, iif(oBrw:Keyno()%2=0, CLR_WHITE, CLR_HGRAY) } } // Cores nas linhas (Par/Impar) ou (oBrw:cAlias)->(RecN())%2=0 oBrw:CreateFromCode() @ 195, 010 BUTTON "&Imprimir" SIZE 50,10 FONT oFontGet PIXEL ACTION IIF( MsgYesNo("Deseja imprimir essa planilha?","Confirme"), Listar(cTit,,,,,,,,,,,,,.F.), ) @ 195, 070 BUTTON "&Excel" SIZE 50,10 FONT oFontGet PIXEL ACTION oBrw:ToExcel() @ 195, 130 BUTTON "&Fechar" SIZE 50,10 FONT oFontGet PIXEL ACTION oDlg:End() ACTIVATE DIALOG oDlg CENTERED; ON INIT oBrw:SetFocus() Return(.T.) Aguardo, obrigado. Quote Link to comment Share on other sites More sharing options...
Theotokos Posted May 8, 2014 Report Share Posted May 8, 2014 este autosort só vi funcionar com array... Quote Link to comment Share on other sites More sharing options...
zekasan Posted May 8, 2014 Report Share Posted May 8, 2014 Ao clicar na coluna faça mudar o indexado do arquivo e de um refresh no browse. Quote Link to comment Share on other sites More sharing options...
Edu Posted May 8, 2014 Report Share Posted May 8, 2014 Ao clicar no header de cada coluna, organiza de acordo com o índice. Exemplo: oBrw:aCols[1]:bLClickHeader := {|| cDbf->(DBSETORDER(1)), oBrw:GoTop(), oBrw:Refresh()} oBrw:aCols[2]:bLClickHeader := {|| cDbf->(DBSETORDER(2)), oBrw:GoTop(), oBrw:Refresh()} Quote Link to comment Share on other sites More sharing options...
oribeiro Posted May 8, 2014 Author Report Share Posted May 8, 2014 Muito bom, obrigado. Quote Link to comment Share on other sites More sharing options...
oribeiro Posted May 9, 2014 Author Report Share Posted May 9, 2014 Se os Headers dos campos são exatamente igual aos nomes dos campos dos arquivos ele faz automaticamente para todos os campos que estão indexados. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.