SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Jul 1999
    Location
    Ottawa
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    TypeKeys with SetFocus is erratic

    I have a script that tests to see that a new dialog comes up after the Enter key is pressed when a particular button (not the dialog's default button) has focus. To do this, the script sets focus to the button using SetFocus, and sends a TypeKeys command with "<Enter>" as the key parameter.

    The strange thing is, when I run the script, it fails. It reacts as though a different button has focus, even though the target button visibly has focus. Worse yet, when I try running in Debug and put a stop near that segment of code, the test passes! Has anyone run into this kind of erratic behaviour with the SetFocus/TypeKeys combination?

    Thanks in advance,

    Fraser Gordon

  2. #2
    AJ
    AJ is offline
    Moderator AJ's Avatar
    Join Date
    Jun 1999
    Location
    San Jose, CA
    Posts
    1,691
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: TypeKeys with SetFocus is erratic

    2 recommendations:

    1. Do the SetFocus () at least twice. Also verify that the item has focus using the HasFocus () method.

    2. Try the TypeKeys method on different objects, for example: if the TypeKeys does not work on the dialog, try it on the Button (sometimes that solves it)

    Let me know how that goes.

    PS do you like the new forums???
    They will get better (I'm in a major dispute over policies with our ISP)

    -AJ
    AJ Alhait
    BetaSoft Inc.

  3. #3
    Junior Member
    Join Date
    Jul 1999
    Location
    Ottawa
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: TypeKeys with SetFocus is erratic

    Thanks for the suggestions, AJ.

    I had actually tried passing the TypeKeys to the dialog and the button on different occasions, and neither worked. The double SetFocus didn't seem to improve the situation. The HasFocus method actually returns a TRUE result, so it believes the button has focus, but the application reacts as though it doesn't, even though the button is highlighted.

    What's even stranger is that if I switch the TypeKeys parameter to be <Space> instead of <Enter> (both have the same result if done manually), the test works as it should without any errors. I've tried introducing delays into the code to see if that would help, but the <Enter> test still only works if I'm debugging the code.

    The new forum has a nice feel to it. Looks like it has good potential.

    Fraser Gordon

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin 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 03:47 AM.

Copyright BetaSoft Inc.