Forum Discussion

jeremyt's avatar
jeremyt
Contributor
11 years ago

Drag method drags different X lengths despite identical parameters

So I'm tying to draw a set of 4 horizontal lines down a page and inexplicably all the lines are drawing at different lengths despite having identical toX coordinates. Even weirder, if I run the code again the line lengths won't even be the same as the first run. How on earth is this possible?



Code Snippet:



var yStart = 150;

Aliases.CanvasContainer.Panel("dijit_WidgetBase_1").Panel(0).Drag(150, yStart, 410,0);

yStart = yStart + 51;

Aliases.CanvasContainer.Panel("dijit_WidgetBase_1").Panel(0).Drag(150, yStart, 410,0);

yStart = yStart + 51;

Aliases.CanvasContainer.Panel("dijit_WidgetBase_1").Panel(0).Drag(150, yStart, 410,0);

yStart = yStart + 51;

Aliases.CanvasContainer.Panel("dijit_WidgetBase_1").Panel(0).Drag(150, yStart, 410,0);



Expected visual result of above code:

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

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

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

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



Actual visual result of above code:

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

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

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

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





As you can see in the code, I draw the same exact line every time except I move down the page 51 pixels each time (that part works). However I do not end up with 4 lines that are 410 in length, I will end up with 4 lines of totally random lengths. And to boot every time I execute the test, the length of the lines vary.



So as far as I can tell it would seem the Drag (ClintX, ClientY, toX, toY) is not working properly or am I missing something? Oh and for the record I'm using TC 10.10.

3 Replies

  • haha just kidding, I would never leave it at that. It drives me nuts when people do that, if you figured it out SHARE with everyone else so if they come upon your post, they might be able to solve their problem the same way.



    Anyway, what I had to do was change the Dragging delay time for my project. I bumped it up to 50ms and the problem went away. To be effecient I bumped it down incrementally until I was able to find the lowest time possible where my issue still did not manifest. In my case I ended up setting the Dragging delay to 20ms.



    Changing dragging delay:


    1. Right click on your Project


    2. Select Edit -> Properties


    3. Click on Playback


    4. Click in the Dragging delay text box and make whatever change you need


    5. Save your project


  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    Also using TC 10.10, but try as I might I cannot reproduce the issue you are seeing.



    Open MS Paint and try this:




    var o = Sys.Process("mspaint").Window("MSPaintApp", "Untitled - Paint", 1).Window("MSPaintView", "", 1).Window("Afx:*", "", 1);


    var ystart = 50;


    o.Drag(150,ystart,450,0);


    ystart += 50;


    o.Drag(150,ystart,450,0);


    ystart += 50;


    o.Drag(150,ystart,450,0);


    ystart += 50;


    o.Drag(150,ystart,450,0);


    ystart += 50;