Incremental Search with Combo Box
Moderator: Rathinagiri
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Incremental Search with Combo Box
Hi friends,
Thanks for your nice words.
As you can see here at point 1(c), this is my long time wish since 2003, ie, since my adoption of HMG.
I am so happy that, it can be done and was nicely tried by Esgici.
Thanks again.
Thanks for your nice words.
As you can see here at point 1(c), this is my long time wish since 2003, ie, since my adoption of HMG.
I am so happy that, it can be done and was nicely tried by Esgici.
Thanks again.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Incremental Search with Combo Box
Hello,
It's our "dreams" who always make ourselves step forward!
Contrats "Guru"!!! (you deserve the term from me)
As of now, my best choice of Grid for ComboBox handling is (you guessed it) HMG Grid - Simple, Roboust.
Regards.
Sudip
It's our "dreams" who always make ourselves step forward!
Contrats "Guru"!!! (you deserve the term from me)
As of now, my best choice of Grid for ComboBox handling is (you guessed it) HMG Grid - Simple, Roboust.
Regards.
Sudip
With best regards,
Sudip
Sudip
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Incremental Search with Combo Box
Hi,
Here comes the new version of combosearchbox. Kindly go through and give your suggestions.
Here comes the new version of combosearchbox. Kindly go through and give your suggestions.
Code: Select all
/*
CSBox ( Combined Search Box ) try
*/
#include "minigui.ch"
#command @ <row>, <col> COMBOSEARCHBOX <name> ;
[ <dummy1: OF, PARENT> <parent> ] ;
[ HEIGHT <height> ] ;
[ WIDTH <width> ] ;
[ VALUE <value> ] ;
[ FONT <fontname> ] ;
[ SIZE <fontsize> ] ;
[ <bold : BOLD> ] ;
[ <italic : ITALIC> ] ;
[ <underline : UNDERLINE> ] ;
[ TOOLTIP <tooltip> ] ;
[ BACKCOLOR <backcolor> ] ;
[ FONTCOLOR <fontcolor> ] ;
[ MAXLENGTH <maxlenght> ] ;
[ <upper: UPPERCASE> ] ;
[ <lower: LOWERCASE> ] ;
[ <numeric: NUMERIC> ] ;
[ ON GOTFOCUS <gotfocus> ] ;
[ ON LOSTFOCUS <lostfocus> ] ;
[ ON ENTER <enter> ] ;
[ <RightAlign: RIGHTALIGN> ] ;
[ <notabstop: NOTABSTOP> ] ;
[ HELPID <helpid> ] ;
[ ITEMS <aitems> ] ;
=>;
_DefineComboSearchBox( <"name">, <"parent">, <col>, <row>, <width>, <height>, <value>, ;
<fontname>, <fontsize>, <tooltip>, <maxlenght>, ;
<.upper.>, <.lower.>, <.numeric.>, ;
<{lostfocus}>, <{gotfocus}>, <{enter}>, ;
<.RightAlign.>, <helpid>, <.bold.>, <.italic.>, <.underline.>, <backcolor> , <fontcolor> , <.notabstop.>, <aitems> )
#xcommand DEFINE COMBOSEARCHBOX <name>;
=>;
_HMG_SYSDATA \[ 416 \] := <"name"> ;; //name
_HMG_SYSDATA \[ 417 \] := Nil ;; //parent
_HMG_SYSDATA \[ 431 \] := Nil ;; //row
_HMG_SYSDATA \[ 432 \] := Nil ;; //col
_HMG_SYSDATA \[ 421 \] := Nil ;; // height
_HMG_SYSDATA \[ 420 \] := Nil ;; // width
_HMG_SYSDATA \[ 434 \] := Nil ;; //value
_HMG_SYSDATA \[ 422 \] := Nil ;; //font
_HMG_SYSDATA \[ 423 \] := Nil ;; // size
_HMG_SYSDATA \[ 412 \] := .f. ;; //bold
_HMG_SYSDATA \[ 413 \] := .f. ;; // italic
_HMG_SYSDATA \[ 415 \] := .f. ;; // underline
_HMG_SYSDATA \[ 424 \] := Nil ;; //tooltip
_HMG_SYSDATA \[ 457 \] := Nil ;; // backcolor
_HMG_SYSDATA \[ 458 \] := Nil ;; // fontcolor
_HMG_SYSDATA \[ 442 \] := Nil ;; // maxlength
_HMG_SYSDATA \[ 475 \] := .f. ;; //upper
_HMG_SYSDATA \[ 476 \] := .f. ;; //lower
_HMG_SYSDATA \[ 477 \] := .f. ;; // numeric
_HMG_SYSDATA \[ 426 \] := Nil ;; // gotfocus
_HMG_SYSDATA \[ 427 \] := Nil ;; //lostfocus
_HMG_SYSDATA \[ 437 \] := Nil ;; //enter
_HMG_SYSDATA \[ 440 \] := .f. ;; //rightalign
_HMG_SYSDATA \[ 428 \] := .t. ;; //tabstop
_HMG_SYSDATA \[ 429 \] := Nil ;; // helpid
_HMG_SYSDATA \[ 436 \] := Nil // items
#xcommand END COMBOSEARCHBOX;
=>;
_DefineComboSearchBox(;
_HMG_SYSDATA \[ 416 \],; //name
_HMG_SYSDATA \[ 417 \],; //parent
_HMG_SYSDATA \[ 432 \],; //col
_HMG_SYSDATA \[ 431 \],; //row
_HMG_SYSDATA \[ 420 \],; //width
_HMG_SYSDATA \[ 421 \],; //height
_HMG_SYSDATA \[ 434 \],; //value
_HMG_SYSDATA \[ 422 \],; //fontname
_HMG_SYSDATA \[ 423 \],; //fontsize
_HMG_SYSDATA \[ 424 \],; //tooltip
_HMG_SYSDATA \[ 442 \],; //maxlength
_HMG_SYSDATA \[ 475 \],; //upper
_HMG_SYSDATA \[ 476 \],; //lower
_HMG_SYSDATA \[ 477 \],; //numeric
_HMG_SYSDATA \[ 427 \],; //lostfocus
_HMG_SYSDATA \[ 426 \],; //gotfocus
_HMG_SYSDATA \[ 437 \],; //enter
_HMG_SYSDATA \[ 440 \],; //rightalign
_HMG_SYSDATA \[ 429 \],; //helpid
_HMG_SYSDATA \[ 412 \],; //bold
_HMG_SYSDATA \[ 413 \] , ; //italic
_HMG_SYSDATA \[ 415 \],; //underline
_HMG_SYSDATA \[ 457 \] , ; //backcolor
_HMG_SYSDATA \[ 458 \] , ;// fontcolor
_HMG_SYSDATA \[ 428 \] ,; //tabstop
_HMG_SYSDATA \[ 436 \]) //items
PROC Main()
aCountries := HB_ATOKENS( MEMOREAD( "Countries.lst" ), CRLF )
ASORT( aCountries ) // This Array MUST be sorted
DEFINE WINDOW frmCSBTest ;
AT 0,0 ;
WIDTH 550 ;
HEIGHT 300 ;
TITLE 'CSBox ( Combined Search Box ) Test' ;
MAIN
ON KEY ESCAPE ACTION frmCSBTest.Release
define label countries
row 25
col 100
width 100
value "Countries"
end label
define combosearchbox s1
parent frmCSBTest
row 25
col 200
width 200
items acountries
end combosearchbox
@ 55, 190 TEXTBOX txbMessy width 400
@ 85, 190 TEXTBOX txbMessy1
END WINDOW // frmCSBTest
frmCSBTest.Center
frmCSBTest.Activate
RETU // Main()
function _DefineComboSearchBox( cname,cparent, ncol, nrow, nwidth, nheight, cvalue, ;
cfontname, nfontsize, ctooltip, nmaxlenght, ;
lupper, llower, lnumeric, ;
blostfocus, bgotfocus, benter, ;
lRightAlign, nhelpid, lbold, litalic, lunderline, abackcolor , afontcolor , lnotabstop, aarray )
DEFAULT nWidth := 120
DEFAULT nHeight := 24
DEFAULT cValue := ""
DEFAULT bGotFocus := ""
DEFAULT bLostFocus := ""
DEFAULT nMaxLenght := 255
DEFAULT lUpper := .f.
DEFAULT lLower := .f.
DEFAULT lNumeric := .f.
DEFAULT bEnter := ""
public parentname := cparent,;
cTxBname := cname,;
aItems := aArray
DEFINE TEXTBOX &cname
PARENT &cparent
ROW nrow
COL ncol
WIDTH nwidth
HEIGHT nheight
value cValue
FONTNAME cfontname
FONTSIZE nFontsize
tooltip ctooltip
maxlength nmaxlenght
uppercase lupper
lowercase llower
numeric lnumeric
onlostfocus blostfocus
ongotfocus bgotfocus
onenter benter
ONCHANGE createcsbox()
rightalign lrightalign
helpid nhelpid
fontbold lbold
fontitalic litalic
fontunderline lunderline
backcolor abackcolor
fontcolor afontcolor
tabstop lnotabstop
END textbox
return nil
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
function createcsbox
local formname := thiswindow.name
local formrow := thiswindow.row
local formcol := thiswindow.col
local controlrow := this.row
local controlcol := this.col
local controlwidth := this.width
local controlheight := this.height
local curvalue := this.value
local aresults := {}
local result := 0
local i := 0
local listboxheight := 0
local caret := this.CaretPos
if !empty(curvalue)
for i := 1 to len(aitems)
if upper(aitems[i]) == upper(curvalue)
return nil //item selected already
endif
if upper(left(aitems[i],len(curvalue))) == upper(curvalue)
aadd(aresults,aitems[i])
endif
next i
if len(aresults) > 0
listboxheight := max(min(len(aresults) * 15,thiswindow.height - controlrow - controlheight),20)
define window _hmg_csbox at formrow+controlrow+20,formcol+controlcol width controlwidth height listboxheight+controlheight title '' modal nocaption nosize //on interactiveclose _hmg_csbox.release()
define textbox _cstext
row 3
col 3
width controlwidth
height controlheight
on change _cstextchanged()
on enter _csitemselected()
end textbox
define listbox _cslist
row controlheight+3
col 3
width controlwidth
height listboxheight
items aresults
on dblclick _csitemselected()
value 1
end listbox
end window
on key UP of _hmg_csbox action _csdoupkey()
on key DOWN of _hmg_csbox action _csdodownkey()
on key ESCAPE of _hmg_csbox action _csdoesckey()
_hmg_csbox._cstext.value := curvalue
_hmg_csbox._cstext.CaretPos := caret
_hmg_csbox.activate()
endif
endif
return nil
function _cstextchanged
local curvalue := _hmg_csbox._cstext.value
local aresults := {}
local result := 0
local i := 0
local listboxheight := 0
local parentheight := getproperty(parentname,"HEIGHT")
local parentrow := getproperty(parentname,"ROW")
_hmg_csbox._cslist.deleteallitems()
for i := 1 to len(aitems)
if upper(left(aitems[i],len(curvalue))) == upper(curvalue)
aadd(aresults,aitems[i])
endif
next i
if len(aresults) > 0
for i := 1 to len(aresults)
_hmg_csbox._cslist.additem(aresults[i])
next i
_hmg_csbox._cslist.value := 1
endif
listboxheight := max(min(len(aresults) * 15,(parentheight + parentrow - _hmg_csbox.row - _hmg_csbox._cstext.row - _hmg_csbox._cstext.height - 10)),20)
_hmg_csbox._cslist.height := listboxheight
_hmg_csbox.height := listboxheight+_hmg_csbox._cstext.height
return nil
function _csitemselected
if _hmg_csbox._cslist.value > 0
setproperty(parentname,cTxBName,"VALUE",_hmg_csbox._cslist.item(_hmg_csbox._cslist.value))
setproperty(parentname,cTxBName,"CARETPOS",len(_hmg_csbox._cslist.item(_hmg_csbox._cslist.value)))
_hmg_csbox.release()
endif
return nil
function _csdoupkey
if _hmg_csbox._cslist.itemcount > 0 .and. _hmg_csbox._cslist.value > 1
_hmg_csbox._cslist.value := _hmg_csbox._cslist.value - 1
endif
return nil
function _csdodownkey
if _hmg_csbox._cslist.itemcount > 0 .and. _hmg_csbox._cslist.value < _hmg_csbox._cslist.itemcount
_hmg_csbox._cslist.value := _hmg_csbox._cslist.value + 1
endif
function _csdoesckey
setproperty(parentname,cTxBName,"VALUE",'')
_hmg_csbox.release()
return nil
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Incremental Search with Combo Box
Hi Rathi,
Excellent work So, we are going to get a power packed command with HMG, if Roberto permits
I have 3 queries. (Those are just queries, nothing more.)
1. Can the lower border of the list box be more prominent?
2. Can the parent clause of ComboSearchBox be optional?
3. How can the "ordinary" people like me, get knowledge of _HMG_SYSDATA
Thank you again for sharing this excellent software.
With best regards.
Sudip
Excellent work So, we are going to get a power packed command with HMG, if Roberto permits
I have 3 queries. (Those are just queries, nothing more.)
1. Can the lower border of the list box be more prominent?
2. Can the parent clause of ComboSearchBox be optional?
3. How can the "ordinary" people like me, get knowledge of _HMG_SYSDATA
Thank you again for sharing this excellent software.
With best regards.
Sudip
With best regards,
Sudip
Sudip
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Incremental Search with Combo Box
I think I too don't know anything about _HMG_SYSDATA. What I had done is copy paste from i_altsyntax.ch and i_textbox.ch.
I am working only for the other two queries.
I am working only for the other two queries.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Incremental Search with Combo Box
Wonderful
Now could we say "we have a new control" ?
Congrats and thanks
with best regards
--
Esgici
Now could we say "we have a new control" ?
Congrats and thanks
with best regards
--
Esgici
Viva INTERNATIONAL HMG
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Incremental Search with Combo Box
Hi Rathi
Two little suggestions :
( line 230 )
and ( line 280 )
Regards
--
Esgici
Two little suggestions :
( line 230 )
Code: Select all
define window _hmg_csbox at formrow+controlrow+27, formcol+controlcol width controlwidth + 6 height listboxheight+controlheight + 6 title '' modal nocaption nosize //on interactiveclose _hmg_csbox.release()
Code: Select all
_hmg_csbox.height := listboxheight+_hmg_csbox._cstext.height + 6
--
Esgici
Viva INTERNATIONAL HMG
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Incremental Search with Combo Box
Hi,
Kindly try this. I think I had solved all the three queries.
Kindly try this. I think I had solved all the three queries.
Code: Select all
/*
CSBox ( Combined Search Box ) try
*/
#include "minigui.ch"
#command @ <row>, <col> COMBOSEARCHBOX <name> ;
[ <dummy1: OF, PARENT> <parent> ] ;
[ HEIGHT <height> ] ;
[ WIDTH <width> ] ;
[ VALUE <value> ] ;
[ FONT <fontname> ] ;
[ SIZE <fontsize> ] ;
[ <bold : BOLD> ] ;
[ <italic : ITALIC> ] ;
[ <underline : UNDERLINE> ] ;
[ TOOLTIP <tooltip> ] ;
[ BACKCOLOR <backcolor> ] ;
[ FONTCOLOR <fontcolor> ] ;
[ MAXLENGTH <maxlenght> ] ;
[ <upper: UPPERCASE> ] ;
[ <lower: LOWERCASE> ] ;
[ <numeric: NUMERIC> ] ;
[ ON GOTFOCUS <gotfocus> ] ;
[ ON LOSTFOCUS <lostfocus> ] ;
[ ON ENTER <enter> ] ;
[ <RightAlign: RIGHTALIGN> ] ;
[ <notabstop: NOTABSTOP> ] ;
[ HELPID <helpid> ] ;
[ ITEMS <aitems> ] ;
=>;
_DefineComboSearchBox( <"name">, <"parent">, <col>, <row>, <width>, <height>, <value>, ;
<fontname>, <fontsize>, <tooltip>, <maxlenght>, ;
<.upper.>, <.lower.>, <.numeric.>, ;
<{lostfocus}>, <{gotfocus}>, <{enter}>, ;
<.RightAlign.>, <helpid>, <.bold.>, <.italic.>, <.underline.>, <backcolor> , <fontcolor> , <.notabstop.>, <aitems> )
#xcommand DEFINE COMBOSEARCHBOX <name>;
=>;
_HMG_SYSDATA \[ 416 \] := <"name"> ;; //name
_HMG_SYSDATA \[ 417 \] := Nil ;; //parent
_HMG_SYSDATA \[ 431 \] := Nil ;; //row
_HMG_SYSDATA \[ 432 \] := Nil ;; //col
_HMG_SYSDATA \[ 421 \] := Nil ;; // height
_HMG_SYSDATA \[ 420 \] := Nil ;; // width
_HMG_SYSDATA \[ 434 \] := Nil ;; //value
_HMG_SYSDATA \[ 422 \] := Nil ;; //font
_HMG_SYSDATA \[ 423 \] := Nil ;; // size
_HMG_SYSDATA \[ 412 \] := .f. ;; //bold
_HMG_SYSDATA \[ 413 \] := .f. ;; // italic
_HMG_SYSDATA \[ 415 \] := .f. ;; // underline
_HMG_SYSDATA \[ 424 \] := Nil ;; //tooltip
_HMG_SYSDATA \[ 457 \] := Nil ;; // backcolor
_HMG_SYSDATA \[ 458 \] := Nil ;; // fontcolor
_HMG_SYSDATA \[ 442 \] := Nil ;; // maxlength
_HMG_SYSDATA \[ 475 \] := .f. ;; //upper
_HMG_SYSDATA \[ 476 \] := .f. ;; //lower
_HMG_SYSDATA \[ 477 \] := .f. ;; // numeric
_HMG_SYSDATA \[ 426 \] := Nil ;; // gotfocus
_HMG_SYSDATA \[ 427 \] := Nil ;; //lostfocus
_HMG_SYSDATA \[ 437 \] := Nil ;; //enter
_HMG_SYSDATA \[ 440 \] := .f. ;; //rightalign
_HMG_SYSDATA \[ 428 \] := .t. ;; //tabstop
_HMG_SYSDATA \[ 429 \] := Nil ;; // helpid
_HMG_SYSDATA \[ 436 \] := Nil // items
#xcommand END COMBOSEARCHBOX;
=>;
_DefineComboSearchBox(;
_HMG_SYSDATA \[ 416 \],; //name
_HMG_SYSDATA \[ 417 \],; //parent
_HMG_SYSDATA \[ 432 \],; //col
_HMG_SYSDATA \[ 431 \],; //row
_HMG_SYSDATA \[ 420 \],; //width
_HMG_SYSDATA \[ 421 \],; //height
_HMG_SYSDATA \[ 434 \],; //value
_HMG_SYSDATA \[ 422 \],; //fontname
_HMG_SYSDATA \[ 423 \],; //fontsize
_HMG_SYSDATA \[ 424 \],; //tooltip
_HMG_SYSDATA \[ 442 \],; //maxlength
_HMG_SYSDATA \[ 475 \],; //upper
_HMG_SYSDATA \[ 476 \],; //lower
_HMG_SYSDATA \[ 477 \],; //numeric
_HMG_SYSDATA \[ 427 \],; //lostfocus
_HMG_SYSDATA \[ 426 \],; //gotfocus
_HMG_SYSDATA \[ 437 \],; //enter
_HMG_SYSDATA \[ 440 \],; //rightalign
_HMG_SYSDATA \[ 429 \],; //helpid
_HMG_SYSDATA \[ 412 \],; //bold
_HMG_SYSDATA \[ 413 \] , ; //italic
_HMG_SYSDATA \[ 415 \],; //underline
_HMG_SYSDATA \[ 457 \] , ; //backcolor
_HMG_SYSDATA \[ 458 \] , ;// fontcolor
_HMG_SYSDATA \[ 428 \] ,; //tabstop
_HMG_SYSDATA \[ 436 \]) //items
PROC Main()
aCountries := HB_ATOKENS( MEMOREAD( "Countries.lst" ), CRLF )
ASORT( aCountries ) // This Array MUST be sorted
DEFINE WINDOW frmCSBTest ;
AT 0,0 ;
WIDTH 550 ;
HEIGHT 300 ;
TITLE 'CSBox ( Combined Search Box ) Test' ;
MAIN
ON KEY ESCAPE ACTION frmCSBTest.Release
define label countries
row 25
col 100
width 100
value "Countries"
end label
define combosearchbox s1
row 25
col 190
width 200
fontname "Courier"
fontitalic .t.
fontbold .t.
fontcolor {255,255,255}
backcolor {0,0,255}
items acountries
end combosearchbox
@ 55, 190 TEXTBOX txbMessy width 400
@ 85, 190 TEXTBOX txbMessy1
END WINDOW // frmCSBTest
frmCSBTest.Center
frmCSBTest.Activate
RETU // Main()
function _DefineComboSearchBox( cname,cparent, ncol, nrow, nwidth, nheight, cvalue, ;
cfontname, nfontsize, ctooltip, nmaxlenght, ;
lupper, llower, lnumeric, ;
blostfocus, bgotfocus, benter, ;
lRightAlign, nhelpid, lbold, litalic, lunderline, abackcolor , afontcolor , lnotabstop, aarray )
DEFAULT nWidth := 120
DEFAULT nHeight := 24
DEFAULT cValue := ""
DEFAULT bGotFocus := ""
DEFAULT bLostFocus := ""
DEFAULT nMaxLenght := 255
DEFAULT lUpper := .f.
DEFAULT lLower := .f.
DEFAULT lNumeric := .f.
DEFAULT bEnter := ""
public parentname := '',;
cTxBname := cname,;
aItems := aArray
if _HMG_SYSDATA [ 264 ] = .T.
parentname := _HMG_SYSDATA [ 223 ]
else
parentname := cparent
endif
DEFINE TEXTBOX &cname
PARENT &cparent
ROW nrow
COL ncol
WIDTH nwidth
HEIGHT nheight
value cValue
FONTNAME cfontname
FONTSIZE nFontsize
tooltip ctooltip
maxlength nmaxlenght
uppercase lupper
lowercase llower
numeric lnumeric
onlostfocus blostfocus
ongotfocus bgotfocus
onenter benter
ONCHANGE createcsbox()
rightalign lrightalign
helpid nhelpid
fontbold lbold
fontitalic litalic
fontunderline lunderline
backcolor abackcolor
fontcolor afontcolor
tabstop lnotabstop
END textbox
return nil
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
function createcsbox
local formname := thiswindow.name
local formrow := thiswindow.row
local formcol := thiswindow.col
local controlrow := this.row
local controlcol := this.col
local controlwidth := this.width
local controlheight := this.height
local curvalue := this.value
local aresults := {}
local result := 0
local i := 0
local listboxheight := 0
local caret := this.CaretPos
if !empty(curvalue)
for i := 1 to len(aitems)
if upper(aitems[i]) == upper(curvalue)
return nil //item selected already
endif
if upper(left(aitems[i],len(curvalue))) == upper(curvalue)
aadd(aresults,aitems[i])
endif
next i
if len(aresults) > 0
listboxheight := max(min((len(aresults) * 16)+60,thiswindow.height - controlrow - controlheight-10),40)
define window _hmg_csbox at formrow+controlrow+20,formcol+controlcol width controlwidth+6 height listboxheight+controlheight title '' modal nocaption nosize //on interactiveclose _hmg_csbox.release()
define textbox _cstext
row 3
col 3
width controlwidth
height controlheight
FONTNAME this.fontname
FONTSIZE this.Fontsize
tooltip this.tooltip
fontbold this.fontbold
fontitalic this.fontitalic
fontunderline this.fontunderline
backcolor this.backcolor
fontcolor this.fontcolor
on change _cstextchanged()
on enter _csitemselected()
end textbox
define listbox _cslist
row controlheight+3
col 3
width controlwidth
height listboxheight
items aresults
on dblclick _csitemselected()
value 1
end listbox
end window
on key UP of _hmg_csbox action _csdoupkey()
on key DOWN of _hmg_csbox action _csdodownkey()
on key ESCAPE of _hmg_csbox action _csdoesckey()
_hmg_csbox._cstext.value := curvalue
_hmg_csbox._cstext.CaretPos := caret
_hmg_csbox.activate()
endif
endif
return nil
function _cstextchanged
local curvalue := _hmg_csbox._cstext.value
local aresults := {}
local result := 0
local i := 0
local listboxheight := 0
local parentheight := getproperty(parentname,"HEIGHT")
local parentrow := getproperty(parentname,"ROW")
_hmg_csbox._cslist.deleteallitems()
for i := 1 to len(aitems)
if upper(left(aitems[i],len(curvalue))) == upper(curvalue)
aadd(aresults,aitems[i])
endif
next i
if len(aresults) > 0
for i := 1 to len(aresults)
_hmg_csbox._cslist.additem(aresults[i])
next i
_hmg_csbox._cslist.value := 1
endif
listboxheight := max(min((len(aresults) * 16)+6,(parentheight + parentrow - _hmg_csbox.row - _hmg_csbox._cstext.row - _hmg_csbox._cstext.height - 14)),40)
_hmg_csbox._cslist.height := listboxheight
_hmg_csbox.height := listboxheight+_hmg_csbox._cstext.height
return nil
function _csitemselected
if _hmg_csbox._cslist.value > 0
setproperty(parentname,cTxBName,"VALUE",_hmg_csbox._cslist.item(_hmg_csbox._cslist.value))
setproperty(parentname,cTxBName,"CARETPOS",len(_hmg_csbox._cslist.item(_hmg_csbox._cslist.value)))
_hmg_csbox.release()
endif
return nil
function _csdoupkey
if _hmg_csbox._cslist.itemcount > 0 .and. _hmg_csbox._cslist.value > 1
_hmg_csbox._cslist.value := _hmg_csbox._cslist.value - 1
endif
return nil
function _csdodownkey
if _hmg_csbox._cslist.itemcount > 0 .and. _hmg_csbox._cslist.value < _hmg_csbox._cslist.itemcount
_hmg_csbox._cslist.value := _hmg_csbox._cslist.value + 1
endif
return nil
function _csdoesckey
setproperty(parentname,cTxBName,"VALUE",'')
_hmg_csbox.release()
return nil
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Incremental Search with Combo Box
I had separated the sample and control file. Attached is sample and control programmes.
Kindly compile and tell me about your comments.
Kindly compile and tell me about your comments.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Incremental Search with Combo Box
Hi Rathi,
Excellent Mind Blowing What a magic
Thank you very much I like it soooooo much !!!!
All the queries solved!!!!! You are a genius, my friend!!!!
With best regards.
Sudip
Excellent Mind Blowing What a magic
Thank you very much I like it soooooo much !!!!
All the queries solved!!!!! You are a genius, my friend!!!!
With best regards.
Sudip
With best regards,
Sudip
Sudip