Hi,
How to pvovide incremental search in TwBrowse. Someone must have done it. I tried to achieve same using DBCOMBO box. But it seems to be not working properly.
Any sample / guidance will be highly appreciated.
Milan.
Incremental Search in TwBrowse (Standard)
-
- Posts: 115
- Joined: Mon Oct 17, 2005 4:42 am
- Location: India
-
- Posts: 115
- Joined: Mon Oct 17, 2005 4:42 am
- Location: India
Hello all,
With kind help of James Bott I could adapt one of his function to achive the same. Here it is if it helps anybody. One will need to change the name of database and actiive tag.
I have one question also. Pressing space bar will clear the search. But I am not able to achieve the same with other key like Del or so. Can anybody shed light on it.
Thanks James. My private mail to you bounces back. So I do it here.
Wiith best regards,
Milan.
----------------------Cut-------------------------
FUNCTION SetTwBrowIncr(oBrw)
oBrw:bKeyChar := {|nKey,nFlags| FindTwIncr(oBrw,nKey)}
oBrw:bGotFocus := {|| oBrw:Cargo := "",oBrw:SetFocus()}
RETURN NIL
FUNCTION FindTwIncr(oBrw,nKey)
LOCAL nNewEle := 0
LOCAL nOrder := 0
IF nKey <> 32
oBrw:Cargo += upper( CHR(nKey) )
Select Diary
nOrder := IndexOrd()
Set ORDER TO TAG Name
DBSeek (oBrw:Cargo, .T.)
Set ORDER TO nOrder
oBrw:nLen := OrdKeyCount()
oBrw:VSetPos( OrdKeyNo() )
oBrw:Refresh()
ELSE
oBrw:Cargo := ""
oBrw:GoTop()
ENDIF
RETURN oBrw:nAT
----------------------Paste-----------------------
With kind help of James Bott I could adapt one of his function to achive the same. Here it is if it helps anybody. One will need to change the name of database and actiive tag.
I have one question also. Pressing space bar will clear the search. But I am not able to achieve the same with other key like Del or so. Can anybody shed light on it.
Thanks James. My private mail to you bounces back. So I do it here.
Wiith best regards,
Milan.
----------------------Cut-------------------------
FUNCTION SetTwBrowIncr(oBrw)
oBrw:bKeyChar := {|nKey,nFlags| FindTwIncr(oBrw,nKey)}
oBrw:bGotFocus := {|| oBrw:Cargo := "",oBrw:SetFocus()}
RETURN NIL
FUNCTION FindTwIncr(oBrw,nKey)
LOCAL nNewEle := 0
LOCAL nOrder := 0
IF nKey <> 32
oBrw:Cargo += upper( CHR(nKey) )
Select Diary
nOrder := IndexOrd()
Set ORDER TO TAG Name
DBSeek (oBrw:Cargo, .T.)
Set ORDER TO nOrder
oBrw:nLen := OrdKeyCount()
oBrw:VSetPos( OrdKeyNo() )
oBrw:Refresh()
ELSE
oBrw:Cargo := ""
oBrw:GoTop()
ENDIF
RETURN oBrw:nAT
----------------------Paste-----------------------
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Just change this line:I have one question also. Pressing space bar will clear the search. But I am not able to achieve the same with other key like Del or so. Can anybody shed light on it.
IF nKey <> 32
To:
IF nKey != 32 .and. nKey != VK_DELETE
And add this include:
#include "vkey.ch"
Regards,
James
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: