SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    SQA Council
    Join Date
    Mar 2001
    Posts
    8,591
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Get all menus from a window dynamically

    User Christian Bartel (christian.bartel@gwi-ag.com.nospam) posted:

    Hi Group!

    Can WinRunner learn all new menupoints (mainmenu's, eg "File" not
    something like:

    set_window ("somewhere",10);

    *get_all_menus(menu)*
    for (in menu) do *get_submenus*
    for (in submenus) do *activate and check for errors*

    For the moment the script is working with datafiles containing the
    mainmenus... but this is sometimes a source of problems when the
    menustructure is changing and WinRunner is the last one to be informed about
    that :-)

    We tried "win_get_text" and "obj_get_text" and this seems to work
    *sometimes*... Actually it is not as reliable as we would like it to be.

    So, is there another way? With help of the GUI-Map?

    Thanks!

    Greeting,
    Christian Bartel


  2. #2
    Senior Member
    Join Date
    Jul 2001
    Posts
    216
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Get all menus from a window dynamically

    User misha (mm_ke@yahoo.com.nospam) posted:

    Hi Christian

    In answer to "can WR get the menus at runtime", yes, here is one
    way...

    # Get all menus belonging to a window
    set_window("Untitled - Notepad",0);
    i=0;
    do {
    mymenu="{class: menu_item, index: " & i & "}";

    # use _menu_get_desc() to avoid error message if menu not found
    rc=_menu_get_desc(mymenu,"class label parent
    count","","index",mydesc);

    if (rc != E_OK) break; # menu does not exist, so no more menus

    my_menu_list[i] = mydesc; # save to an array

    # if you want to add them to a GUI buffer here, you could use the
    GUI_desc ... functions
    # to just include the appropriate fields, ie. class label parent
    # and find the matching parent in the buffer
    # and select a logical name that won't overwrite any other object
    in the
    map.
    } while (++i);

    ##################

    # Example of Get only top level menus belonging to a window

    set_window("Untitled - Notepad",0);
    i=0;
    do {
    mymenu="{class: menu_item, index: " & i & "}";
    # use _menu_get_desc() to avoid error message if menu not found
    rc=_menu_get_desc(mymenu,"class label parent
    count","","index",mydesc);
    if (rc != E_OK) break; # menu does not exist, so no more menus
    GUI_desc_get_attr ( mydesc, "parent", parent );
    if (parent != "none") continue; # not interested in the kiddies
    my_top_menu_list[i] = mydesc; # store these top-level menus in an
    array
    GUI_desc_get_attr ( mydesc, "count", count );
    i += count; # skip over all the sub menus
    } while (++i);

    regards,
    Misha
    --- In winrunner@y..., Christian Bartel <christian.bartel@g...> wrote:
    perform
    informed about
    to be.



 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 12.50%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:52 AM.

Copyright BetaSoft Inc.