Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A little listbox trickery
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00687505
Message ID:
00779279
Views:
58
Hi Steve

I noticed you are changing the second column of the list but it is the first column that controls the disabling of the item. Secondly the "\" is not actually stored in the listbox so when you check for "\" in the item it will not be found.

I was able to disable and enable a listbox item simply by doing:

Thisform.myList.List(1)="\Disabled"
Thisform.myList.List(1)="Enabled"

Or if I bound it to an array I could do the following:

Dimension gaArray(2,2)
goArray(1,1)="\D"
goArray(1,2)="Disabled"
goArray(2,1)="E"
goArray(2,2)="Enabled"
ThisForm.myList.Requery (Now the first item is disabled)

goArray(1,1)="D"
ThisForm.myList.Requery (Now the first item is enabled).

Regards,
Simon



ThisForm.list(1,1)="\D"
ThisForm


>Yes, here's some code...
>
>For List1.dblclick method (where fields are selected)
>******************************************************
>IF ! "\" $ thisform.list1.list(thisform.list1.listitemid,2)
> STORE thisform.list1.list(thisform.list1.ListItemId, 2) TO fld_out(thisform.sel_max+1)
> thisform.list1.picture(thisform.list1.ListIndex)= "c:\dev\a\check_sp2.bmp"
> thisform.list2.AddListItem(fld_out(thisform.sel_max+1))
> thisform.list1.list(thisform.list1.listitemid,2) = "\"+thisform.list1.list(thisform.list1.listitemid,2)
> thisform.sel_max = thisform.sel_max + 1
>ENDIF
>
>thisform.refresh
>******************************************************
>
>For List2.dblclick method
>******************************************************
>* DESELECT
>IF this.ListCount > 0
> * Get this item name and delete from array
> lcthisitem = thisform.list2.List(thisform.list2.ListItemId,1)
> lnTarget = ASCAN(fld_out, lcthisitem)
> ADEL(fld_out, lnTarget)
>
> * Remove from List2
> FOR i=1 TO thisform.list2.ListCount
> IF thisform.list2.list(i,1) = lcthisitem
> thisform.list2.RemoveListItem(i)
> ENDIF
> NEXT
> * Deselect in List1
> FOR i=1 TO thisform.list1.ListCount
> IF thisform.list1.list(i,2) = lcthisitem
> * Take out "\"
>******* Original attempt **** did not work ********
> thisform.list1.list(thisform.list1.listitemid,2) = SUBSTR(thisform.list1.list(thisform.list1.listitemid,2),2)
>
>**** Then I thought it might work like a toggle, so I added "\" again ****
>**** It did no good ***
>
>*!* thisform.list1.list(i,2) = "\"+thisform.list1.list(i,2)
> ENDIF
> NEXT
> thisform.sel_max = thisform.sel_max - 1
>
> thisform.refresh
>ENDIF
>***********************************************
>
>Thanks for looking at it for me! - Steve
Simon White
dCipher Computing
Previous
Reply
Map
View

Click here to load this message in the networking platform