The Drag Auto property determines whether PowerBuilder puts the control into drag mode automatically. If the property is enabled, when the user clicks the control and starts dragging it, PowerBuilder puts the control in drag mode. Clicking the control triggers a DragDrop event, not a Clicked event.
If Drag Auto is not enabled, then when the user clicks the control, PowerBuilder does not put the control in drag mode. You have to call the Drag function to put the control into drag mode.
In the Window, put 1 Picture object, and set the name of the file, and turn on the DragAuto option, in other tabs of property, and named it as p_1
Add the following script in p_1's clicked event
1: this.Drag(begin!)
At the p_1's dragleave event, put this following script:
1: this.x = parent.pointerx( ) - (this.width / 2)
2: this.y = parent.pointery( ) - (this.height / 2)
3: parent.setredraw(true)
4: this.setredraw(true)
And finally, at p_1's dragdrop event, add this following script:
1: parent.setredraw(true)
2: this.setredraw(true)
3: this.Drag(end!)
No comments:
Post a Comment