StrataFrame Forum

ComboBox Autocomplete

http://forum.strataframe.net/Topic18580.aspx

By Doug Birtell - 8/19/2008

I have multiple comboboxes on a winform that are bound to business objects.  It seems that no matter how I set the Autocomplete, or DropdownStyle, or BindingProperty, I get these results.

If I type very quickly, then the list narrows to the correct item,

If I type too slow, then the list always goes to the item that starts with the letter I just typed.

i.e.  If we were to use state abbreviations as an example...

If I type M, then the combobox will select ME. (the first of the M's)  If I was wanting the abbreviation MD, and I then slowly type a 'D' after the 'M', then the combobox goes to DE, not MD as I would expect.  HOWEVER ! ! ! IF I TYPE MD REALLY QUICKLY, then it works. 

Is there some type of event handler that I need to code to change the behavior to what I would expect?

Thanks!

Doug

By Dustin Taylor - 8/20/2008

How do you have yours set up? I did a quick test, and it seems to work for me. I have the autocomplete properties set as:

AutoCompleteMode: Append

AutoCompleteSource: ListItems

I used it for cities in the StrataFrame sample DB. If I type in "A" it suggests abingdon, if I wait several seconds and type in an "l" it switches to "albany".

How do you have your combo box set up currently?

By Doug Birtell - 8/20/2008

I have the settings as you do.  Also I have tried DropDownStyle property in all 3 configurations.

Is it possible that this component spawns a thread that has a timer on it that resets keyboard input after a certain period?

I guess my users will just have to learn to type fast. Smile

By Dustin Taylor - 8/20/2008

The autocomplete is actually basic .NET functionality that we just inherited, so I'm not sure exactly how they have it plumbed behind the scenes. My guess is that something in the way you are setting up the combo or selection items is getting in the way of the autocomplete.  It seems odd that you and I are experiencing different functionality with the same settings.

Check out the attatched test app. When it launches just point it to your StrataFrame Sample database and see if it the combo functions as you want it to.

By Doug Birtell - 8/20/2008

Dustin,

I ran your sample and yours works exactly as I want it to.  I looked at your settings, and as far as I can tell, there is no difference with the exception that I am using C# instead ov VB.

I am attaching a screen shot of my settings for your amusement.

also, while we're not on the subject, is there any way to have a SF maint form default to Add mode when it is first instantiated?  A couple of forms that I have created, the user will almost always want to add new data via the form, and they do not want to have to click "New".  I know.... I know... users....  but what do you do with them...??

Thanks !

Doug

By Edhy Rijo - 8/20/2008

Hi Dough,

Thake a look at the sample posted by Greg here http://forum.strataframe.net/FindPost12693.aspx which has many of the things you are asking for.

By Edhy Rijo - 12/10/2008

Dustin,

I am having a problem with a combobox and the TabOrderController, when the combo has the following properties setup as follow:

AutoCompleteMode: Append or SuggestAppend

AutoCompleteSource: ListItems

If you try to tab to the next control, then the cursor will not move from the combobox object, if those properties are set to None, then the tab order works as expected.

By Greg McGuffey - 12/10/2008

Maybe in those cases you have use the Enter key? Just a guess...
By Edhy Rijo - 12/11/2008

Hi Greg,

Sorry, but basically you can not move focus with the keyboard.  I modified Dustin's sample to include a TabOrderController to show the problem. 

By Trent L. Taylor - 12/11/2008

We'll take a look a this, but it sounds kindof fishy.  This should not have an impact on the tab controller.
By Edhy Rijo - 12/15/2008

Trent, Dustin,

No mean to rush you, but when you have a chance, see if you can at least duplicate this with the sample I posted.

I have one of those customer which noticed this problem and it is missing the "Tab" functionality in this case and is driving me nuts w00t

Of course this is not a show stopper since he can still use the mouse to jump out of the combobox Tongue

By Trent L. Taylor - 12/16/2008

Got it and reproduced it.  I will add this to the list.  Thanks.
By Edhy Rijo - 1/19/2009

Hi Trent,

Have you find a fix for this one?

By Trent L. Taylor - 1/20/2009

Not yet.  I have it on my "cut sheet" but have not worked through this yet.  I plan on getting to this before releasing the final update of the 1.6.7 build.
By Edhy Rijo - 1/21/2009

Thanks for the info.
By Edhy Rijo - 3/30/2009

Trent L. Taylor (01/20/2009)
Not yet. I have it on my "cut sheet" but have not worked through this yet. I plan on getting to this before releasing thefinal update of the 1.6.7 build.




Hi Trent,

Is there any work around fix to this issue? I have a customer waiting for this and using Tab is very important for him since they do a lot of data entry all day and from time to time he comes back to me asking for a fix.
By Trent L. Taylor - 3/31/2009

Sorry...this had a low priority since it was only documented in one instance.  I will try to get to this soon.  Thanks.
By Edhy Rijo - 4/1/2009

Thanks.
By Edhy Rijo - 4/25/2009

Trent,



FYI, setting the TabOrderController.EnterAdvances = True, allow the end user to move from field to field as the Tab should.

I really like this control as there is more developer control to handle the TabOrder and would really like to see this fix so I can use this control in all my projects.
By Edhy Rijo - 4/26/2009

Forgot to mention that the problem is also happening with SF Textboxes using the AutoComplete feature.
By Trent L. Taylor - 4/27/2009

Edhy,

I just set up a test and it worked.  So you may need to produce a sample showing me what your issue is.  I set this up using SF textboxes with AutoComplete turned on, so you are going to need to give me more in-depth details to reproduce.  Ideally it would be nice to just fire up a sample that shows me what your issue is.  Thanks.

By Edhy Rijo - 4/27/2009

Hi Trent,

Here is the sample posted by Dustin before, I modified to include an SF TextBox with AutoComplete. To see the problem, just try to tab between the 2 fields, and you will see (hopefully) that nothing will happen, now if you press "Enter" then the cursor will move back and forth the 2 fields as the Tab should also do.



I am using the latest posted beta.
By Trent L. Taylor - 4/29/2009

Fixed.  It will be in the next update.
By Edhy Rijo - 4/29/2009

Thanks Trent.



On a similar subject, I have a combo that in some cases will only have 2 items, the one added by the TopMost feature and one from the database, I would like to by code, autoselect the one item from the database to be shown in the combo so the user does not have to click the combo to select the only item available, how can this be done?
By Trent L. Taylor - 4/29/2009

Well, first you would just need to bind the combo to the BO.  Next, why can't you just set the default value of the field that will be bound?
By Edhy Rijo - 4/29/2009

Trent L. Taylor (04/29/2009)
Well, first you would just need to bind the combo to the BO. Next, why can't you just set the default value of the field that will be bound?


Let me try to explain myself better.

The combobox is bounded to the BO and it is being filled with records, all that is working fine, but in this case a record must be selected, and when there is only one record I want to show that record in the combobox instead of having the user to dropdown the combo and select the only available record.

I can not use the default value since I don't know the PK of the record being filled in the combobox.



I know I have to add code to check the listview.items.count taking into consideration the "TopMost" item added automatically, but I don't know how to reference the records in the combobox to do the count and then show or select the only item in the list if there is only one item.
By Greg McGuffey - 4/29/2009

I'm not exactly which event you'd use (parent form loading maybe), but here is how you'd figure out if the combo has only one choice, then select that choice:



'-- This determines the count of items that would be in the

'combo if there are NO items from the db. Note that the

'initialization to zero is for clarity...integers are

'initialized to zero automatically.

Dim zeroDbItemCount As Integer = 0

If Me.cboSample.TopMostItem IsNot Nothing Then

zeroDbItemCount = 1

End If



'-- If the combo has only one db item, select this item.

'Note that we need exactly one more item than our zero count.

If Me.cboSample.Items.Count = zeroDbItemCount + 1 Then

'-- This is kind of lazy, reusing the zeroDbItemCount as the index, but

'this count will also be the actual index of the first db

'item. I.e. if there is no top most item, the first db item has

'an index of zero. If there is a top most item, the first db item

'has an index of 1.

Me.cboSample.SelectedItem = Me.cboSample.Items(zeroDbItemCount)

End If




I just typed this in, so I may have made some typing mistakes, but this should get you going.
By Edhy Rijo - 4/29/2009

Hi Greg,



Thanks a lot, that is exactly what I was looking for. I tested it and it works just great!, very simple coding. w00t
By Greg McGuffey - 4/29/2009

Glad that was it! BigGrin