SPONSORS:






User Tag List

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Nov 2002
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    BeginDragAt() tries to drag from different coords

    I'm evaluating SilkTest for testing with a java app.
    The app. has toolbars which contain objects which can be dragged onto workspace objects.
    I'm using object.GetRect() to capture the coordinates and then using object.BeginDragAt(1, rect.xPos, rect.yPos).
    It works well in one case but in another the BeginDragAt fails since the corrdinates passed to it are off the screen, (or so SilkTest believes).
    Here's the code:
    RECT relay = UNbenannt0PNOZmultiConfig.JavaxSwingJRootPane.Null LayeredPane.DsxJDockFloatProDockFloatFra.DsxJDockF loatProToolBarDOCKS3.ComPilzMpnozGuiFrameworkT3.Ja vaxSwingJPanel.JavaxSwingJTool Bar.Relais.GetRect()
    RECT outputblock1 = Unbenannt0PNOZmultiConfig.JavaxSwingJRootPane.Null LayeredPane.DsxJDockFloatProDockFloatFra.JavaxSwin gJPanel1.JavaxSwingJPanel.ComPilzMpnozGuiWorkspace S.JavaxSwingJViewport.JavaxSwi ngJPanel.ComPilzMpnozGuiWorkspaceS.ComPilzMpnozGui WorkspaceS3.ComPilzMpnozGuiWorkspaceB6.GetRect()
    Print(relay)
    Print(relay.xPos)
    Print(relay.yPos)
    Unbenannt0PNOZmultiConfig.JavaxSwingJRootPane.Null LayeredPane.DsxJDockFloatProDockFloatFra.DsxJDockF loatProToolBarDOCKS3.ComPilzMpnozGuiFrameworkT3.Ja vaxSwingJPanel.JavaxSwingJTool Bar.Relais.BeginDragAt(1,relay.xPos,relay.yPos)
    Unbenannt0PNOZmultiConfig.JavaxSwingJRootPane.Null LayeredPane.DsxJDockFloatProDockFloatFra.JavaxSwin gJPanel1.JavaxSwingJPanel.ComPilzMpnozGuiWorkspace S.JavaxSwingJViewport.JavaxSwi ngJPanel.ComPilzMpnozGuiWorkspaceS.ComPilzMpnozGui WorkspaceS3.ComPilzMpnozGuiWorkspaceB6.EndDragAt(o utputblock1.xPos, outputblock1.yPos)

    The results output are as follows:
    {685, 57, 40, 40}
    685
    57
    *** Error: Mouse coordinate (1370,133) is off the screen
    Occurred in BeginDragAt

    Anyone got any ideas about what's going on here ? Where are the values being passed to BeginDragAt coming from ?

    Regards
    Tim

  2. #2
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: BeginDragAt() tries to drag from different coords

    Changing your GetRect() calls to GetRect(TRUE) will probably work.

    This makes the returned coordinates relative to the entire screen instead of relative to the object's parent.

    There are uses for both approaches, but those details aren't likely to be very important to your eval' effort.

    John


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

  3. #3
    Junior Member
    Join Date
    Nov 2002
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: BeginDragAt() tries to drag from different coords

    Thanks John.
    Unfortunately that doesn't work either.
    New results:
    739
    130
    *** Error: Mouse coordinate (1478,260) is off the screen

    I can't understand how the Print(relay.xPos) and Print(relay.yPos) are returning what look like should be valid values, yet the values passed to BeginDragAt are so far off.

  4. #4
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: BeginDragAt() tries to drag from different coords

    When you use GetRect(TRUE) substitute this code block for the UNbenannt...BeginDragAt, UNbenannt...EndDragAt() calls:

    for the UNbenannt...BeginDragAt, UNbenannt...EndDragAt() calls. The reason for this is that the object-identifying part of the call - UNbenannt... - tells Silk where to start. Silk then adds the x/y parameter offsets to determine where to actually put the mouse cursor.

    Since GetRect(TRUE) tells Silk to supply the value relative to the entire screen, you need to use Desktop in subsequent Drag calls.
    (Note: If you move the application to the upperleft hand corner of the screen, the result of Drags based on GetRect() and GetRect(True) calls should be identical.)

    What version of Silk are you using? From what I can simulate of your example using Silk 6.0, the original GetRect(FALSE) should also work.

    This code block, showing both methods, should work for you:
    John


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

  5. #5
    Junior Member
    Join Date
    Nov 2002
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: BeginDragAt() tries to drag from different coords

    Thanks john, that works for me.
    I'm still a little confused as to why I must do this for this object but similar objects work fine without this workaround. But at least it's working now and I know something new.

    thanks again
    Tim

 

 

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 07:25 AM.

Copyright BetaSoft Inc.