I have 2 functions that I used for incremental letter-by-letter search with DBF that I adapted for MariaDB.
In this case, the first first part where I search letter-by-letter is working perfectly, but when I try to go to the next record using the same search string it doesn't work.
Code: Select all
oRs := oServer:RowSet( "SELECT nome,r_social FROM agenda ORDER BY r_social" )
Code: Select all
@ 0069,0000 XBROWSE oBrwAGENDA OF oDlgAGENDA SIZE 0520,0230 STYLE FLAT PIXEL NOBORDER DATASOURCE oRS//AUTOSORT
ADD TO oBrwAGENDA DATA oRs:r_social PICTURE "@!" HEADER "Razão Social" WIDTH 520
ADD TO oBrwAGENDA DATA oRs:nome PICTURE "@!" HEADER "Nome" WIDTH 520
oBrwAGENDA:nColDividerStyle := 0
oBrwAGENDA:nRowDividerStyle := 0
oBrwAGENDA:nMarqueeStyle := 5
oBrwAGENDA:lHScroll := .F.
oBrwAGENDA:lVScroll := .T.
oBrwAGENDA:lRecordSelector := .F.
oBrwAGENDA:bKeyChar := {|nKey|IIF(nKey==VK_RETURN,((OPERACAO_AGENDA(2))),)}
oBrwAGENDA:bClrSelFocus := {||{nRGB(000,000,000),nRGB(150,150,150)}}
oBrwAGENDA:bClrSel := {||{nRGB(000,000,000),nRGB(150,150,150)}}
oBrwAGENDA:bClrStd := {||{CLR_BLUE,IIF(oRS:KeyNo() %2==0,CLR_WHITE,nRGB(232,232,232))}}
oBrwAGENDA:nHeaderHeight := 40
oBrwAGENDA:bClrHeader := {||{nRGB(000,000,000),nRGB(150,150,150)}}
oBrwAGENDA:bSeek := {|c|.F.}
oBrwAGENDA:aCols[1]:oHeaderFont := ARIAL16B
oBrwAGENDA:aCols[1]:bLClickHeader := {|r,c,f,o| nil}
oBrwAGENDA:aCols[2]:oHeaderFont := ARIAL16B
oBrwAGENDA:CreateFromCode()
Code: Select all
@ 0045,0560 GET oGetPESQUISA VAR cPESQUISA PICTURE "@!" SIZE 0455,0020 PIXEL FONT ARIAL14B OF oBarAGENDA ON CHANGE(PESQUISA(oGetPESQUISA,oBrwAGENDA,oRS))
Code: Select all
@ 0045,1018 BTNBMP oBtnPROXIMO RESOURCE "BTN_PROXIMO" OF oBarAGENDA SIZE 0020,0020 PIXEL FLAT NOBORDER ACTION PROXIMO(cPESQUISA,oBrwAGENDA,oRS)
Code: Select all
********************************************************************************
STATIC FUNCTION PESQUISA(_oGetPesquisa,_oBrwPESQUISA,_oRS)
********************************************************************************
LOCAL cCHAVEPESQUISA := ""
cCHAVEPESQUISA:=(_oGetPesquisa:oGet:Buffer)
_oRS:ORDWILDSEEK("*"+ALLTRIM(cCHAVEPESQUISA)+"*",.F.)
_oBrwPESQUISA:REFRESH()
RETURN NIL
Code: Select all
********************************************************************************
STATIC FUNCTION PROXIMO(cPESQUISA,_oBrwPESQUISA,_oRS)
********************************************************************************
_oRS:ORDWILDSEEK("*"+ALLTRIM(cPESQUISA)+"*",.F.)
IF _oRS:EOF()
_oRS:DBGOTOP()
ENDIF
_oBrwPESQUISA:REFRESH()
RETURN NIL