Incremental Search in BROWSE
Moderator: Rathinagiri
- Clip2Mania
- Posts: 99
- Joined: Fri Jun 13, 2014 7:16 am
- Location: Belgium
Re: Incremental Search in BROWSE
Oh, sorry I forgot. The latest version (3.3.0 32bit, patch3, ANSI)
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: Incremental Search in BROWSE
Gracias a todos por compartir! Mol, Sr. Esguici
Saludos
Saludos
- Clip2Mania
- Posts: 99
- Joined: Fri Jun 13, 2014 7:16 am
- Location: Belgium
Re: Incremental Search in BROWSE
Had the weekend to find a way around it.
Made the Search-string public (although I don't like making a lot of variables public).
For the ones interested (Javier?), this is the code:
Thanks to all who contributed!
Made the Search-string public (although I don't like making a lot of variables public).
For the ones interested (Javier?), this is the code:
Code: Select all
#include <hmg.ch>
function main()
local aHeaders:={"Nummer","Trk","Artiest","Titel"}
local aWidths:={65,35,248,249}
local acFields:={"MUSIC->NR","MUSIC->DTR","MUSIC->ARTIEST","MUSIC->TITEL"}
local cSMsg:="Type to Search - Click on title to Change Sort Order - F2 to clear search"
public cStr:="", cVal
REQUEST DBFNSX
SET BROWSESYNC ON
SET DATE FRENCH
dbUseArea(.T.,"DBFNSX","MUSIC",.F.)
OrdSetFocus(5)
dbGoTop()
DEFINE WINDOW MainForm;
AT 90,90;
WIDTH 645;
HEIGHT 403;
TITLE "MiniBrowser";
ON RELEASE Closedb();
MAIN
ON KEY F2 ACTION ResetSearch()
DEFINE STATUSBAR
STATUSITEM cSMsg
CLOCK
DATE
STATUSITEM " " WIDTH 15 //In Windows 7, year is hidden by corner
END STATUSBAR
END WINDOW
@ 5,5 BROWSE br_Main;
OF MainForm;
WIDTH 620;
HEIGHT 332;
HEADERS aHeaders;
WIDTHS aWidths;
WORKAREA MUSIC;
FIELDS acFields;
ON HEADCLICK { {||Resort(5)} , {||MsgInfo('No Sort Key')} , {||Resort(1)},{||Resort(2)}};
JUSTIFY { BROWSE_JTFY_LEFT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_LEFT,BROWSE_JTFY_LEFT}
CREATE EVENT PROCNAME QuickSearch() HWND MainForm.br_Main.HANDLE MSG WM_CHAR
MainForm.Center
MainForm.Activate
return NIL
//------------------------
function ResetSearch()
cStr:=""
MainForm.Statusbar.Item(1):=cStr
return NIL
//------------------------
function QuickSearch()
local ch, hWnd
ch := HMG_GetLastCharacter(@hWnd)
if asc(ch) = 8
cStr:=if(len(cStr)>1,left(cStr,len(cStr)-1),"")
else
cStr:=cStr+upper(ch)
endif
if !DBSEEK(cStr,.T.)
DBSKIP(-1)
endif
HMG_CleanLastCharacter()
MainForm.Statusbar.Item(1):=cStr
MainForm.br_Main.Value:=recno()
MainForm.br_Main.Setfocus
return 1
//-----------------------
function Resort(nNum)
Ordsetfocus(nNum)
cStr:=""
MainForm.Statusbar.Item(1):=cStr
Mainform.br_Main.Refresh
return Nil
//-----------------------
function Closedb()
DBCloseAll()
Return NIL
//-----------------------
Re: Incremental Search in BROWSE
Please attach some piece of database to allow testing it!
- danielmaximiliano
- Posts: 2612
- Joined: Fri Apr 09, 2010 4:53 pm
- Location: Argentina
- Contact:
Re: Incremental Search in BROWSE
Gracias por compartir Clip2Mania
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
- Clip2Mania
- Posts: 99
- Joined: Fri Jun 13, 2014 7:16 am
- Location: Belgium
Re: Incremental Search in BROWSE
Here is the code & snippet of DB!Please attach some piece of database to allow testing it!
- Attachments
-
- MiniBrowse.zip
- (8.43 KiB) Downloaded 518 times
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Incremental Search in BROWSE
Good jobClip2Mania wrote: Here is the code & snippet of DB!
Thanks to share
By the way, don't worry about PUBLICs, in HMG Lib almost everything is public !
Viva INTERNATIONAL HMG
- Clip2Mania
- Posts: 99
- Joined: Fri Jun 13, 2014 7:16 am
- Location: Belgium
Re: Incremental Search in BROWSE
In the code above, and also in general:
When you type a character, it is trapped by HMG_GetLastcharacter().
The following phenomenon occurs:
1) if you click in the browse, and then type a character, it is trapped.
2) if you scroll in the browse (with arrows or mouse scroll), and then type a character, the first character is not trapped by HMG_Getlastcharacter(), second one and following are.
How come? Is there a solution to this?
Thanks,
Erik
When you type a character, it is trapped by HMG_GetLastcharacter().
The following phenomenon occurs:
1) if you click in the browse, and then type a character, it is trapped.
2) if you scroll in the browse (with arrows or mouse scroll), and then type a character, the first character is not trapped by HMG_Getlastcharacter(), second one and following are.
How come? Is there a solution to this?
Thanks,
Erik
- Agil Abdullah
- Posts: 204
- Joined: Mon Aug 25, 2014 11:57 am
- Location: Jakarta, Indonesia
- Contact:
Re: Incremental Search in BROWSE
Hi Marek,
I tried to compiled your codes written down above, by inserting #include hmg.ch and minigui.ch before making Function Main().
But it generated errors as below:
----------------------------------------------------------------------------------------
Harbour 3.2.0dev (r1407111333)
Copyright (c) 1999-2014, http://harbour-project.org/" onclick="window.open(this.href);return false;
C:/Users/toshiba/AppData/Local/Temp/hbmk_dd8s3c.dir/inboxfind.o:inboxfind.c:(.data+0x58): undefined reference to `HB_FUN_OKNOSZYBKATABELATOWAROW_AKTUALIZUJPODGLAD'
C:/Users/toshiba/AppData/Local/Temp/hbmk_dd8s3c.dir/inboxfind.o:inboxfind.c:(.data+0x78): undefined reference to `HB_FUN_OKNOSZYBKATABELATOWAROW_ZWROCKODTOWARU'
C:/Users/toshiba/AppData/Local/Temp/hbmk_dd8s3c.dir/inboxfind.o:inboxfind.c:(.data+0x88): undefined reference to `HB_FUN_ZMIENKLUCZTOWARU'
collect2: ld returned 1 exit status
hbmk2: Error: Running linker. 1
gcc.exe C:/Users/toshiba/AppData/Local/Temp/hbmk_dd8s3c.dir/inboxfind.o C:/Users/toshiba/AppData/Local/Temp/hbmk_dd8s3c.dir/hbmk_h89g4y.o D:/hmg00/_temp.o -Wl,--nxcompat -Wl,--dynamicbase -mwindows -Wl,--start-group -lhmg -lcrypt -ledit -leditex -lgraph -lini -lreport -lhfcl -lmsvfw32 -lvfw32 -lhbct -lhbwin -lhbmzip -lminizip -lhbmemio -lhbmisc -lhbmysql -lmysql -lhbtip -lhbsqlit3 -lsddodbc -lrddsql -lsddmy -lhbodbc -lodbc32 -lhbhpdf -lhbfimage -lhbpgsql -lhbnetio -lxhb -lpng -llibhpdf -lhbvpdf -lhbzebra -lhbextern -lhbdebug -lhbvmmt -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbmainwin -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -liphlpapi -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib -Wl,--end-group -oinboxfind.exe -Ld:/HMG331/harbour/lib/win/mingw -Ld:/HMG331/lib
hbmk2: Error: Referenced, missing, but unknown function(s):
OKNOSZYBKATABELATOWAROW_AKTUALIZUJPODGLAD(),
OKNOSZYBKATABELATOWAROW_ZWROCKODTOWARU(), ZMIENKLUCZTOWARU()
----------------------------------------------------------------------------------------
Pls tell me how fix it. Thanks.
I tried to compiled your codes written down above, by inserting #include hmg.ch and minigui.ch before making Function Main().
But it generated errors as below:
----------------------------------------------------------------------------------------
Harbour 3.2.0dev (r1407111333)
Copyright (c) 1999-2014, http://harbour-project.org/" onclick="window.open(this.href);return false;
C:/Users/toshiba/AppData/Local/Temp/hbmk_dd8s3c.dir/inboxfind.o:inboxfind.c:(.data+0x58): undefined reference to `HB_FUN_OKNOSZYBKATABELATOWAROW_AKTUALIZUJPODGLAD'
C:/Users/toshiba/AppData/Local/Temp/hbmk_dd8s3c.dir/inboxfind.o:inboxfind.c:(.data+0x78): undefined reference to `HB_FUN_OKNOSZYBKATABELATOWAROW_ZWROCKODTOWARU'
C:/Users/toshiba/AppData/Local/Temp/hbmk_dd8s3c.dir/inboxfind.o:inboxfind.c:(.data+0x88): undefined reference to `HB_FUN_ZMIENKLUCZTOWARU'
collect2: ld returned 1 exit status
hbmk2: Error: Running linker. 1
gcc.exe C:/Users/toshiba/AppData/Local/Temp/hbmk_dd8s3c.dir/inboxfind.o C:/Users/toshiba/AppData/Local/Temp/hbmk_dd8s3c.dir/hbmk_h89g4y.o D:/hmg00/_temp.o -Wl,--nxcompat -Wl,--dynamicbase -mwindows -Wl,--start-group -lhmg -lcrypt -ledit -leditex -lgraph -lini -lreport -lhfcl -lmsvfw32 -lvfw32 -lhbct -lhbwin -lhbmzip -lminizip -lhbmemio -lhbmisc -lhbmysql -lmysql -lhbtip -lhbsqlit3 -lsddodbc -lrddsql -lsddmy -lhbodbc -lodbc32 -lhbhpdf -lhbfimage -lhbpgsql -lhbnetio -lxhb -lpng -llibhpdf -lhbvpdf -lhbzebra -lhbextern -lhbdebug -lhbvmmt -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbmainwin -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -liphlpapi -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib -Wl,--end-group -oinboxfind.exe -Ld:/HMG331/harbour/lib/win/mingw -Ld:/HMG331/lib
hbmk2: Error: Referenced, missing, but unknown function(s):
OKNOSZYBKATABELATOWAROW_AKTUALIZUJPODGLAD(),
OKNOSZYBKATABELATOWAROW_ZWROCKODTOWARU(), ZMIENKLUCZTOWARU()
----------------------------------------------------------------------------------------
Pls tell me how fix it. Thanks.
Agil Abdullah Albatati (just call me Agil)
Programmer Never Surrender
Programmer Never Surrender
Re: Incremental Search in BROWSE
these functions are defined in my project.
This function updates only additional informations on screen (product describe, image of product):
second:
you can see macro calling: &cFunkcjaZapisuPozycji
It realize special action after selecting item, you can set it by cFunkcjaZapisuPozycji := ""
And the last changes index:
I'm afraid you will find it hard to implement. But try!
This function updates only additional informations on screen (product describe, image of product):
Code: Select all
function OknoSzybkaTabelaTowarow_AktualizujPodglad
OknoTabTowarow.T_DodatOpis.Value := towary->DodatOpis
if lPodgladZdjecia
cOkno := "OknoTabTowarow"
if IsControlDefined(IM_ZdjecieTowaru, OknoTabTowarow)
if file(cFolderZdjecTowarow+"T"+towary->towar+".jpg")
SetProperty(cOkno,"IM_ZdjecieTowaru","Picture",cFolderZdjecTowarow+"T"+towary->towar+".jpg")
elseif file(cFolderZdjecTowarow+"T"+towary->towar+"_1.jpg")
SetProperty(cOkno,"IM_ZdjecieTowaru","Picture",cFolderZdjecTowarow+"T"+towary->towar+"_1.jpg")
else
SetProperty(cOkno,"IM_ZdjecieTowaru","Picture",'RC_BRAKZDJECIA')
endif
endif
endif
return
Code: Select all
function OknoSzybkaTabelaTowarow_ZwrocKodTowaru
local StObsBledu
local lKontynuacja := .t.
ZwrotnyTowar := OknoTabTowarow.B_Towary.Value
towary->(DBGoTo(ZwrotnyTowar))
if !empty(cFunkcjaZapisuPozycji)
lKontynuacja := &cFunkcjaZapisuPozycji
endif
if !lKontynuacja
OknoTabTowarow.Release
else
OknoTabTowarow.T_Wyszukaj.Value := ""
//OknoTabTowarow.SetFocus
endif
return
It realize special action after selecting item, you can set it by cFunkcjaZapisuPozycji := ""
And the last changes index:
Code: Select all
function ZmienKluczTowaru
param NrKlucza
DbSetOrder(NrKlucza)
SetProperty(ThisWindow.Name, "B_Towary","Value" ,towary->(recno()) )
DoMethod(ThisWindow.name, "B_Towary","Refresh")
DoMethod(ThisWindow.name, "T_Wyszukaj","SetFocus")
return .t.