powerbuilderdatawindow

Datawindow dragdrop event doesn't always return a reference to the control at the drop location


In short, I need to base some window behavior on the type of object a control is dropped on, after being dragged. This is all well and good as long as the target control at the destination is a column, but not if it is any other object.

Assume I have a datawindow with two columns, and a rectangle. Let's call them c_1, c_2, and r_1, respectively.

I drag c_1 and drop it on c_2:

dwo.name = c_2
dwo.type = column

This is fine, and exactly the behavior I expect.

I drag c_1 and drop it on r_1:

dwo.name = datawindow
dwo.type = datawindow

A reference to the datawindow itself is returned. This is too broad to use as a basis for building anything meaningful, at least in my case.

In testing, it seems that I can't make dragdrop return a reference to the control at the drop location unless it is a column. Is this intended, or is something going wrong in my environment? How can I work around this if I need to base window behavior on the value of dwo.type or dwo.name?


Solution

  • Use the function GetObjectAtPointer

    It will allow you to know exactly what object the user dropped something onto.

    It returns a string of the form objectname~trow that you have to parse to identify what you need.