ComboBox Autocomplete


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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.

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
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.

Edhy Rijo

Attachments
AutoCompleteTest.zip (136 views, 123.00 KB)
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Fixed.  It will be in the next update.
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
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?

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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?
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
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.

Edhy Rijo

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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.
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
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

Edhy Rijo

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Glad that was it! BigGrin
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search