Forum Discussion

Moulya_p's avatar
Moulya_p
Occasional Contributor
7 years ago

How to resize an object of type Panel in the Web Page?

Hello Everyone,   I am working on a script where it requires me to change the size of a panel by dragging it in the web application. I have used the Drag method in order to resize my panel. I h...
  • tristaanogre's avatar
    tristaanogre
    7 years ago

    ScreenLeft and ScreenTop are relative to the screen, not the object.

    So... let's take a different example to describe how drag works.

    Let's say I have an object that is 200 pixels by 400 pixels.  I want to click on the center of it and drag it 100 pixels up and 100 pixels right.

    SO, that looks like this.

    myObject.Drag(100,200,100,-100)

     

    If I want to do the same, but do so by clicking on the upper left corner of my object, taht would be

     

    myObject.Drag(0,0,100,-100)

     

    The first two co-ordinates are pixels RELATIVE to the dimensions of your actual object.

    So... you know height and width.  If you used those as the first two co-ordinates as you suggested in your original post, that would be having the automation click in the bottom right corner of your object and attempting to drag it.   What you need to do is figure out, based upon height and width and the location of your control point on your object to resize, what are the pixel co-ordinates on your object that you need in order to do the resize.

     

    Suggestion:

     

    Create a brand new keyword test... and simply record your drag action that does the resize.  That's all... just the drag action.  This will give you an insight as to what co-ordinates to use and you can then adjust from there.