i have two problems: 1. when typing the drop-down do not opens by itself
2. when typing i'm refreshing the @contents but it is making it difficult to type more than one char because it is getting the focus and overwrite the text
here is the code:
#definefunction ArraySearchResults(originalArray, searchTerm, fieldNumberToSearchIn, useFirstColumnAsHeadlines)
resultnewList = ""
resultnew = ArrayFromStr(resultnewList)
resultnew = ArrDimension(ArrInfo (originalArray, 1) + 1,ArrInfo (originalArray, 2))
ArrInitialize(resultnew,"null")
index = 0
maxIndex = (ArrInfo(originalArray, 1) - 1)
numberOfTimesExsistsInArray = 0
if searchTerm == "" || searchTerm == " " then
return originalArray
endif
for i = 0 to maxIndex
exsists = StrIndexNC(originalArray[i, fieldNumberToSearchIn], searchTerm, 0, @FWDSCAN)
if useFirstColumnAsHeadlines == @true && i == 0 then
headerNumber = 0
while headerNumber < 15
resultnew[index,headerNumber] = originalArray[i,headerNumber]
headerNumber = headerNumber + 1
EndWhile
index = index + 1
Continue
endif
if exsists > 0 then
numberOfTimesExsistsInArray = numberOfTimesExsistsInArray + 1
rowNumber = 0
while rowNumber < 15
resultnew[index,rowNumber] = originalArray[i,rowNumber]
rowNumber = rowNumber + 1
EndWhile
index = index + 1
endif
next
if numberOfTimesExsistsInArray > 0 then
return resultnew
else
for i = 0 to 15 ; number of items in array
resultnew[0,i] = "no results" ;[0,i] if there is no headers else [1,i]
next
return resultnew
endif
#endfunction
arrayList = ArrayFileGetCSV("C:\Users\DavidPeer\Desktop\EDR\CustSRVList.CSV", 0, ",", 0, 0)
originalArray = arrayList
maxIndexForList = ArrInfo(originalArray,1)-1
arrayForList = ArrDimension(maxIndexForList)
for i = 0 to maxIndexForList
arrayForList[i] = originalArray[i,1]
next
dlVariable1 = ArrayItemize(arrayForList, @tab)
#DEFINESUBROUTINE TimerProc(MyDialogHandle,MyDialogMessage,MyDialogControlID,MyDialogEventInfo,MyDialogChangeInfo)
Switch MyDialogMessage
Case @dePbPush
Case @deInit
DialogProcOptions(MyDialogHandle,@deEdText,@TRUE)
DialogProcOptions(MyDialogHandle,@deDlChange,@TRUE)
DialogControlSet(MyDialogHandle, "ReportView_1", @dcColWidth ,-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
DialogControlSet(MyDialogHandle, "ReportView_1", @dcContents ,originalArray)
DialogControlSet(MyDialogHandle, "ReportView_1", @dcColWidth ,-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
Return (@retdefault)
Case @deEdText
searcifrchTerm = DialogControlGet(MyDialogHandle, "EditBox_1", @dcText)
searchTerm = DialogControlGet(MyDialogHandle, "EditBox_1", @dcText)
resultnew = ArraySearchResults(originalArray, searchTerm, 1, @true)
;message("resultnew", ArrayToStr(resultnew))
DialogControlSet(MyDialogHandle, "ReportView_1", @dcContents ,resultnew)
;DialogControlSet(MyDialogHandle, "ReportView_1", @dcRemItem ,0)
Return(@retDefault)
case @deDlChange
searchTerm = DialogControlGet(MyDialogHandle, "DropListBox_1", @dcSelect)
resultnew = ArraySearchResults(originalArray, searchTerm, 1, @true)
DialogControlSet(MyDialogHandle, "ReportView_1", @dcContents ,resultnew)
maxIndexForList = ArrInfo(resultnew,1) -1
arrayForList = ArrDimension(maxIndexForList)
dlVariable1 = ""
for i = 0 to maxIndexForList
dlVariable1 = ItemInsert(resultnew[i,1], i, dlVariable1, @tab)
next
DialogControlSet(MyDialogHandle, "DropListBox_1", @dcContents ,dlVariable1)
DialogControlSet(MyDialogHandle, "DropListBox_1", @dcSelect,searchTerm)
;DialogControlState(MyDialogHandle,"ReportView_1", @dcsSetFocus , @true)
Return(@retDefault)
endswitch
#endsubroutine
TimerFormat=`WWWDLGED,6.2`
TimerCaption=`Timer Example`
TimerX=078
TimerY=129
TimerWidth=166
TimerHeight=276
TimerNumControls=005
TimerProcedure=`TimerProc`
TimerFont=`DEFAULT`
TimerTextColor=`DEFAULT`
TimerBackground=`DEFAULT,DEFAULT`
TimerConfig=0
TimerDPI=`96,8,16`
Timer001=`063,123,034,014,PUSHBUTTON,"PushButton_2",DEFAULT,"Cancel",0,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Timer002=`017,025,134,086,REPORTVIEW,"ReportView_1",arrayList,DEFAULT,DEFAULT,40,@csFirstHeader,DEFAULT,DEFAULT,DEFAULT`
Timer003=`035,007,102,012,EDITBOX,"EditBox_1",ebVariable1,"filter",DEFAULT,30,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Timer004=`013,157,138,114,DROPLISTBOX,"DropListBox_1",dlVariable1,"search",DEFAULT,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Timer005=`003,157,008,012,PUSHBUTTON,"PushButton_1",DEFAULT,"!",1,50,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
ButtonPushed=Dialog("Timer")
thanks
David