.Net textBox AutoCompleteMode (help)


#1

Hi.
I want to create rollout with 2 elements - textBox and Listbox with AutoComplete.
But I don’t know how to use AutoComplete property :banghead:
Here’s an example, but it’s don’t use autoComplete…
My question is : Can I use autoComplete in this case?

Thanks.
Sorry for my english.

(
ArrMod = for n in GeometryClass.classes where n.creatable collect n as string
rollout roll_type “” width:131 height:229
(
dotNetControl edt5 “System.Windows.Forms.TextBox” pos:[5,4] width:122 height:20
dotNetControl listMatch “System.Windows.Forms.listBox” pos:[5,30] width:122 height:200

on edt5 TextChanged txt do 
(
	ArrList = #()	
	for i in ArrMod do
		(	
		if	matchPattern i pattern: (edt5.text +"*") == true then appendIfUnique ArrList i \
		else listMatch.items.clear()  
		)
	sort ArrList
	roll_type.listMatch.items.AddRange  ArrList
	)

on roll_type open do 
	(
	for i = 1 to ArrMod.count do ArrMod[i][1] = toUpper ArrMod[i][1]
	roll_type.listMatch.items.AddRange  (sort ArrMod) 
	)
)
createdialog roll_type 
setfocus roll_type.edt5 

)


#2

short: yes
long:


on roll_type open do
(
	edt5.AutoCompleteMode = roll_type.edt5.AutoCompleteMode.SuggestAppend
	edt5.AutoCompleteSource = roll_type.edt5.AutoCompleteSource.CustomSource

	for i = 1 to ArrMod.count do ArrMod[i][1] = toUpper ArrMod[i][1]
	ArrMod = sort ArrMod

	listMatch.items.AddRange ArrMod
	edt5.AutoCompleteCustomSource.AddRange ArrMod
)


#3

:bounce:

Thanks!
Very simple and very cool :applause:


#4

simpler still might be to use a combobox, as that’s basically what you’re replicating :slight_smile: ( though you’d still have to set up the autocomplete source, etc. )


#5

Yes, you’re right… thanks again :thumbsup:


#6

How can I increase the autocomplete list height? It’s too small by default…
I’ve read .net help on microsoft site :deal: , but I’m not shure which property I have to use in this case…

Thanks


#7

not too sure you can - though I may be mistaken.

From what I’ve read, the .NET autocomplete functionality wraps IAutoComplete, which is not a .NET component itself and doesn’t expose much of anything.

You’d have to…
A. get down and dirty with the Win32 API
B. use a third party autocomplete component
C. write your own autocomplete (by adding a listbox control when the user starts typing, populating it with the appropriate strings based on what they’ve typed so far, and deleting that control when done).
D. live with the default height. The user -can- resize it, and it will remain that size until you no longer use the dialog.


#8

:slight_smile: thanks man

I already have my custom autocomplete function :wip: … just trying to use more .net abilities.
But I have a choice… it’s good.

Thanks again for the very fast reply.


#9

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.