Questions about usage of the system and tools

Auto-completion Widget

Postby jamesengel » 20. Dec 2008, 18:53

I asked the question (via the http://www.exept.de->Company->Contact page): Is there was a widget for auto-completion since that functionality seems to be very popular these days. I received the following reply:


(correct me if I am wrong) autocomplete means, that after every keystroke, some callBack action is to be invoked to validate the existing input and find a good match.
Alternatively, you could also think of some pull-down combo list, which provides a selectable list of best-matches on demand (i.e. when pulled).

For the first, you either need an inputField and enable its "immediate accept" mode (either in the UI painter, or programmatically). In this mode, the model's value will be updated with every keystroke (or, if the

field has no model but a callBack action, that will be called for every key). This is in contrast to the normal input field operation, where the

model is only updated when field looses its focus, or the TAB or CR key is pressed. Of course, you have to take appropriate actions in that callback or when the model changes. I admit, that this may be so common,

that it may be worth an extra subclass of InputField, which defines this

as a common reusable framework...

The second aproach would use a ComboView with a dynamic menu. That means

that the pulled menu is not predetermined, but generated on-the-fly when

the menu is pulled. The easiest to do this is by giving a block as the list-model of the comboBox. This block should invoke a method from your application which generates the matchlist depending on the current contents of the inputField. This also looks like it is worth a reusable framework, which might be useful to others.

I am sorry, that we do not have something which works out-of-the-box.
But have a look at the FileBrowserV2's filename entry field. That should

work similar to what I described above.

Best regards,
Claus
jamesengel
 
Posts: 1
Joined: 15. Dec 2008, 17:41

Re: Auto-completion Widget

Postby bell22 » 20. Jan 2010, 06:49

Thanks. I've been looking to find out how to do this either. Never found the best answer though... :(
bell22
 
Posts: 1
Joined: 19. Jan 2010, 08:24

Re: Auto-completion Widget

Postby sthome12 » 23. Jan 2010, 10:06

Me too, I'm trying to see if how I can do this with my project, too.
Auto-completion form is a very important tool in a website, and I'm needing it badly.
sthome12
 
Posts: 1
Joined: 21. Jan 2010, 18:57

Re: Auto-completion Widget

Postby jan_vrany » 10. Feb 2010, 09:30

Hi, I've implemented my own "EditFieldWithCompletion" class. You may find it at:

http://smalltalk.felk.cvut.cz/svn/stx/libtool/branches/jv/EditFieldWithCompletion.st (the view itself)
http://smalltalk.felk.cvut.cz/svn/stx/libtool/branches/jv/EditFieldWithCompletionSpec.st (the spec class)

It popups a list with possible completions whenever a key is pressed. Maybe you find it usefull.
I'm using it in my systembrowser field - it's not prefect, some fancy icon support is missing, but
usable.
jan_vrany
 
Posts: 28
Joined: 10. Dec 2008, 12:37


Return to General Help

Users browsing this forum: No registered users and 1 guest

Design by GB