SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Jan 2002
    Location
    UK
    Posts
    108
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Detecting Accelerator Keys in Menus

    Is there any way to tell what the Accelerator key (the underlined letter) is for a menu item?

    ------------------

  2. #2
    Senior Member
    Join Date
    Jan 2002
    Location
    UK
    Posts
    108
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Detecting Accelerator Keys in Menus

    Yes there is.

    Use MSAA for * then
    ...I'm getting my chequebook out now...


    ------------------

  3. #3
    Senior Member
    Join Date
    May 2002
    Location
    Las Vegas, NV, USA
    Posts
    499
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Detecting Accelerator Keys in Menus

    Hi,

    Yes, this is possible: you can read the caption of a menu item and find the position where the ampersand ('&') is in the caption. The next symbol is the one you need.

    ------------------
    Regards,
    Bobby Edgar
    AutomatedQA
    Regards,
    Bobby Edgar
    Olagoo.com
    Save on AutomatedQA Products

  4. #4
    Senior Member
    Join Date
    Jan 2002
    Location
    UK
    Posts
    108
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Detecting Accelerator Keys in Menus

    Is it just me? - I'm not seeing the ampersand at all - going via .MainMenu.Items[0].Caption - I'm using XP Pro with menu underlining switched on.

    One thing I noticed about the MSAA option is that AChild properties are not recognised at run-time unless they have been expanded previously in the Object Browser. Is there a way around this?

    This seems to be much harder than it ought to be, am I missing something obvious?

    ------------------

  5. #5
    Senior Member
    Join Date
    May 2002
    Location
    Las Vegas, NV, USA
    Posts
    499
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Detecting Accelerator Keys in Menus

    Hi,

    >>
    Is it just me? - I'm not seeing the ampersand at all - going via .MainMenu.Items[0].Caption - I'm using XP Pro with menu underlining switched on.
    <<
    This is possible for Open Applications, sorry for not pointing this out. For example, the instruction below will return a string containing an ampersand (Form1 is an object of a Delphi Open Application):
    Form1.MainMenu1.MenuItem.Items[0].Caption

    It is not possible for black box applications: TestComplete ignores ampersand in order to simplify the users scripts. Could you please tell me why you need this ability?

    >>
    One thing I noticed about the MSAA option is that AChild properties are not recognised at run-time unless they have been expanded previously in the Object Browser. Is there a way around this?
    <<
    The behavior you described is incorrect. Could you give us more details so that we can reproduce it?

    ------------------
    Regards,
    Bobby Edgar
    AutomatedQA
    Regards,
    Bobby Edgar
    Olagoo.com
    Save on AutomatedQA Products

  6. #6
    Senior Member
    Join Date
    Jan 2002
    Location
    UK
    Posts
    108
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Detecting Accelerator Keys in Menus

    I'm trying to write a test to make sure each menu item that needs one has a shortcut key.

    With the MSAA thing, an example is the application has a File menu. MSAA reports the File menu keyboard shortcut as
    w.mb_Application.AChild[0].KeyboardShortcut
    This always works and I can freely change the AChild index for each top-level menu.

    The problem occurs when I try to access menu items. The keyboard shortcut for the New item in the File menu is reported by MSAA as
    w.mb_Application.AChild[0].AChild[0].AChild[0].KeyboardShortcut.
    This only works if I have manually drilled down through the AChild IDispatch interfaces in the Object Browser. If I close the TestComplete session and reopen it, the test will not run, erroring with Unknown name Achild and Unknown name KeyboardShortcut.

    I'm probably using a sledgehammer to crack a nut, but I'm intrigued now - how do I activate the IDispatch interfaces at run-time?


    ------------------


    [This message has been edited by bughunta (edited 04-08-2003).]

  7. #7
    Senior Member
    Join Date
    Jan 2002
    Location
    UK
    Posts
    108
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Detecting Accelerator Keys in Menus

    OK, I've worked it out now.

    If I replace the Achild property in the above script with the Child method, it works fine.

    ------------------


    [This message has been edited by bughunta (edited 04-08-2003).]

 

 

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 11.54%
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 04:16 AM.

Copyright BetaSoft Inc.