drag and drop list box items

M

mcourter

is there such a thing as a listbox that allows one to drag and drop or
move items up and down within the list vie mouse?
 
G

Guest

Doug,

I am currently attempting to modify your code to allow me to drag values
within a listbox to modify the sort order. I am using a sort value for each
record in a table. I am currently able to get the value selected but have not
yet been able to determine the value where the drop occurs. Still working on
it.

Any thoughts you may have on this would be appreciated.

Mr B
 
J

Jesper Fjølner

I am currently attempting to modify your code to allow me to drag values
within a listbox to modify the sort order. I am using a sort value for
each
record in a table. I am currently able to get the value selected but have
not
yet been able to determine the value where the drop occurs. Still working
on
it.

I haven't seen Dougs code, but I've previously made som well functioning
drag-drop functionality with the following approach.
On the form I keep a hidden control (could the a small textbox, button etc)
that would become visible on the MouseDown Event over for example a listbox.
As I'm moving the mouse, I'm using th xy-coordinates of the mouse the
constantly change the position of the previously hidden and now visible
dummy-control.
This appears as one is "dragging" the control.

To detect the drop: I had looked at the height of the listbox in pixels, the
top and left positions of the listbox on the form and the height of a single
line in the listbox. With these numbers and som simple math, it's possible
to run a function on the MouseUp event that calculates "where you are" in
the listbox, when the button is released.
You can then update the tables/sortorders accordlingly and update the
listbox.
It took a while, but works good.

Jesper Fjølner
 
G

Guest

Jesper,

Thanks for the info. I'll certainly take a look at this type of approach.
Doug's code is quite extensive and I think that I may be able to just make a
few more modifications to that I can have the ability to drag and drop in one
listbox and also have the ablility to drag and drop to other controls at the
same time.

I'll try to post back when I have something. In the mean time, if you or
anyone else is interested in colaberating in this type of thing, contact me
at mrbpolk(NoSpamHere)@cox.net. Just remove the (NoSpamHere). I'll be happy
to share info.

Mr B
 
D

Douglas J Steele

Sorry, but that code won't do what you want. It's intended for dragging from
one control to another.
 
S

Stephen Lebans

See:
http://www.lebans.com/vb_listbox.htm
New Version 3 April 23, 2003 - MULTISELECT must be enabled for this version
to function properly.

Special Thanks to Peter Walker!

FieldList.zip is a database containing the FieldList control Access uses in
its Table Analyzer and Performance Analyzer Wizards. This control is created
directly from the ACCWIZ.DLL so no ActiveX registration problems are
incurred. ACCWIZ.DLL is automatically installed with all full installs of
Access.

This a VB like ListBox with:

1) CheckBoxes for each row

2) True Drag and Drop

3) Conditional Formatting for each Row

4) AddItem method


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top