Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TreeView
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Divers
Thread ID:
00188022
Message ID:
00188139
Vues:
20
As a follow up to Fred Taylor's advice, I normally a TreeView's SelectedItem as follow:

*-- The following will provide you with a public array called aTreeNodes
*-- which will contain the hierarchy of your TreeView. You can then
*-- have an idea what values you would like to remove.

IF !ISNULL( THISFORM.TreeView.SelectedItem )
m.lnTreeNodes = ListToArray( THISFORM.TreeView.SelectedItem.FullPath, "aTreeNodes", THISFORM.TreeView.PathSeparator )

ENDIF


*********************************
FUNCTION ListToArray( m.lcList, aArray, m.lcDelimiter )
*********************************
* This function takes a list string delimited by m.lcDelimiter and
* creates an array "aArray" of the values. Return value is the number
* of elements in the final array.
* ie: m.lnEntries = ListToArray( "1,2,3,4,5", "aMyArray", "," )
LOCAL m.lnDelimCount, x, m.lnStartPos, m.lnDelimPos,;
m.lnElements, m.lnEndPos, m.lnWidth

m.lnElements = 0
m.lnDelimCount = OCCURS( m.lcDelimiter, m.lcList )

IF !EMPTY( m.lcList )
PUBLIC &aArray
IF m.lnDelimCount == 0
m.lnElements = m.lnElements + 1
DIMENSION &aArray.[1,1]
&aArray.[1,1] = ALLTRIM(m.lcList)
ELSE
m.lnStartPos = 1
DIMENSION &aArray.[lnDelimCount+1,1]
FOR x = 1 TO m.lnDelimCount
m.lnElements = m.lnElements + 1
m.lnDelimPos = AT( m.lcDelimiter, m.lcList, x )
m.lnEndPos = IIF( m.lnDelimPos == 0, LEN( m.lcList ) + 1, m.lnDelimPos )
m.lnWidth = ( m.lnEndPos - m.lnStartPos )

m.lcValue = ALLTRIM(SUBSTR( m.lcList, m.lnStartPos, m.lnWidth ))
&aArray.[lnElements,1]=lcValue
m.lnStartPos = m.lnDelimPos + 1
ENDFOR
m.lnElements = m.lnElements + 1
&aArray.[lnElements,1]=ALLTRIM(SUBSTR( m.lcList, m.lnStartPos ))
ENDIF
ENDIF

RETURN( m.lnElements )

Best of Luck
Juan L. Romero
gcandela@javanet.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform