Function Lbx2Brw()
local Empw, cAlias, Emp, oWndEmp
if !File(".\Emp.dbf")
dbCreate(".\Emp",{ { "Cerrada", "L", 1,0 } ,;
{ "Activo" , "L", 1,0 } ,;
{ "Codigo" , "C", 2,0 } ,;
{ "nombre" , "C", 35,0 } ,;
{ "Ano" , "N", 4,0 } } )
DBUsearea(.t.,,"Emp","Emp",.t.)
dbappend()
field->cerrada := .f. ; field->activo := .t. ; field->codigo := "01"
field->nombre := "EMPRESA NUMERO UNO" ; field->ano := 2019
dbappend()
field->cerrada := .f. ; field->activo := .t. ; field->codigo := "02"
field->nombre := "EMPRESA NUMERO DOS" ; field->ano := 2019
dbappend()
field->cerrada := .T. ; field->activo := .F. ; field->codigo := "03"
field->nombre := "EMPRESA NUMERO TRES" ; field->ano := 2018
Emp->(dbcloseArea())
endif
DBUsearea(.t.,,"Emp","Emp",.t.)
cAlias:=Alias()
DEFINE DIALOG oWndEmp SIZE 600,400 PIXEL TITLE "FiveWin Version 1204"
@ 2, 0 XBROWSE Empw OF oWndEmp PIXEL ;
SIZE 280,140 ;
DATASOURCE cAlias ;
COLUMNS "Cerrada", "Activo", "Codigo", "Nombre", "Ano" ;
HEADERS "E", "A", "CODIGO", "NOMBRE", "AÑO TRABAJO" ;
FOOTERS CELL LINES ;
ON DBLCLICK EditEmpres( Empw, .F. ) ;
WHEN ( IF( Select( cAlias ) > 0, Emp->( LastRec() ) > 0, .F. ) ) ;
VALID ( SaveIniCol( Empw, cAlias ), .T. ) ;
UPDATE
WITH OBJECT Empw
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:aCols[ 1 ]:addResource("aceptar")
:aCols[ 1 ]:addResource("cancelar")
:aCols[ 1 ]:bBmpData := {|| IF( Emp->Cerrada, 2,1 ) }
:aCols[ 2 ]:addResource("checked")
:aCols[ 2 ]:addResource("unchecked")
:aCols[ 2 ]:bBmpData := {|| IF( Emp->Activo , 1,2 ) }
END
Empw:CreateFromCode()
ACTIVATE DIALOG oWndEmp CENTERED ON INIT Empw:Move(40,20)
(cAlias)->(DbCloseArea())
Ferase(".\Emp.dbf")
RETURN NIL
Function EditEmpres( oBrw, lLogico )
Return MsgInfo("EditEmpres()"+CRLF+;
oBrw:codigo:Value +" "+ oBrw:nombre:value )
Function SaveIniCol( oBrw, cAlias )
Return .t.