He realizado cambios en la función DolphinSeek del método SetDolphin porque no funcionaba correctamente.
Aquí los cambios
- Code: Select all Expand view
static FUNCTION DolphinSeek( c, oBrw, cQryWhere )
local oQry := oBrw:oMySql
local nStart
local uData, nNum, lRet
local cSortOrder
static aLastRec := {}
if oBrw:lIncrFilter
// DEFAULT oBrw:cFilterFld := TOken( oQry:cOrder, , 1 )
oBrw:cFilterFld := TOken( oQry:cOrder, , 1 ) //Le quite el DEFAULT porque no cambiaba orden al dar cllick en otra columna
if Empty( oBrw:cFilterFld )
return .f.
endif
// if Empty( c )
If Len(c)=1 //Al usar BACK SPACE no colocaba el puntero en el primer registro
c := cQryWhere
else
c := If( Empty( cQryWhere ), "", "(" + cQryWhere + ") and " ) + ;
Lower( oBrw:cFilterFld ) + " like '" + ;
If( oBrw:lSeekWild, "%", "" ) + ;
c + "%'"
endif
oQry:SetWhere( c, .t. )
oQry:GoTop()
return ( oQry:LastRec() > 0 )
endif
if Empty( c )
return .t.
endif
nNum = AScan( oBrw:aCols, {| o | !Empty( o:cOrder ) } )
if nNum < 1
RETURN .f.
endif
cSortOrder = oBrw:aCols[ nNum ]:cSortOrder
if Len( c ) == 1
aLastRec := {}
endif
IF Len( aLastRec ) < Len( c )
IF Len( aLastRec ) == 0
nStart = 1
ELSE
nStart = oQry:RecNo()
ENDIF
AAdd( aLastRec, nStart )
ELSE
// ADel( aLastRec, Len( aLastRec ) )
// ASize( aLastRec, Len( aLastRec ) - 1 )
ASize( aLastRec, Len( c ) - 1 )
IF Len( aLastRec ) == 0
nStart = 1
ELSE
nStart = ATail( aLastRec )
ENDIF
ENDIF
// lRet := ( oQry:Seek( c, cSortOrder, nStart - 1, oQry:LastRec(), .T., .T. ) != 0 )
lRet := ( oQry:Seek( c, cSortOrder, nStart, oQry:LastRec(), .T., .T. ) != 0 ) //con el -1 al pulsar un caracter no nro. en orden numérico, se cuelga.
return lRet
Tengo FWH1501 no se si ya lo han corregido.
- Code: Select all Expand view
@0,0 xBrowse oBrw Of oDlg AUTOSORT DATASOURCE oQry COLUMNS "IDEMPL" //Si no coloco COLUMNS me carga todos los campos
//oBrw:setdolphin(oQry,.F.) de esta manera no funciona la búsqueda
oBrw....
oBrw:lIncrFilter:= .t.
oBrw:lSeekWild:= .t.
oCol:=oBrw:AddCol()
oCol:bEditValue := { || oEMPL:CODIGO }
oCol:nHeadStrAlign := AL_CENTER
oCol:cHeader:= "COD."
oCol:nWidth:=30
oCol:cSortOrder := "CODIGO"
oCol:bLClickHeader:= {|| oBrw:GoTop() }
oCol:=oBrw:AddCol()
oCol:bEditValue := { || oEMPL:NOMBRE }
oCol:nHeadStrAlign := AL_CENTER
oCol:cHeader := "NOMBRE Y APELLIDOS"
oCol:nWidth:=223
oCol:cSortOrder := "NOMBRE"
oCol:bLClickHeader:= {|| oBrw:GoTop() }
oBrw:aCols[1]:Hide() //Obligado a ocultarlo
REDEFINE SAY oBrw:oSeek PROMPT oBrw:cSeek ID 114 OF oDlg UPDATE PICTURE "@!"
Existe otra manera de evitar el COLUMNS ó oBrw:setdolphin(oQry,.T.,.T.,{"IDEMPL"})
Saludos,
Adhemar