Jump to content
Fivewin Brasil

Pesquisa incremental no xBrowse com array


Edu

Recommended Posts

  • 2 years later...

Boa tarde amigo!

Fiz assim:

 

// GET de pesquisa

    REDEFINE GET opesquisa VAR var_pesquisa ID 40 OF oDlg UPDATE ;
                                                         ON CHANGE( ::Assign(), SetPosXbr(var_pesquisa,2,oLbx1) )

********************************************************************************
FUNCTION SetPosXbr(Digitado, xPos, oLbx1)
    * Funcao de pesquisa sensitiva no xBrowse com Array
    LOCAL nPalavra:= UPPER(ALLTRIM(Digitado))
    
    nPos := ASCAN(aPrinProd ,{|X| IF(nPalavra $ Substr(X[xPos], 1, LEN(nPalavra)) , .T. , .F. )})           
     
    IF nPos > 0 
       oLbx1:nArrayAt:= nPos
    ENDIF

    oLbx1:UPDATE()
   oLbx1:REFRESH()

RETURN .T.
 

Link to comment
Share on other sites

  • 4 months later...

Melhorias da função:

 

FUNCTION SetPosXbr(Digitado, xPos, oLbx1)

    * Funcao de pesquisa sensitiva no xBrowse com Array
    LOCAL nPalavra:= UPPER(ALLTRIM(Digitado))    

    if Empty(wDigitado)
       oBrw:Gotop()
        Return .T.
    endif
    
    if LastKey() == 127 // se foi pressionado backspace
       oBrw:Skip(-1)
        Return .T.
    endif


    nPos := ASCAN(aPrinProd ,{|X| IF(nPalavra $ Substr(X[xPos], 1, LEN(nPalavra)) , .T. , .F. )})           
     
    IF nPos > 0 
       oLbx1:nArrayAt:= nPos
    ENDIF

   oLbx1:Refresh()

   oLbx1:Update()

RETURN .T.

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...