[Project_owners] Textbox with custom autocomplete
David Murray
lid2000 at aanet.com.au
Sat Feb 3 02:23:04 PST 2007
I have attempted to write an XPCOM component in JavaScript that would
pass the string to search for to an external function and get a result
from that, so it'd be reusable for other stuff, but XPCOM is way out of
my depth, and I really don't know what I'm doing. I was using
http://lxr.mozilla.org/mozilla/source/extensions/cck/prefAutoCompleteService.js
as as my base to work from.
Unfortunately, I am way, way out of my depth when it comes to actually
creating components, so I didn't really get anywhere. I was trying to
create an object that would implement the autocomplete interface, but
contain an extra function that could be mapped to a function in the
regular JavaScript code, so that you could create an autocomplete box
that'd search through anything you want (so long as the results were
returned as an array). I wrote it all, but couldn't figure out how to
make a mappable function or anything, so I gave up.
I don't understand why all the autocomplete stuff has to be so
incredibly complex for a relatively simple effect. If anyone looking for
something to do could create some sort of custom XPCOM component for
searching, I'm sure it wouldn't be just me that'd find it useful.
For now though, I'm giving up and will resort to either an editable
menulist, or try and put a tree inside a popup and try and fake an
autocomplete textbox.
David.
David Murray wrote:
> Wait, nevermind, I'm still stuck. If anyone's got a custom autocomplete
> box working in Firefox 2, please point me to your code.
>
> David Murray wrote:
>> Whoops, nevermind - I found Neil's post from 2005 and it's what I'm
>> after. Thanks!
>>
>> David Murray wrote:
>>> So I've got an autocomplete textbox, and I wish for it to have a
>>> drop-down under it that contains all the values in the array that
>>> match what has currently been typed. Seems simple enough, right?
>>> Unfortunately I can't figure out how to get the autocomplete to
>>> actually... autocomplete. According to the internets, I need to
>>> create a custom autocomplete search component, which is where I'm
>>> stuck. There appears to be no documentation whatsoever anywhere on
>>> making custom autocomplete search objects - all the autocomplete
>>> examples just say "yeah stick 'history' in here and it'll search
>>> history, and that is where this documentation ends." Any questions
>>> that I have found previously asked on the net have no useful replies.
>>> Surely someone has tried to do a custom search before?
>>>
>>> David.
More information about the Project_owners
mailing list