SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1
    Junior Member
    Join Date
    Oct 2000
    Location
    Tucson, AZ
    Posts
    22
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Wait for hourglass to turn to a pointer?

    Is it possible to have my script wait until the mouse pointer changes from an hourglass to the standard pointer? I haven't been able to find a way to check the properties of the mouse pointer.

    Thanks!

  2. #2
    Senior Member
    Join Date
    May 2004
    Posts
    1,196
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Wait for hourglass to turn to a pointer?

    Hello ComfortablyNumb,

    Unfortunately, I failed to find out how to get information about the type of the cursor icon by using Win32 API functions. However, you can do this using native properties of the window under which the cursor is located. Also, could you please tell me what programming language was used to create your application?
    Best regards,
    David - SmartBear Support

  3. #3
    Junior Member
    Join Date
    Oct 2000
    Location
    Tucson, AZ
    Posts
    22
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Wait for hourglass to turn to a pointer?

    Delphi

  4. #4
    Senior Member
    Join Date
    Aug 2006
    Posts
    1,920
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Wait for hourglass to turn to a pointer?

    Hello ComfortablyNumb,

    You can compile your application as Open and obtain information about the cursor icon type by using the Cursor native property of the control the cursor is located under. To delay the script execution until the cursor icon changes, you can use the WaitProperty method. To get the object that the cursor is located under, you need to get the cursor coordinates (you can do this by using the MouseX and MouseY properties of the Desktop object) and pass them to the ObjectFromPoint method of the Desktop object. Please note that this approach will only work if the cursor is located under one of your application objects. Please see the "WaitProperty Method", "Desktop.MouseX", "Desktop.MouseY" and "Desktop.ObjectFromPoint" help topics for more information.

    Does this approach work for you?
    Jared - AQA Support

  5. #5
    Junior Member
    Join Date
    Oct 2000
    Location
    Tucson, AZ
    Posts
    22
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Wait for hourglass to turn to a pointer?

    Thanks for the info. I wish it were more straight-forward, but I'll consider your solution.

  6. #6
    Senior Member
    Join Date
    Aug 2001
    Location
    Manchester, NH
    Posts
    121
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Wait for hourglass to turn to a pointer?

    [ QUOTE ]
    Thanks for the info. I wish it were more straight-forward, but I'll consider your solution.

    [/ QUOTE ]

    I was looking for an easy way to get the cursor state and I came across this old thread. In my experience with other tools this is normally a simple call for a cursor state, i'm disappointed this isn't easier. I'm replying to add another user to the list that would love to see this improved in the future. Sometimes the cursor state is the best or only way to tell when an action is complete.

  7. #7
    Senior Member
    Join Date
    Aug 2006
    Posts
    1,920
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Wait for hourglass to turn to a pointer?

    Hi Adam,

    I have added your suggestion to our DB. Thank you.
    Jared - AQA Support

  8. #8
    Senior Member
    Join Date
    Aug 2001
    Location
    Manchester, NH
    Posts
    121
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Wait for hourglass to turn to a pointer?

    [ QUOTE ]
    Hello ComfortablyNumb,

    You can compile your application as Open and obtain information about the cursor icon type by using the Cursor native property of the control the cursor is located under. To delay the script execution until the cursor icon changes, you can use the WaitProperty method. To get the object that the cursor is located under, you need to get the cursor coordinates (you can do this by using the MouseX and MouseY properties of the Desktop object) and pass them to the ObjectFromPoint method of the Desktop object. Please note that this approach will only work if the cursor is located under one of your application objects. Please see the "WaitProperty Method", "Desktop.MouseX", "Desktop.MouseY" and "Desktop.ObjectFromPoint" help topics for more information.

    Does this approach work for you?

    [/ QUOTE ]

    I haven't been able to get this working. Do you have a sample of getting the cursor state using DelphiScript?

    Thanks,
    Adam

  9. #9
    Member
    Join Date
    Nov 2007
    Posts
    45
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Wait for hourglass to turn to a pointer?

    Hi Adam,

    The script below demonstrates how to delay the script execution until the cursor over a Delphi Open application window changes its state. Please note that the Cursor property is available only if the application is compiled as Open.

    Here is the script:

    <font class="small">Code:</font><hr /><pre>
    // DelphiScript

    Const crDefault = 0;

    function WaitCursor(CursorState, Timeout); forward;
    function GetObjectUnderCursor; forward;

    procedure Main;
    var p, w : OleVariant;
    begin
    try
    p := Sys.Process('SampleApp');
    w := p.VCLObject('Form1');
    w.Activate;

    // The Start button starts some process and sets
    // the cursor state to crHourGlass until the process is finished
    w.VCLObject('Start').ClickButton;

    // The WaitCursor function delays the script execution until
    // the cursor returns to the crDefault state or until the timeout elapses
    if WaitCursor(crDefault, 10000) then
    Log.Message('The cursor returned to the crDefault state.')
    else
    Log.Warning('The cursor did not return to the crDefault state.');
    except
    Log.Error('Exception', ExceptionMessage)
    end;
    end;

    function WaitCursor(CursorState, Timeout);
    var Obj : OleVariant;
    begin
    Obj := GetObjectUnderCursor;
    if IsSupported(Obj, 'Cursor') then
    Result := Obj.WaitProperty('Cursor', CursorState, Timeout)
    else
    begin
    Raise(obj.Name + ' does not support the "Cursor" property.');
    Result := false;
    end;
    end;

    function GetObjectUnderCursor;
    begin
    Result := Sys.Desktop.ObjectFromPoint(Sys.Desktop.MouseX, Sys.Desktop.MouseY);
    end;
    </pre><hr />

    Does this help?
    Regards,
    Andrew - AQA Support

  10. #10
    Senior Member
    Join Date
    Aug 2001
    Location
    Manchester, NH
    Posts
    121
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Wait for hourglass to turn to a pointer?

    Unfortunately that's not working for me. I get the warning "The cursor did not return to the crDefault state." even though the cursor did return to a pointer.

 

 
Page 1 of 2 12 LastLast

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.40 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 9.38%
vBulletin Optimisation provided by vB Optimise v2.7.1 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:25 PM.

Copyright BetaSoft Inc.