In HMG 3.0.35, HFCL Combosearchbox does not work properly.
The first character is initially selected in the textbox thereby the second character is replaced as the first letter. Previously it was not like that. I don't know from which version this happens.
Kindly check the sample, after running makehfcl.bat in c:\hmg\hfcl\source and then compiling the combosearchbox sample file.
Any suggestions for fixing?
Combosearchbox first char problem?
Moderator: Rathinagiri
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Combosearchbox first char problem?
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: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Combosearchbox first char problem?
I had found the fix! The setproperty of textbox is now in "on init" event. Now it works fine.
Code: Select all
#include "hmg.ch"
PROC _DefineComboSearchBox( cCSBoxName,;
cCSBoxParent,;
cCSBoxCol,;
cCSBoxRow,;
cCSBoxWidth,;
cCSBoxHeight,;
cCSBoxValue,;
cFontName,;
nFontSize,;
cToolTip,;
nMaxLenght,;
lUpper,;
lLower,;
lNumeric,;
bLostFocus,;
bGotFocus,;
bEnter,;
lRightAlign,;
nHelpId,;
lBold,;
lItalic,;
lUnderline,;
aBackColor,;
aFontColor,;
lNoTabStop,;
aArray,;
lAnyWhere )
LOCAL cParentName := ''
DEFAULT cCSBoxWidth := 120
DEFAULT cCSBoxHeight := 24
DEFAULT cCSBoxValue := ""
DEFAULT bGotFocus := ""
DEFAULT bLostFocus := ""
DEFAULT nMaxLenght := 255
DEFAULT lUpper := .F.
DEFAULT lLower := .F.
DEFAULT lNumeric := .F.
DEFAULT bEnter := ""
DEFAULT lAnyWhere := .f.
IF _HMG_SYSDATA [ 264 ] = .T. // _HMG_BeginWindowActive
cParentName := _HMG_SYSDATA [ 223 ] // _HMG_ActiveFormName
ELSE
cParentName := cCSBoxParent
ENDIF
_DefineTextBox( cCSBoxName,;
cCSBoxParent,;
cCSBoxcol,;
cCSBoxRow,;
cCSBoxWidth,;
cCSBoxheight,;
cCSBoxValue,;
cFontName,;
nFontSize,;
cToolTip,;
nMaxLenght,;
lUpper,;
lLower,;
lNumeric,;
.f.,;
bLostFocus,;
bGotFocus,;
{||CreateCSBox( cParentName, cCSBoxName, aArray, cCSBoxRow, cCSBoxCol,lAnyWhere)},;
bEnter,;
lRightAlign,;
nHelpId,;
.f.,;
lBold,;
lItalic,;
lUnderline,;
.f.,;
,;
aBackColor,;
aFontColor,;
.f.,;
iif(lNoTabStop,.f.,.t.);
)
/*
DEFINE TEXTBOX &cCSBoxName
PARENT &cCSBoxParent
ROW cCSBoxRow
COL cCSBoxCol
WIDTH cCSBoxWidth
HEIGHT cCSBoxHeight
VALUE cCSBoxValue
FONTNAME cFontName
FONTSIZE nFontSize
TOOLTIP cToolTip
MAXLENGTH nMaxLenght
UPPERCASE lUpper
LOWERCASE lLower
NUMERIC lNumeric
ONLOSTFOCUS bLostFocus
ONGOTFOCUS bGotFocus
ONENTER bEnter
ONCHANGE CreateCSBox( cParentName, cCSBoxName, aArray, cCSBoxRow, cCSBoxCol)
RIGHTALIGN lRightAlign
HELPID nHelpId
FONTBOLD lBold
FONTITALIC lItalic
FONTUNDERLINE lUnderline
BACKCOLOR aBackColor
FONTCOLOR aFontColor
TABSTOP lNoTabStop
END TEXTBOX
*/
RETURN // _DefineComboSearchBox()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
STATIC PROC CreateCSBox( cParentName, cCSBoxName, aitems, cCSBoxRow, cCSBoxCol,lAnyWhere )
LOCAL nFormRow := thisWindow.row
LOCAL nFormCol := thisWindow.col
LOCAL nControlRow := this.row
LOCAL nControlCol := this.col
LOCAL nControlWidth := this.width
LOCAL nControlHeight := this.height
LOCAL cCurValue := this.value
LOCAL aResults := {}
LOCAL nContIndx := GetControlIndex( this.name, thiswindow.name )
LOCAL result := 0
LOCAL nItemNo := 0
LOCAL nListBoxHeight := 0
LOCAL caret := this.CaretPos
LOCAL cCSBxName := 'frm' + cCSBoxName
IF !EMPTY(cCurValue)
IF _HMG_SYSDATA [ 23, nContIndx ] # -1 // _HMG_aControlContainerRow
nControlRow += _HMG_SYSDATA [ 23, nContIndx ] // _HMG_aControlContainerRow
nControlCol += _HMG_SYSDATA [ 24, nContIndx ] // _HMG_aControlContainerCol
ENDIF
FOR nItemNo := 1 TO LEN(aitems)
IF UPPER( aitems[ nItemNo ] ) == UPPER( cCurValue )
EXIT // item selected already
ENDIF
IF UPPER( LEFT( aitems[ nItemNo ], LEN( cCurValue ))) == UPPER(cCurValue)
AADD( aResults, aitems[ nItemNo ] )
ENDIF
NEXT nItemNo
IF LEN( aResults ) > 0
nListBoxHeight := MAX(MIN((LEN(aResults) * 16)+60,thiswindow.height - nControlRow - nControlHeight-10),40)
DEFINE WINDOW &cCSBxName ;
AT nFormRow+nControlRow+20, nFormCol+nControlCol ;
WIDTH nControlWidth+6 ;
HEIGHT nListBoxHeight+nControlHeight ;
TITLE '' ;
MODAL ;
NOCAPTION ;
NOSIZE;
on init _CSTextInit(cCSBxName,'_csText',cCurValue,caret)
ON KEY UP OF This.Window ACTION _CSDoUpKey()
ON KEY DOWN OF This.Window ACTION _CSDoDownKey()
ON KEY ESCAPE OF This.Window ACTION _CSDoEscKey(cParentName, cCSBoxName)
DEFINE TEXTBOX _cstext
ROW 3
COL 3
WIDTH nControlWidth
HEIGHT nControlHeight
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( cParentName, aitems, cCSBoxName, lAnyWhere )
ON ENTER _CSItemSelected( cParentName, aitems, cCSBoxName )
END TEXTBOX
DEFINE LISTBOX _cslist
ROW nControlHeight+3
COL 3
WIDTH nControlWidth
HEIGHT nListBoxHeight
ITEMS aResults
ON DBLCLICK _CSItemSelected( cParentName, aitems, cCSBoxName )
VALUE 1
END LISTBOX
END WINDOW
/*
SetProperty( cCSBxName, '_cstext', "VALUE", cCurValue )
SetProperty( cCSBxName, '_cstext', "CaretPos", caret )
*/
ACTIVATE WINDOW &cCSBxName
ENDIF
ENDIF
RETURN // CreateCSBox()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._
*
function _CSTextInit(cFormName,cControlName,cValue,nCaret)
SetProperty( cFormName, cControlName, "VALUE", cValue )
SetProperty( cFormName, cControlName, "CaretPos", nCaret )
return nil
STATIC PROC _CSTextChanged( cParentName, aItems, cTxBName, lAnyWhere )
LOCAL cCurValue := GetProperty( ThisWindow.Name, '_cstext', "VALUE" )
LOCAL aResults := {}
LOCAL nItemNo := 0
LOCAL nListBoxHeight := 0
LOCAL nParentHeight := GetProperty(cParentName,"HEIGHT")
LOCAL nParentRow := GetProperty(cParentName,"ROW")
DoMethod( ThisWindow.Name, "_csList", 'DeleteAllItems' )
FOR nItemNo := 1 TO LEN(aitems)
IF lAnyWhere
IF AT(UPPER(cCurValue),UPPER(aItems[nItemNo])) > 0
AADD(aResults,aitems[ nItemNo ])
ENDIF
ELSE
IF UPPER( LEFT( aitems[ nItemNo ], LEN(cCurValue))) == UPPER(cCurValue)
AADD(aResults,aitems[ nItemNo ])
ENDIF
ENDIF
NEXT nItemNo
IF LEN(aResults) > 0
FOR nItemNo := 1 TO LEN(aResults)
DoMethod( ThisWindow.Name, "_csList", 'AddItem', aResults[ nItemNo ] )
NEXT i
SetProperty( ThisWindow.Name, "_csList", "VALUE", 1 )
ENDIF
nListBoxHeight := MAX(MIN((LEN(aResults) * 16)+6,(nParentHeight + nParentRow - ;
GetProperty( ThisWindow.Name, 'ROW' ) - ;
GetProperty( ThisWindow.Name, "_csText", 'ROW' ) - ;
GetProperty( ThisWindow.Name, "_csText", 'HEIGHT' ) - 14)), 40)
SetProperty( ThisWindow.Name, "_csList", "HEIGHT", nListBoxHeight )
SetProperty( ThisWindow.Name, "HEIGHT", nListBoxHeight + GetProperty( ThisWindow.Name, '_cstext', "HEIGHT" ) )
RETURN // _CSTextChanged()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._
STATIC PROC _CSItemSelected( cParentName, aitems, cTxBName )
if GetProperty( ThisWindow.Name, "_csList", "VALUE" ) > 0
nListValue := GetProperty( ThisWindow.Name, '_csList', "VALUE" )
cListItem := GetProperty( ThisWindow.Name, '_csList', "ITEM", nListValue )
SetProperty( cParentName, cTxBName, "VALUE", cListItem )
SetProperty(cParentName,cTxBName,"CARETPOS",;
LEN( GetProperty( ThisWindow.Name, '_csList', "ITEM",;
GetProperty( ThisWindow.Name, '_csList', "VALUE" ) ) ) )
DoMethod( ThisWindow.Name, "Release" )
ENDIF
RETURN // _CSItemSelected()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._
STATIC PROC _CSDoUpKey()
IF GetProperty( ThisWindow.Name, '_csList', "ItemCount" ) > 0 .AND. ;
GetProperty( ThisWindow.Name, '_csList', "VALUE" ) > 1
SetProperty( ThisWindow.Name, '_csList', "VALUE", GetProperty( ThisWindow.Name, '_csList', "VALUE" ) - 1 )
ENDIF
RETURN // _CSDoUpKey()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._
STATIC PROC _CSDoDownKey()
IF GetProperty( ThisWindow.Name, '_csList', "ItemCount" ) > 0 .AND. ;
GetProperty( ThisWindow.Name, '_csList', "VALUE" ) < ;
GetProperty( ThisWindow.Name, '_csList', "ItemCount" )
SetProperty( ThisWindow.Name, '_csList', "VALUE", GetProperty( ThisWindow.Name, '_csList', "VALUE" ) + 1 )
ENDIF
RETURN // _CSDoDownKey()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._
STATIC PROC _CSDoEscKey(cParentName, cCSBoxName)
SetProperty( ThisWindow.Name, '_csText', "VALUE",'')
SetProperty( cParentName, cCSBoxName, "VALUE",'')
DoMethod( ThisWindow.Name, "Release" )
RETURN // _CSDoEscKey()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._
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: Combosearchbox first char problem?
Thanks Rathi, important improvement 
Regards
--
Esgici
Regards
--
Esgici
Viva INTERNATIONAL HMG 
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Combosearchbox first char problem?
We shall release the new HFCL fix release.
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.