Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Listbox question
Message
 
À
01/09/2000 22:10:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00408686
Message ID:
00412091
Vues:
41
Dave,
Thanks for the help. The "\" chr does not exist in the value. I guess it is just used as a flag and discarded. However, I used Replicate(chr(151),40) to create a line through the disabled lines so:

Case this.value = chr(151) .and. lastkey() = 24

does work. Thanks for the idea. This works only on input from the keyboard. Any ideas on the mouse? If not at least I'm better off than I was.

Thanks again,
John.

* ------------------------------------------------------------------------

>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
>>>
>>>>In 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.
Beer is proof that God loves man, and wants him to be happy. - Benjamin Franklin
John J. Henn
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform