Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Jump to a specific node in a treeview and expand it
Message
 
À
23/10/2003 09:03:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00841352
Message ID:
00841619
Vues:
43
Its good to see you tricking the treeview:-). The is a download #16575 that has sourced some of the suff you are working through. If you can use actual key field data for your node keys, it seems to make it easier to point back and forth. For example, you select a grid row, use the the key fields in that row to "select" a tree node. Or - the reverse - you select a tree node, use the nodes key value to point to a row in the grid.

An issue with node's text is that two nodes may have the same string in their text - but - only one [uniquie] string can be applied as a node's key.


>That was it, thanks!
>Tracy
>
>>>If my treeview's node.text = "1MHG" and the node.key= < some specific key > , how do I programmatically jump to that node in the treeview, select it, and expand it?
>>
>>* To Jump to and expand
>>if type('oTV.Nodes(cSomeSpecificKey).key')=="C"
>>   * The node with cSomeSpecificKey exists in oTV
>>   if oTV.Nodes(cSomeSpecificKey).text="1MHG"
>>     * cSomeSpecificKey has the required text.
>>      oTV.Nodes(cSomeSpecificKey).Selected=.t. && This should expand it
>>      *!*oTV.SelectedItem.Expanded=.t. && IF it needs to be assured
>>   else
>>   endif &&oTV.Nodes.(cSomeSpecificKey).text="1MHG"
>>endif &&type('oTV.Nodes(cSomeSpecificKey).key')=="C"
>>
>>
>>>
>>>Here is where I populate the treeview. Ideally, I would go ahead and expand the 1MHG node when it is created below:
>>>
>>>
>>>THIS.oletreeview.nodes.clear()
>>>WITH THIS.oletreeview.nodes
>>>	.ADD(,tvwFirst,'File_Name'+'_'+'0000',thisform.Al3_file)
>>>	.ADD('File_Name'+'_'+'0000',tvwChild,'Message1'+'_'+'0000','Message(1)')
>>>	SELE Al3Parnt
>>>	SET ORDER TO 0
>>>	SCAN
>>>		DO CASE
>>>		CASE Al3Parnt.cself = "1MHG"			&& message header
>>>			.ADD('Message1'+'_'+'0000',tvwChild,al3parnt.ckey,TRIM(al3Parnt.cSelf))
>>>                        *Now expand the 1MHG Node somehow
>>>		CASE Al3Parnt.cself = "2TRG"			&& new transaction
>>>			.ADD('Message1'+'_'+'0000',tvwChild,'2TRG'+'_'+SEQ,'Transaction('+ALLTRIM(STR(al3Parnt.ntran))+')')
>>>		CASE Al3Parnt.cself = "3MTG"			&& message Trailer
>>>			.ADD('Message1'+'_'+'0000',tvwChild,al3parnt.ckey,LEFT(TRIM(al3Parnt.cSelf),4))
>>>		CASE Al3Parnt.cPARENT = "A0"          &&  this record's parent 'branch' A0 is always top level branch
>>>			.ADD('2TRG'+'_'+SEQ,tvwChild,al3parnt.ckey,TRIM(Al3Parnt.label))
>>>		OTHERWISE
>>>			.ADD(Al3Parnt.cp_id, tvwChild, ;
>>>				al3Parnt.ckey,TRIM(Al3Parnt.label))
>>>		ENDCASE
>>>	ENDSCAN
>>>ENDWITH
>>>
>>>
>>>
>>>TIA,
>>>Tracy
Imagination is more important than knowledge
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform