Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Listbox question
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00408686
Message ID:
00412043
Views:
39
Try this:
PUBLIC oForm1
PUBLIC LASTKEY
oForm1 = CREAT([oForm])
oForm1.SHOW

DEFINE CLASS oForm AS FORM
	ADD OBJECT oList1 AS oList
	ADD OBJECT oButton1 AS oButton
ENDDEFINE

DEFINE CLASS oList AS LISTBOX
	ROWSOURCE = [1,2,3,4,5,6,7,8,9]
	ROWSOURCETYPE = 1
	PROC KEYPRESS
	LPARAMETERS nKeyCode, nShiftAltCtrl
	DO CASE
	CASE nKeyCode = 5
		LASTKEY  = 5
	CASE nKeyCode = 24
		LASTKEY  = 24
	ENDCASE
ENDPROC
	PROC INTERACTIVECHANGE
	DO CASE
	CASE OCCURS([\] + THIS.VALUE, THIS.ROWSOURCE) > 0 AND LASTKEY = 24
		KEYB [{DNARROW}]
	CASE OCCURS([\] + THIS.VALUE, THIS.ROWSOURCE) > 0 AND LASTKEY = 5
		KEYB [{UPARROW}]
	ENDCASE
ENDPROC
ENDDEFINE

DEFINE CLASS oButton AS COMMANDBUTTON
	CAPTION = [Disable List Item]
	LEFT = 100
	PROC CLICK
	IF isblank(THISFORM.oList1.VALUE)
		MESSAGEBOX([Select an item in the List that you want to disable.])
	ELSE
		THISFORM.oList1.ROWSOURCE = STRTRAN(THISFORM.oList1.ROWSOURCE, THISFORM.oList1.VALUE, [\] + THISFORM.oList1.VALUE)
	ENDIF
ENDPROC
ENDDEFINE
Dave



>Dave,
> I don't think it's documented very well if at all but you can disable a line on a listbox the same way as in a popup. Put a "\" as the very 1st character on the line. ie:
>Thisform.lstDates.AddListItem('\ this line is disabled',1,1)
>
>Hope this helps,
>John.
>
>
>>How are you disabling list items?
>>
>>Dave
>>
>>>I DOS if you disabled a bar in a popup, that bar would not get focus. In VFP the Listbox has taken the place of the popup for the most part but if you disable a line in the listbox it can still get focus.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform