TopMostItem in Comboboxes


Author
Message
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, I am seeing a display problem with the combobox as expressed by Greg McGuffey on Posted 11/16/2006  in this post http://forum.strataframe.net/FindPost4549.aspx

Greg McGuffey (11/16/2006)
Again, the situation is that I've a bound combobox, with the list being filled via a BO. If the BO the combo is bound to is empty, the first item in the list is selected initially.

I have been playing with the TopMostItem, but the combo does not show the TopMostDescription when navigating through the records (ex, Next, prior, etc.) unless I put code to Requery the combo in the BO.Navigated event which makes no sense if you have to do it in all your forms for all your comboboxes.

Also, when selecting the TopMostItem as a valid option in the combo and trying to save will generate an error due to the value of the TopMostValue either -1 or 0.

In my Case I am binding the combo to an Integer field and have the following values in the TopMostItem: [Select a Company],0 or  [Select a Company],-1

What am I doing wrong here?

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
Really the TopMostItem works best when dealing with a DropDownList.  The reason that your value is not being set it probably because your BindingProperty is Text instead of SelectedValue or the value to which the item is currently bound does not match the value you supplied in the TopMostValue.
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,

I put together another video so you can see the problem in action:

http://www.progytech.com/videos/TopMostItem\TopMostItem.html

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
Edhy, you have a topmost value of a -1, is that what the value in the database is?  If not, then it will not select that item. 
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/23/2008)
Edhy, you have a topmost value of a -1, is that what the value in the database is?  If not, then it will not select that item. 

Trent, the problem is when going to the next parent record and there is no record in the child BO, the combo will always show the last selected value and it is shown in the video.

In my case all the tables I use that will be shown in a combo are Integer type, and -1 or 0 are not valid values, so here is where I get confused on what value to use in the TopMostValue property.

In VFP this problem does not exist, if there is not value selected in the combo it will be shown as blank.  Now I thought the TopMostItem feature would just show the TopMostDescription in the combo when not value has been selected by the user, so I am definitely missing something here. Doze

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
Edhy,

I have this very same scenerio setup hundreds of times.  You are missing one of the following items:

  1. The record bound to the combo does not have a value of -1.  All the topmost item does is create another record to which can be bound at the top of the combo.  So more than likely your default value should be 0, not -1.  But regardless, it has to be a value to which can be bound.  If 0 or -1 are not valid values, great.  When a new record is created, set the default value to a -1 (it should already be a 0 by default), and then it would line up and still require a selection.
  2. You do not have the BindingProperty correctly assigned. (i.e. binding to Text and expected the SelectedValue to line up).
  3. Don't have the control bound at all.
  4. Have provided an illegal value in the TopMostValue

That is basics wraps it up.  I know that you have to have one of these scenarios going on.

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 for the clarification, will check my settings again.

Just out of curiosity, did you take a look at my video? http://www.progytech.com/videos/TopMostItem/TopMostItem.html

Besides the problem with the TopMostItem, there is also the problem when navigating the parent record and having a combo on a child in the same form and this does not update correctly or blank out its display value if there is not child record in the BO.

Any comments on this one?

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
Yes, I looked at the video.  It was kindof hard to see the detail as it was somewhat small, but I paid no attention to anything past the combo issue you were talking about.  As far as navigation, this is generally a pretty straight forward thing and the only time I start to see developers with "funny behavior" is when adding logic in the Navigated and Navigating events or using the IncludeIn properties on the form and BO which can be setup in a multitude of ways which can impact behavior.
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