Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to disable the list item in list box or combobox
Message
 
 
To
26/03/1998 13:54:00
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00087403
Message ID:
00087495
Views:
29
Cindy,

We just had this little exchange over in the newsgroup.

Problems with using \ to disable items:

From Jim Nelson:
... and they WON'T be discernible in your code
... and you WON'T be able to change their status if you want to
... and disabled items may still be SELECTABLE using the keyboard

My reply:
First, I don't think I've ever put disabled items in a ListBox, if the user can't select it why show it in the list at all? And I'll admit the implementation in VFP could be cleaner, but all of the problems you mention can be fixed with a subclass.

You can discern the state if you use an array or a field that contains the \. The state can be changed by manipulation of the RowSource and calling the ListBox.Requery().

You can prevent keyboard access to disabled items with a little bit of code in the KeyPress (to track whether they are moving up or down the list) then in the
InteractiveChange methods can by finding the next appropriate enabled item and setting ListIndex.


>Hi, is there anybody can tell me how to disable the list item in the list box?
>
>Thanks!
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform