Forum Discussion

gentlesea's avatar
gentlesea
Frequent Contributor
14 years ago

Menu items are not displayed in log


I want to test whether a certain item is available in a context menu or not.



I used the following example which I took from the documentation in order to iterate through a context menu.





function MenuSample()

{

  Aliases.MainWnd.MenuBar.TrvwPlan.ClickItemR("|<IconDosePlan>The RTPlan|<TreatmentGroup_deselected>Group 1");





  var MainMenu = Aliases.MainWnd.MenuBar.TrvwPlan.PopupMenu; 





  // Defines the total number of main menu items

  var Count = MainMenu.Count;

  // Iterates through the menu items

  for (var i = 0; i < Count; i++)

  {

    // Obtains the menu item

    var Item = MainMenu.Items(i);

    // Posts the item caption to the test log

    Log.Message(Item.Caption);

  }







Something seems to be wrong with the context menu since I get the following log output:



Log.Message(Item.Caption); produces for each item 




Type Message Time Priority Has Picture Link

p? 12:13:38 Normal


See also screenshot. Does anyone have an idea what is going wrong here?

3 Replies

  • Hi,



    This seems to be specific to your menu, and we need more information on it. First of all, check whether the menu it owner-drawn. If it is, you may be unable to get captions of its items because their text is drawn on its canvas. If this is the case, you should be able to obtain captions of menu items via native properties and methods of the menu (as you'd do this inside your application).



    Also, in what programming language/IDE is your application developed and what menu control (name, vendor and version) is used in it?
  • gentlesea's avatar
    gentlesea
    Frequent Contributor
    How do I tell it is owner-drawn? It is a product of the company I work for. It is based on Microsoft Foundation Classes. The application is written in C++.
  • Hi,



    How do I tell it is owner-drawn?


    If your menu has images attached to items, it is probably owner-drawn. Also, it is probably owner-drawn because captions of items got via their Caption property are blank.

    Anyway, since you test an application of your company, you can ask your developers about it.



    To work with your control, you can also try applying suggestions from the Improving Object Recognition help topic.