Seek/Search xBrowse Tree

Seek/Search xBrowse Tree

Postby fraxzi » Thu Feb 17, 2011 2:38 am

Dear All,

How to Seek/Search an Item in xBrowse Tree?


Kind regards,

Frances
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: Seek/Search xBrowse Tree

Postby fraxzi » Thu Feb 17, 2011 9:08 am

Dear All,

Not possible? any alternative way?


Kind Regards,

Frances
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: Seek/Search xBrowse Tree

Postby nageswaragunupudi » Thu Feb 17, 2011 12:48 pm

You need to make your own seek function and set that function to bSeek. In case of trees most likely all the items are not in a sorted order.

I suggest this approach:
Code: Select all  Expand view
oBrw:bSeek := { |c| SeekTree( oBrw, c ) }

//.....
//.....

function SeekTree( oBrw, cSeek )

   local oTree    := oBrw:oTree
   local oFound, oItem := oTree:oFirst
   local lFound   := .f.
   
   cSeek    := Upper( cSeek )

   do while oItem != nil
      if oItem:cPrompt = cSeek
         oFound   := oItem
         exit
      endif
      oItem    := oItem:GetNext()
   enddo
   if oFound != nil
      oBrw:oTreeItem := oFound
      lFound   := .t.
   endif

return lFound


 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Seek/Search xBrowse Tree

Postby fraxzi » Fri Feb 18, 2011 6:10 am

Dear Mr. RAO,

Thanks for the Input... I did this to make incremental search.. works for me.

Code: Select all  Expand view


oBrw:bSeek := { |c| uSeekTree( oBrw, Upper(c) ) }

...


STATIC FUNCTION uSeekTree( oBrw, cSeek )

 LOCAL oTree  := oBrw:oTree
 LOCAL oFound, oItem := oTree:oFirst
 LOCAL lFound := .F.

 oBrw:cSeek := cSeek

 DO WHILE oItem <> NIL

    IF oBrw:cSeek $ Upper(SubStr(oItem:cPrompt,1,Len(oBrw:cSeek)))
       oFound := oItem
       EXIT
    ENDIF

    oItem := oItem:GetNext()

 ENDDO

 IF oFound <> nil
    oBrw:oTreeItem := oFound
    oBrw:Refresh()
    lFound := .t.
 ENDIF

RETURN lFound
 



Kind Regards,

Frances
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 84 guests