ListView - GetCell() method
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ListView - GetCell() method
Hi,
I'm using TestComplete Version: 14.90.432.7 x64 with DelphIScript. The tested application is developed with C#.
Does anyone used GetCell method for a ListView control? The function format get it from Object Spy is: function GetCell(Framework.UI.HeaderItem; line : Integer; column : Integer; Framework.UI.ItemTextEventArgs; PrintContext : SystemString) : System.String;
While I did figured the first three parameters, for the last two(Framework.UI.ItemTextEventArgs; PrintContext : SystemString) I cannot see where can I find them, they are not straightforward methods within ListView Object Spy.
I can give you a clue from a similar method function for the same control, which is GetCellNumericValue(Framework.UI.HeaderItem; line : Integer; HeaderIndex: Integer; bWasException : ref System.Boolean) : Real; I have successfully used this one and indeed returns only a number: for instance, if you use it on a ListView column with strings, it will return value 0, while for a column with numbers, it return the number at the specified position within ListView's table.
A real example is this one: ListViewdObj.GetCellNumericValue(ListViewdObj.HeaderItems.Item[4],2,4,False);
Thank you.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
> or the last two [...] I cannot see where can I find them
Just a wild guess: what if you pass nil for these last two parameters?
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Any chance to talk to developers and ask them for the code sample in C# ?
Considering that the tested application in in C# and thus is accessible to TestComplete, I would expect that it will be possible to port their sample into DelphiScript.
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I did, Alex. The trouble is with the TextEventArgs parameter. For them is easy to define it with C#: they simply instantiate the class
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
> they simply instantiate the class ItemTextEventArgs tea = new ItemTextEventArgs();
Generally speaking, the same is possible in TestComplete:
-- You need to add the assembly that implements the ItemTextEventArgs class to the CLR Bridge as well as all required dependent assemblies;
-- After that in the code completion window under dotNET node you should see the assembly, class name, its constructor (named as .zctor() ) and all other public methods provided by the class.
Depending on your scripting language you should be able to write the code like this:
var iteaClass = dotNET.<assembly>.ItemTextEventArgs.zctor();
and use created class instance in your code.
See https://support.smartbear.com/testcomplete/docs/app-testing/desktop/net/creating-class-instances.htm... and related help topics for more details.
Hope this will help.
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've finally succeed. It took more than a month to figure out how is working: with Alex's last suggestions I've reached dotNET node. But even from dotNET node is not easy to get the instance of ItemTextEventArgs, using TestComplete manual (https://support.smartbear.com/testcomplete/docs/app-testing/desktop/net/creating-class-instances.htm... which doesn't work with my tested application.
So, what does saved me was TestComplete message error, which was clear stated that it cannot convert the variable I was using to type 'Framework.UI.ItemTextEventArgs'. Later and by chance, I found this instances under dotNET node.
So, this is how the function should look like:
SelectedCellText:=ListViewdObj.GetCell(ListViewdObj.HeaderItems.Item[columnNo],lineNo,columnNo,Sys.Process('YourApplication').AppDomain('YourApplication.exe').dotNET.Framework_UI.ItemTextEventArgs.zctor(),'Excel');
and it works for me(with Delphi script and TestComplete 14.91.341.7 x64).
Now, SelectedCellText will be an object and the cell value will be SelectedCellText.OleValue
Thank you!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you a lot for the update, detailed description and code sample provided!
Much appreciated indeed.
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
