Forum Discussion

bgabriel's avatar
bgabriel
Occasional Contributor
12 months ago

Find method cache in TreeListControl

Hi, 

Problem description

I'm using test complete to test my WPF Application. I need to identify a row in a DevExpress.Xpf.Grid.TreeListControl using the field 'DisplayValue'. I'm currently using the .Find() method as follows:

<SPAN class="token punctuation">.</SPAN><SPAN class="token function">Find</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"DisplayText"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Single Elements"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token number">5</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token boolean">true</SPAN><SPAN class="token punctuation">)</SPAN>

After the app startup, everything works fine and the row can be found properly but when change is performed on the TreeListControl (for example a new row is added), the find function always returns the same object. Since the TreeListControl has changed, the row containing "Single Elements" no longer has the same RowControl index.

Screenshots illustrating the problem

Before the changes in the TreeListControl 

In this scenario, the RowControl containing the "Single Elements" is N°5 (see screenshot). The Find method returns an object which path contain a reference to RowControl N°5 as expected. Everything works fine.

After the changes in the TreeListControl

Now an element has been added to the TreeListControl. The "Single Elements" row has index N°6. The Find method still returns an object which path contain a reference to RowControl N°5. 

Question

  1. What can explain this behavior? 
  2. Is there a way to force the cached TreeListControl to be cleared? 

 

Thank you in advance !

 

  • Hi ! Sometimes the refresh parameter of the Find method doesn't work properly. In this case, I'm retrieving a parent object from the tree and specifically performing a refresh on that object. (this will refresh all child objects).

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    What version of TC are you using? What parameters are you passing to the Find() method?

  • eykxas's avatar
    eykxas
    Regular Contributor

    Hi ! Sometimes the refresh parameter of the Find method doesn't work properly. In this case, I'm retrieving a parent object from the tree and specifically performing a refresh on that object. (this will refresh all child objects).

  • bgabriel's avatar
    bgabriel
    Occasional Contributor

    Thanks for your reply, I also figured that this method was working. I wonder if the refresh attribute is meant to refresh the actual content of the object (data) or the mapping...

  • bgabriel's avatar
    bgabriel
    Occasional Contributor

    rraghvani

    TC version 15.59.7.7 x64

    The parameters I gave to the Find function are

    Find("DisplayText","Single Elements", 100, true);