Ask a Question

Right Click on RCP List View

naveenchandravp
Occasional Contributor

Right Click on RCP List View

Hello All,

 

We have a desktop application built on top of RCP which uses SWT to draw its UI elements. We have noticed that the ClickItemR function of TestComplete which simulates a right-click does not work properly on the SWT Table UI element. It's inconsistent, it works sometimes and fails most of the time.

If there is any suggestion on how to properly simulate a right-click functionality on SWT Table element.

10 REPLIES 10
ebarbera
Staff

Hi @naveenchandravp - 

 

What types of messages are you getting in regard to the failures? It could be a timing issue if it is inconsistent - sometimes a delay or increasing the time in between steps can help to mitigate issues. But ill have a better idea to help if you can let me know what the failures are. 

 

Thanks, 

Emma

naveenchandravp
Occasional Contributor

@ebarbera Thank You for the quick response and apologies for not providing complete details.

 

Below is the error that I am getting

"Popup menu was not found for the "Aliases.DataExplorer.Shell2.Composite2.Composite.Composite.Composite.CTabFolder.ContributedPartRenderer_1.CTabFolder.StatisticsComposite.ListView" object. 0:50:36 Normal 11.22"

 

The Popup menu was not found because ClickItemR was not successful. 

 

I also tried using the ClickR function and provided proper x, y coordinates. Here too the app is inconsistent. It sometimes opens the context menu and sometimes doesnt.

I added a delay of 2000 ms in between each step. No luck

 

The version of TestComplete I am using: 14.93.312.7 (running on 64 bit)

 

Now when I was checking what's new on TestComplete 15.10 page, I see a comment about improved "click-related" actions. I will upgrade my installation and try. Meanwhile, if you have any suggestions I would be grateful.

Little disappointed as TestComplete 15.10 also fails to fix this problem. Same behavior. 

 

@ebarbera 

Can you please let me know if there is something that I need to do? Or you need more details around this topic.

 

Thanks,

Naveen

For anyone who is struggling with the same problem, I wrote a python script (which is just a workaround and not the desired way of opening the context menu on lists) which seems to be working for me.

 

def open_context_menu():
  arr = Sys.Process("<ProcessName>").FindAllChildren("WndClass", "SysListView32", 50)
  if len(arr) > 0:
    for i in range (0, len(arr)):
      if True == arr[i].Focused:
        arr[i].ClickR()
        Log.Message("Context Menu Opened Successfully!")
        break
  else:
    Log.Error("No List Objects were found.")

 

@ebarbera I would still like to hear from you if there is any better approach for this issue.

Hi @naveenchandravp - 

 

Apologies on the delayed response - we do have a document that outlines specific suggestions when working with listview items, maybe this will be of more help (https://support.smartbear.com/testcomplete/docs/app-objects/specific-tasks/standard/list-view/addres...). It is a bit tricky to diagnose the right click issue without having seen it I apologize but if I find out any additional information I will let you know. I will also pass along this information to product. 


Let me know if you have further questions. 

Emma

 

naveenchandravp
Occasional Contributor

@ebarbera Thanks for the response!

 

The page talks about the ClickItem function, which is working perfectly fine for me. My concern is w.r.t ClickItemR and ClickR functions which simulate right-click.

I understand it's difficult to suggest anything without actually being able to reproduce the problem. Will it help if I create a sample application and provide reproducable steps?

Hi @naveenchandravp  - 

 

Yes - this would be very helpful. 

 

The reason I suggested that document is because sometimes if one approach is not working with automation it is best to use a workaround. But if you are trying to validate the functionality of the right click specifically I understand your concern.

 

Thanks, 

Emma

chriscc
Occasional Contributor

Hi @naveenchandravp

 

The issue could be that there is more than one SysListView32 control. It could be on the same Form or maybe in memory and not visible. This could explain why you are seeing inconsistent results and why looping an array of list view controls seems to work. 

 

A couple of things you could try.

 

1. Narrow you search by specifying parameters that are unique to the control. For example, make sure it is visible.  Or if it has a unique index you could specify that.

 

Listview = Sys.Process("<ProcessName>").FindChild(new Array("WndClass","Visible", "Index") , new Array("SysListView32", true, 1), 50)

 

2. Get a parent object closer to the desired SystemListView32 object.

 

Parent = Sys.Process("<ProcessName>").FindChild(new Array("WndClass","Visible") , new Array("#32770", true), 50)

 

ListView = Parent.FindChild(new Array("WndClass","Visible", "Index") , new Array("SysListView32", true, 1), 50)

 

I hope this helps.

Chris
cancel
Showing results for 
Search instead for 
Did you mean: