1. Sverre Tvedt
  2. PowerBuilder
  3. Tuesday, 21 July 2020 07:42 AM UTC

After upgrading to 2019 R2 build 2328 (32 bit)  our users noted that dragging within treeviews using the right mouse button no longer is possible.

The treeview controls have the Dragauto property set and DisableDragAndDrop unchecked.

When dragging with the left button, BeginDrag and DragDrop events are triggered as expected, upon inital press/move left button and upon release left  button.

When dragging with the right button, BeginRightDrag is triggered as dragging starts, but a DragDrop event is never triggered when the mouse button is released.

I have traced this behaviour in two widely different treeview controls in different dialogs.

We use the two dragging modes for performing different operations, so it would be nice if anyone knows a workaround. Maybe the Dragdrop event may be activated again in the BeginRightDrag event code?

 

Accepted Answer
René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 21 July 2020 09:02 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi Sverre,

yes, it seems to be a bug with RightDragging. You should open a support ticket.

As workaround you could try this:

//declare an instance variable for the drag handle (if you want to use drag&drop between different treeviews you also need an instance variable for the dragobject)

long il_rightdraghandle

 

// in beginrightdrag event store the drag handle

il_rightdraghandle = handle

 

// create a new event rbuttonup with event ID pbm_rbuttonup

// redirect the event to the dragdrop event (or implement the dragdrop here)

IF il_rightdraghandle > 0 THEN Event dragdrop(this, il_rightdraghandle)

 

// in dragdrop event reset the instance variable and stop the dragging

IF il_rightdraghandle > 0 THEN
   il_rightdraghandle = 0
   Drag (Cancel!)
END IF

 

HTH,

René

 

Comment
  1. Sverre Tvedt
  2. Tuesday, 21 July 2020 11:14 AM UTC
Thank you René!

Yes, that worked. I found a nice ammendment that will continue to work even when the bug becomes fixed in future builds.

In the rbuttonup event, which is supposed to fire after the dragdrop event, I simply added these lines:



if ii_mousebutton = 2 Then

// bug in right button dragging: no dragdrop event is produced before rbuttonup event

// If a future fix is provided, ii_mousebutton will already be 0 and prevent repeated execution



// execute dragdrop functions:

event dragdrop(this, il_handle_source) // includes setting ii_mousebutton = 0



// cancel dragging

this.drag(cancel!)

End If







  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.