Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determine if a Listbox item is Disabled?

Status
Not open for further replies.

vaxman9

Programmer
Feb 26, 2002
80
US
Good Morning all,

I have a listbox that I drag items out of and drop on another control. When the item is drop, I updated the listbox to disable the item by adding a '\' to the item in the Listbox. The item shows as disabled.

The problem I have is the disabled items is still "dragable", I can point my mouse at a disabled item in the list and still drag/drop it.

I can't seem to determine if an item is disabled in the listbox. Would anyone be able to enlightment me?

Thanks very much,
matt
 
If you mean determine visually, just make sure the DisabledItemBackColor and DisabledItemForeColor are different than the SelectedItemBackColor and SelectedItemForeColor.

Regards,
Jim
 
Why not remove the items once they've been dragged rather than disabling them?

Tamar
 
Jim,
I am looking for a way to programatically determine it so I can prevent the drag/drop from starting

Mike,
I just tried that and I am not getting the "/". I am testing in the OleStartDrag:
Code:
LPARAMETERS oDataObject, nEffect
ACTIVATE SCREEN 
?this.Value
?"   "+LEFT(this.Value,1)
All I get is the value and the left character of whatever value I point to start the drag operation. Doesn't matter if it is enabled or disabled.

Tamar,
The client wants to see all values in the list regardless as to whether they have been used or not.

Thanks,
Matt
VPF9 SP1
 
Another way to do is create another column in the list and do not show it on the screen. set the value to 1 means enables 0 menas disabled. update this column as you suffix \. so at drag time just act based on this new column value.

try it.


Nasib Kalsi
 
Nasib,

Thanks for the suggestion - that is how I ended up implementing the this behavior

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top