Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selecting items in a listbox that are linked to a view
Message
From
14/12/2004 21:52:08
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00969180
Message ID:
00969327
Views:
9
>Hello,
>
>I have a listbox linked(control source) to a view which is a child view. The values getting populated in the listbox are stored in a lookup table and i'm doing this by seting the rowsource to fields in a lookup table, and the rowsource to fields. How do I get the items in the listbox to appear highlighted with the values that are in the view? The view contains two records, so I would like two separate items in the listbox to appear highlighted. Below is the code i'm using.
>
>lvCorrType is the child view i'm describing above. I'm looping through the items in the listbox and checking to see if the current list item is equal to the value in my view. I'm selecting that item in the listbox if they're equal. I placed this code in the page activate event. The funny thing is the two items appear highlighted if I trace through the code in the activate event and whenever I navigate to another page on my form and then go back to the page where the listbox is. Is the listbox not getting refreshed? Any idea on how I can get this to work whenever the page first loads? Any help would be greatly appreciated. I'll gladly clarify anything. Regards, Bradley Deetz
>
> SELECT lvCorrType
> =REQUERY("lvCorrType")
> FOR i = 1 to THISFORM.pgfCorrespondence.pagCorr.pgfCorr.pagCorrDoc.lstCorr.ListCount
> IF lvCorrType.ccorrcode == ALLTRIM (THISFORM.pgfCorrespondence.pagCorr.pgfCorr.pagCorrDoc.lstCorr.List(i))
>THISFORM.pgfCorrespondence.pagCorr.pgfCorr.pagCorrDoc.lstCorr.Selected[i] = .T.
> SKIP + 1
> IF EOF("lvCorrType")
> EXIT
> ENDIF
> ENDIF
> ENDFOR


Hi Bradley,

I'm not sure if this will help you. Usually I use SETFOCUS() before selecting multiple item that bounds to table. Try it
SELECT lvCorrType
=REQUERY("lvCorrType")

** set the focus to listbox
THISFORM.pgfCorrespondence.pagCorr.pgfCorr.pagCorrDoc.lstCorr.SETFOCUS()

FOR i = 1 to THISFORM.pgfCorrespondence.pagCorr.pgfCorr.pagCorrDoc.lstCorr.ListCount
     IF lvCorrType.ccorrcode == ALLTRIM(THISFORM.pgfCorrespondence.pagCorr.pgfCorr.pagCorrDoc.lstCorr.List(i))
THISFORM.pgfCorrespondence.pagCorr.pgfCorr.pagCorrDoc.lstCorr.Selected[i]  = .T.
       SKIP + 1
        IF EOF("lvCorrType")
           EXIT
         ENDIF
      ENDIF
ENDFOR
Hope it works
Regards
Herman
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform