Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DragDrop with Dynamic Control Array elements. 1

Status
Not open for further replies.

wsimmonds

Programmer
Aug 3, 2002
27
GB
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?
 
Trie
Code:
fraTemplate(Index).Drag vbBeginDrag

That is one problem you have. See if it works now...

Hope I've been helpful,
Bogdan Muresan.
 
Cheers for pointing that out. I still haven't got it to recognise the MouseDown event, but using the index property has helped me in another part of the program.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top