my email: nageswaragunupudi [at] gmail [dot] com
Some suggestions on creation of XBrowse:
Creating columns using :AddCol(), :bStrData(), etc is obsolete and deprecated many years back. This way you will not be able to avail the full power and xbrowse. We recommend creating by command syntax using COLUMNS clause.
I give you two alternatives:
Alternative-1
@ 80,260 XBROWSE oBrowse SIZE -20,-50 PIXEL OF oDialog:oDlg ;
DATASOURCE oOcorrencia ;
COLUMNS "situacao","dia_ocorrencia","matricula","nome_aluno","descricao" ;
HEADERS "Situação", "Dia", "Matricula", "Nome", "OcorrĂȘncia" ;
PICTURES nil, nil, "@R 999999-9" ;
COLSIZES 30, 80, 80, 300, 300 ;
ALIGN AL_CENTER, AL_CENTER, AL_CENTER ;
LINES NOBORDER FOOTERS ;
FONT oSistema():oFonte3 ;
UPDATE
Alternative-2
aCols := {
{ "situacao", "Situação", nil, 30, AL_CENTER }, ;
{ "dia_ocorrencia","Dia", nil, 80, AL_CENTER }, ;
{ "Matricula", nil, "@R 999999-9", 80, AL_CENTER }, ;
{ "nome_aluno", "Nome", nil, 300 }, ;
{ "descricao", "OcorrĂȘncia", nil, 300 } }
@ 80,260 XBROWSE oBrowse SIZE -20,-50 PIXEL OF oDialog:oDlg ;
DATASOURCE oOcorrencia ;
COLUMNS aCols ;
LINES NOBORDER FOOTERS ;
FONT oSistema():oFonte3 ;
UPDATE
Both the above alternatives are functionally equivalent. You may use either one of them depending on your choice and what do you think is clearer to you and easier to understand and maintain.
After defining the main part of the browse using any of the two methods above, proceed with the next part:
WITH OBJECT oBrowse
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:bEdit := { | oRec | Editar_Ocorrencia( oRec ) }
:bLDblClick := { || oBrowse:EditSource() }
:lIncrFilter := .T.
:lSeekWild := .T.
:cFilterFld := "nome_aluno"
:nHeadStrAligns := AL_CENTER // all headers
:oHeaderFonts := oSistema():oFonte4
WITH OBJECT :aCols[ 1 ]
:SetCheck( { "INATIVO", "ATIVO" }, .t. )
:oHeaderFont := oSistema():oFonte8
END
:aCols[ 1 ]:cFooter := "Registros:"
WITH OBJECT :aCols[ 3 ]
:bFooter := { || oBrowse:nLen }
:cFooterPicture := "@E 999,999,999"
END
:CreateFromCode()
END
Done.
"LINES" clause is equivalent to these lines:
:nColDividerStyle := LINESTYLE_BLACK
:nRowDividerStyle := LINESTYLE_BLACK
:lColDividerComplete := .T.
This part of the code may not be necessary, because xbrowse automatically does the same thing.
:bKeyDown := { || If( Empty( oBrowse:cSeek ), ;
( oOcorrencia:ReQuery( { oSistema():cEscola_Usuario, ;
dData_Inicio, dData_Final } ), ;
oBrowse:Refresh(), ;
oBrowse:SetFocus() ), ) }
Please feel free to ask for any clarifications.