Function GrupoListarPessoa()
Local oDlg, oBrw, oSay, oPar, oCon, oRet, lRet := .f.
If ! Conectar(.f.)
Return(Nil)
EndIf
oPar := oDba:RowSet("select id,nom_pes from tb_pes order by nom_pes",,.t.)
If oPar == Nil
Return(lRet)
EndIf
Define Dialog oDlg Title "Selecionar Participantes" Size 516,358 Of oWnd Pixel
@ 28,2 xBrowse oBrw Of oDlg DataSource oPar ;
Columns 'id','nom_pes' ;
Headers 'ID','Pessoa' ;
Pictures "999","@A" ;
ColSizes 60,400 ;
Font oFnt2 Size 255,150 Pixel UpDate Cell AutoSort
oBrw:nMarqueeStyle := 5
oBrw:nDataType := 64
oBrw:nRowDividerStyle := 3
oBrw:nColDividerStyle := 2
With Object oBrw:InsCol(1)
:bEditValue := { || AScan( oBrw:aSelected, oBrw:BookMark ) > 0 }
:SetCheck()
:nHeadBmpNo := { || If( Len( oBrw:aSelected ) == oBrw:nLen, 1, 2 ) }
End
oBrw:bLClicked := { |r,c,f,oBrw| If( oBrw:MouseColPos( c ) == 1 , ;
If( ( f := AScan( oBrw:aSelected, oBrw:BookMark ) ) == 0, ;
AAdd( oBrw:aSelected, oBrw:BookMark ), ;
ADel( oBrw:aSelected, f, .t. ) ), Nil ), ;
oBrw:RefreshCurrent() }
oBrw:aCols[1]:nHeadStrAlign := 2
oBrw:aCols[2]:nHeadStrAlign := 2
oBrw:aCols[3]:nHeadStrAlign := 0
oBrw:aJustify := {2,1,0}
oBrw:bOnRefresh := { || oSay:Refresh() }
@ 8,05 Say 'Selecionados:' Of oDlg Pixel Font oFnt2
@ 8,48 Say oSay Prompt Len(oBrw:aSelected) Size 12,12 Of oDlg Pixel Font oFnt2 Picture '99'
@ 6,190 BTNBMP oCon Resource 'sel26' Of oDlg Size 32,16 Pixel 2007 ;
Action(lRet:=.t.,aPes:=GrupoRecuperarPessoa(oBrw,oPar),oDlg:End()) ToolTip "Confirmar os selecionados"
@ 6,226 BTNBMP oRet Resource 'sair16' Of oDlg Size 32,16 Pixel 2007 ;
Action(lRet:=.f.,aPes:={},oDlg:End()) ToolTip "Retornar"
oBrw:SetMySQL(oPar)
oBrw:CreateFromCode()
oDlg:oClient := oBrw
oDlg:lHelpIcon := .f.
Activate Dialog oDlg Centered On Init oBrw:SetFocus()
Return(lRet)
Function GrupoRecuperarPessoa(oBrw,oPar)
Local aVet := {}, nCtr := 0
If Len(oBrw:aSelected) > 0
For nCtr := 1 To Len(oBrw:aSelected)
oPar:GoTo(oBrw:aSelected[nCtr])
AAdd(aVet,oPar:Id)
Next
EndIf
Return(aVet)