Forum Discussion

viola's avatar
12 years ago

How to click item in a Merged Ribbon?!

Hello,



I'm using DevExpress ribbon control(v11.2) and TestComplete (v8.7).

I loop through the controls and find my merged ribbon, but had no way to get a valid WinFormObject.

Thanks,

Viola



Sample code is as follows.


var ctrls = mdiMain.get_Controls();  

  for(i = 0; i < ctrls.Count; i++)

  {

    var item = ctrls.get_Item(i);      

    if(0 == aqString.Compare(item.ClrFullClassName, "DevExpress.XtraBars.Ribbon.RibbonControl", false))

    {

      if(item.MergedRibbon != null)

      {

        //var c = mdiMain.WinFormsObject(item.MergedRibbon.Name); <--- tried to use process, no luck either.

//c.ClickItem("New Page|ABC|My Button");

1 Reply

  • aqAnt's avatar
    aqAnt
    SmartBear Alumni (Retired)

    Hello viola,


    Here is the code that should work for you:




    var ribbons = mdiMain.FindAllChildren("ClrFullClassName", "DevExpress.XtraBars.Ribbon.RibbonControl", 5);  

    ribbons = (new VBArray(ribbons)).toArray();

      

    if (ribbons.length > 0)

    {

      for (i = 0; i < ribbons.length; i++)

      {      

        if (ribbons.get_IsMerged())

        {

           ribbons.ClickItem("New Page|ABC|My Button");

        }

      }

    }