I'm having trouble configuring a drag and drop feature for a configurable user interface.
There are a load of frames, which are part of a dynamic control array. They need to be like this so that users can add or remove frames at their whim.
The frames basically move around OK, but they jump a little when dropped. Normally, the solution to this is to take x and y coords relative to the frame on a MouseDown event like so:
Private Sub fraTemplate_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
dragX = X
dragY = Y
fraTemplate.Drag vbBeginDrag
End Sub
Then use them in the move method parameters on the drop events like so:
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X - dragX, Y - dragY
End Sub
Although the frames drag and drop ok, the MouseDown events procedure doesn't see to be triggered (I tried using a breakpoint to determine this), so these variables aren't getting set. This only seems to be the case when drag mode is automatic. However, if I change drag mode to manual it trips up on fraTemplate.Drag, claiming drag is an unknown method. This seems to be because its an array rather than a single control.
At Present I can't see any way round this. Any bright ideas?
There are a load of frames, which are part of a dynamic control array. They need to be like this so that users can add or remove frames at their whim.
The frames basically move around OK, but they jump a little when dropped. Normally, the solution to this is to take x and y coords relative to the frame on a MouseDown event like so:
Private Sub fraTemplate_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
dragX = X
dragY = Y
fraTemplate.Drag vbBeginDrag
End Sub
Then use them in the move method parameters on the drop events like so:
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X - dragX, Y - dragY
End Sub
Although the frames drag and drop ok, the MouseDown events procedure doesn't see to be triggered (I tried using a breakpoint to determine this), so these variables aren't getting set. This only seems to be the case when drag mode is automatic. However, if I change drag mode to manual it trips up on fraTemplate.Drag, claiming drag is an unknown method. This seems to be because its an array rather than a single control.
At Present I can't see any way round this. Any bright ideas?