Construction Thing



VB 2005 stuff


Odd stuff encountered whilst using VB 2005 Express.

Simple solution for drag and dropping a single item within the same listbox.
This was found at http://vbforums.com/showthread.php?t=492618 posted by a chap called Rykler. MSDN and elsewhere have more complex variations but this works fine for the simple requirement within a listbox. Initially it didn't work for me - the item would drag with the appropriate mouse effect but the DragDrop wasn't occurring when the DragOver was ended. Of course it turned out to be a silly error by myself - the old DragDrop Sub was renamed but I didn't rename the handle so the DragOver was ending and using the old DragDrop handle to go into hyperspace!

 

eg:

Private Sub listbox1Renamed_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles listbox1.DragDrop

 

Should have been - Handles listbox1Renamed.DragDrop

 

Good Code -

Click mouse to select item -

Private Sub listbox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles listbox1.MouseDown

listbox1.DoDragDrop(listbox1.Text, DragDropEffects.All)

End Sub

Drag item holding mouse down -

Private Sub listbox1_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles listbox1.DragOver

e.Effect = DragDropEffects.Move

End Sub

Release mouse button to drop -

Private Sub listbox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles listbox1.DragDrop

' Drops before item that pointer is over
listbox1.Items.Insert(listbox1.IndexFromPoint(listbox1.PointToClient(New Point(e.X, e.Y))), e.Data.GetData(DataFormats.Text))
listbox1.Items.RemoveAt(listbox1.SelectedIndex)
listbox1.Refresh() ' not strictly required

End Sub



Yahoo Widget Engine (ex-Konfabulator)

Recently I've found the Yahoo Widget Engine quite useful for odd widgets.
Below are some widgets that I have made for personal use and you may find useful.
Please note that there is no guarantee that they'll work perfectly ...

If you want to find out more about Yahoo Widgets try HERE (http://widgets.yahoo.com/)

Widgets are usually developed for XP however some are suitable for OSX as well.

Widget downloads are HERE



As they say, work is good for the soul - construction machinery is even better.


What a lovely rear end!