Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
List box: Distorted transfer from one to another
Message
De
28/02/2005 12:01:25
 
 
À
13/01/2005 06:03:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 8
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
00976674
Message ID:
00991235
Vues:
14
Dear Terry,

I know it's been ages since I got back to you, but I had a problem logging on to UT. Just sorted out the problem yesterday.

With regard to the code, being a multi-column list, I just was'nt able to get it right, without data being distorted between list boxes. Finally, this is the code I've created when one double-clicks on lstSelected (the listbox with selected records), to get the double-clicked selection back into lstsource.



**REFILLING NAME AND CLASS FIELDS INTO LSTSOURCE BY FIRST CREATING A CURSOR **FROM RECORDS PRESENTLY IN LSTSOURCE THEN CLEARING THE LSTSOURCE, AND THEN **FILLING THEM IN AGAIN!

WITH THIS.Parent
CREATE CURSOR curheadssource (name C(30), class C(3))
nlistnum=1
DO WHILE nlistnum <=.lstsource.listcount
.lstsource.listindex=nlistnum
.lstsource.BoundColumn=1
SELECT curheadssource
INSERT INTO Curheadssource (NAME) VALUES (.lstsource.value)
.lstsource.BoundColumn=2
repl Curheadssource.class with .lstsource.value
nlistnum=nlistnum+1
ENDDO
**Completing the cursor by adding the final item from
**lstselected (the one that was double-clicked)....IMPORTANT
INSERT INTO CURheadssource (NAME, class) VALUES (.lstSelected.List( this.listindex, 1), .lstSelected.List( this.listindex, 2))

** Adding the new list of records again to lstsource....
.lstsource.clear
SELECT curheadssource
nrowval=0
SCAN
.lstSource.AddItem(curheadssource.NAME)
NROWVAL=NROWVAL+1
.lstSource.AddListItem(curheadssource.class,nrowval,2)
ENDSCAN


This.RemoveItem(This.ListIndex)&&Removing the item that was selected in **lstselected
ENDWITH
Thisform.LockScreen=.f.


** LONG AND CUMBERSOME, BUT I'D LOVE TO WELCOME ANY EASiER SOLUTIONS.
** HOPE I'VE NOT BURDENED YOU!

WITH BEST REGARDS,

STEVE.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform