Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List Box - Not showing old values no longer in the list
Message
From
14/04/2000 17:15:11
Jill Derickson
Software Specialties
Saipan, CNMI
 
 
To
14/04/2000 15:39:13
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00359714
Message ID:
00359895
Views:
10
I usually see on the UT that most people use ADDITEM to add values to lists...I've found using a cursor/view to be simpler, but maybe I'm missing some subtlety? (I use row source type ALIAS)

Then I can just fill my view/cusor w/the values I want the user to see.

If I understand your dicussion right, I handle a similar situation (using a combo, in my case). I might have a record, say a court case record, w/a foreign key pointing to JUDGE.DBF. In JUDGE.DBF there is an "active" flag...if active is .T., new records can choose the value. If active is .F., when adding a new record, the judge is not included in the combo. But, if an old record points to a judge who is not active, I need to show the value in the list.

So I create my cursor/view appropriately....when adding a record, the user just sees new values, they are all that are in the list. When modifying an old record, the user sees all active judges plus the single inactive for that record....I can check in the valid/interactive change/lost focus to warn the user/prevent the action when selecting the inactive judge.

HTH
J

>>Can this problem be solved...
>>
>>I have a list box : I need this because they can only select from the list items and not type a value in !
>>
>>But some of the old records have items that are no longer in the list.
>>When I open the form with this record the item is not shown in the list box. I am assuming because it is not found in the list anymore.
>>
>>Is there someway to show the old values yet still only allow the user select from the popup???
>>
>>Thanks!
>
>Tim,
>
>I have the same problem with combo lists here is my solution...
>(Is from one of my forms, so forgive me because I didn't change the alias names and also because I over comented, just to make it either clear or not so clear...). The list of available items is controled by another table called "schduler"
>
>
>*!* Set the control source for this combo
>THISFORM.pageframe1.page2.combo5.CONTROLSOURCE = 'dtable.attn'
>
>*!* Clear the content of the combo
>THIS.combo5.clear()
>
>*!* The currently available items are in this table
>SELECT SCHDULER
>
>AFIELDS(aSchedulers)
>
>*!* Create a cursor to hold items for the combo list
>CREATE CURSOR _TEMP FROM ARRAY aSchedulers
>
>*!* Select the available items
>SELECT sname;
>FROM SCHDULER;
>GROUP BY sname;
>INTO CURSOR _TEMP1
>
>*!* Select from the source table the items that may not be available anymore
>SELECT dtable.attn;
>FROM dtable;
>WHERE ALLTRIM(dtable.attn) NOT IN(SELECT _TEMP1.sname FROM _TEMP1);
>GROUP BY dtable.attn;
>INTO CURSOR _TEMP2
>
>*!* Filling the main cursor, first, with the available items
>SELECT _TEMP1
>
>SCAN
> INSERT INTO _TEMP (sname);
> VALUES (_TEMP1.sname)
>ENDSCAN
>
>*!* Select the other items that may not be available anymore
>*!* and add only if it is the actual value for the current record
>
>SELECT _TEMP2
>
>IF RECCOUNT() > 0
>
> SCAN
>
> IF ALLTRIM(dTable.attn) = ALLTRIM(_TEMP2.attn)
> INSERT INTO _TEMP(sname) ;
> VALUES (_TEMP2.attn)
> ENDIF
> ENDSCAN
>ENDIF
>
>*!* Add the items to the combo list
>SELECT _TEMP
>SCAN
> THIS.combo5.ADDITEM(ALLTRIM(_TEMP.sname))
>ENDSCAN
>
>
>*!* Get rid of the temp cursors
>
>SELECT _TEMP
>USE
>
>SELECT _TEMP1
>USE
>
>SELECT _TEMP2
>USE
>
>This combo is part of a pageframe, so I put it on the Activate method of the page where there in. To navigate they have to switch pages so this method is
>fired every time the user chages from record to record
>
>If you have a better solution, please let me know because, is also a problem that I have now.
>
>Cheers!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform