Quantcast
Channel: Windows Desktop Development for Accessibility and Automation forum
Viewing all articles
Browse latest Browse all 585

What is the inteded logic of TreeWalker with condition?

$
0
0

I observe an illogical behavior of TreeWalker for filtered trees. Let us assume that we try to find all buttons in some application window using walker.  So we create a walker with the corresponding condition, something like:

VARIANT prop;
prop.vt = VT_I4;
prop.lVal = UIA_ButtonControlTypeId;
CComPtr<IUIAutomationCondition> type_condition_ptr;
automation_ptr->CreatePropertyCondition(UIA_ControlTypePropertyId, prop, &type_condition_ptr);

CComPtr<IUIAutomationTreeWalker> walker_ptr;
automation_ptr->CreateTreeWalker(type_condition_ptr, &walker_ptr);

And then walk the sub-tree for app's window (wnd_ptr):

IUIAutomationElement* child_ptr;
walker_ptr->GetFirstChildElement(wnd_ptr, &child_ptr);
while (child_ptr != NULL) {    walker_ptr->GetNextSiblingElement(child_ptr, &child_ptr);
}

On practice GetNextSiblingElement() returns not only buttons of wnd_ptr's subtree, but buttons from some other (not all) apps sub-trees.

It seems that the hierarchical structure of UI tree is not counted. Is that intended logic or bug? If it is the intended logicthen how to use the walker with the condition filter for sub-trees?



Viewing all articles
Browse latest Browse all 585

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>