TestAdvantage 2007 Volume 1 for CLR 2.x, no patches
GUI built with NetAdvantage 2007 Volume 1 for CLR 2.x
QTP v10
I have a treeview that the following code works fine on only if the sNode is already visible in the treeview and not partially hidden by the rest of the GUI frames (in other words, there is no instantiated scrollbar in the treeview because all nodes are visible as-is):
However if I have a sNode with a long value the bound Treeview display area creates a scrollbar, so you can scroll to view the entire node name, this is normal behavior.
The problem is, the code above no longer works. I can see the scrollbar "budge" a little, but the node never gets selected. No errors are thrown.
If I update the code to this:
Then I can see the scrollbar moves a little bit more, however the node is still not selected.
Why can't the .Select method activate the node?
Any ideas or suggestions would be appreciated.
I have some workaround code in place, it's sloppy but it works, but I do not want to get stuck with this long term, and this especially could cause issues when trying to multi-select due to the keyboard interaction (could reset previously selected nodes):
Hi JHouse,
After extensive testing, and reviewing the code, I can see the bug in the code that caused this behavior. This has been corrected in TestAdvantage 2009 Volume 1 forward, but as they have been retired from service releases there is nothing that can be done for versions of TestAdvantage 2008 Volume 3 and prior.
In looking at your solution, that does appear to be the best viable workaround for this behavior. As to your concern about causing problems with multi-selection, you can workaround that with adding Ctrl or Ctrl + Shift to your type statement. Ctrl by itself to just add the activated node by itself, and ctrl shift to add the activated node and all those between it and the previously selected node. As demonstrated below.
Set tree = SwfWindow("Form1").SwfTreeView("ultraTree1")tree.ActivateNode "\V_48_NowweneedtomakeaverylongvaluestringvaluesothescrollbarsshowupthisisthatlongValue48"tree.Type(" ")tree.ActivateNode "\V_46_NowweneedtomakeaverylongvaluestringvaluesothescrollbarsshowupthisisthatlongValue46"tree.Type micCtrlDwn + " " + micCtrlUptree.ActivateNode "\V_40_NowweneedtomakeaverylongvaluestringvaluesothescrollbarsshowupthisisthatlongValue40"tree.Type micCtrlDwn + micShiftDwn +" " + micShiftUp + micCtrlUp