Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
List box: Distorted transfer from one to another
Message
De
01/03/2005 05:38:06
 
 
À
28/02/2005 12:01:25
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:
00991483
Vues:
19
Hi Steve

Hmmm, it does all look a trifle long and involved. Don't know what to say really. I populate MY lists from arrays that have been compiled from SQLing the data. I include an example below in case that may help. FYI there are 2 lists: Source = all geographical zones not yet grouped together; Selected = all zones already allocated to the zone group selected at the form level. Note that the moverlist is in its own container, on page 2 of a paged form:
LOCAL	I, lnLenSource, lnLenDest, lcFilter

If Not thisform.lListCompiled  && flag to say if already done THIS SQL
    Set Cursor off
    WITH THISFORM 
      .LockScreen	= .T.
      Store 0 to lnLenSource, lnLenDest
      DIMENSION .aZones( 1, 2), .aZonesInGroup( 1, 2)
      set exact on
      Store "" to .aZones, .aZonesInGroup

*     Compile array of all Zone IDs and Descs not already allocated to this group
*     ___________________________________________________________________________
      Wait WINDOW "Compiling list of Zones not in Group " + thisform.cGroupCode + "..." NOWAIT NOCLEAR
      With .pgfMainPageFrame.Page2.cntMoverList
        .lstSource.Clear
        .lstSelected.Clear
        .Refresh()
      Endwith 
      SELECT   DISTINCT ALLTRIM( STR( ALLZONES.ZONE)), ALLZONES.DESC ;
	FROM  MCLMPFAC!ALLZONES ;
	INTO ARRAY .aZones ;
         WHERE ... blah blah blah
      If not EMPTY( .aZones(1,1))
	  lnLenSource = ALEN( .aZones, 1)	&& How many rows in array
      Endif

*     Populate Mover list source from array
*     _____________________________________
      With .pgfMainPageFrame.Page2.cntMoverList.lstSource
        For I = 1 to lnLenSource
          .AddListItem( thisform.aZones( I, 1), I, 1)
          .AddListItem( thisform.aZones( I, 2), I, 2)
        EndFor
        .SelectedID( 1) = .T.
        .Refresh
      EndWith

      Wait WINDOW "Compiling list of Zones in Group " + .cGroupCode + "..." NOWAIT NOCLEAR

*     Compile array of all Zone IDs and Descs already allocated to current Group
*     ___________________________________________________________
      SELECT DISTINCT ALLTRIM( STR(ALLZONES.ZONE)), ALLZONES.DESC ;
        FROM 	MCLMPFAC!ALLZONES, MCLMPFAC!ZONEGRPZ;
        INTO ARRAY	.aZonesInGroup ;
        WHERE ...
      If not EMPTY( .aZonesInGroup(1,1))
          lnLenDest = ALEN( .aZonesInGroup, 1)		&& How many els in array
      Endif

*     Populate Mover list Dest from array
*     ___________________________________
      With .pgfMainPageFrame.Page2.cntMoverList.lstSelected
        For I = 1 to lnLenDest
          If not EMPTY( Thisform.aZonesInGroup( I, 1))
              .AddListItem( Thisform.aZonesInGroup( I, 1), I, 1)
	     .AddListItem( Thisform.aZonesInGroup( I, 2), I, 2)
          EndIf not EMPTY()
        EndFor
        .SelectedID( 1) 	= .T.
        .Refresh
      Endwith
      This.Refresh()
      .LockScreen		= .F.
      .lListCompiled	= .T.
    ENDWITH   && THISFORM
Endif 
From here you should be able to use the "move" events that I posted last time.
Let me know if this is of any use, huh? Good luck

Terry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform