ATAGINFO()

DisplayCount

At last! This property, added in VFP 6, lets you determine how many items show up when you open a combo box.

Usage

cboCombo.DisplayCount = nHowManyItems nHowManyItems = cboCombo.DisplayCount
By default, when you drop a combo open, seven items show up. If there are fewer than seven items in the list, of course, only that many show. If there are more than seven, you get scroll bars. DisplayCount lets you change all that. Well, actually, not all that—just the magic number.

Why would you want to change DisplayCount? We can think of a few reasons. When the number of items in a combo is large, seven just isn't very many to show at a time. (Of course, combos aren't meant for huge lists—asking a user to scroll through hundreds or thousands of items isn't very good interface design.)

Sometimes, you have a small, fixed list, with more than seven items in the list. Why should a user have to scroll when there are only nine or 10 choices? (Consider the drop-down for RowSourceType in the property sheet, for example.)

Finally, in situations where form real estate is scarce, you may want to limit the number of items that appear at once in order not to obscure some other fields while the user is choosing.

Apparently Microsoft liked DisplayCount in the language so much, they added a similar setting to the IDE in VFP 7. The IDE page of the Options dialog contains the "List Display Count" setting that determines how many items appear in dropdowns within VFP.

DisplayCount isn't choosy enough about what values it accepts. It'll let you specify 0 or a negative number. In VFP 6, in that case, it ignores you and just displays seven items. In VFP 7, setting DisplayCount negative displays the number of items you've set for List Display Count.

More seriously, when you make DisplayCount big, the list doesn't even show up when you drop the combo open. On Tamar's system, things start getting weird once DisplayCount gets over 50 and, by 130, the list doesn't even show up or appears way above the form. In between, there are some other weird behaviors. The moral of the story is to choose reasonable values for DisplayCount.

Example

ThisForm.cboChoices.DisplayCount = 12

See Also

ComboBox


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net