Question Drag and Drop (1 Viewer)

Alisa

Registered User.
Local time
Today, 11:43
Joined
Jun 8, 2007
Messages
1,931
I have looked at this: http://www.access-programmers.co.uk/forums/showthread.php?t=107665
and this:
http://support.microsoft.com/kb/233274

Has anyone else worked with these before? I am not entireley sure I want to go down this road, because I see one major problem with both examples: when you mouse down on an item in the list box, you don't seem to capture the item that you clicked on - if your mouse slides up or down as you move accross the form, your selection in the original list box slides up or down as well. Am I making any sense? Does anyone know of a control to use other than the list box that doesn't have this problem? Is drag and drop really more trouble than it is worth in Access?
 

Banana

split with a cherry atop.
Local time
Today, 10:43
Joined
Sep 1, 2005
Messages
6,318
I saw them before, but to be honest, I shied away from it because it looks as if it'd eat lot of cycles, as MouseMove event can fire several times. Mind, they have a trap to short-circuit and that's good, but still. Just personal prejudice, I think.

I instead opted for a pair of listbox with buttons to transfer one selection from one to other, along with support for double-click to call the same buttons.
 

Alisa

Registered User.
Local time
Today, 11:43
Joined
Jun 8, 2007
Messages
1,931
I instead opted for a pair of listbox with buttons to transfer one selection from one to other, along with support for double-click to call the same buttons.

That solution works great when you are just moving things from one list to another, and the order of the things on the list doesn't matter. But in this case, the user is selecting one or more things from a list box, and then inserting them into a certain location on the tree control.

Doing this with buttons entails a ridiculous number of mouse clicks: First they have to select the thing(s) from the list, then click on the tree node, and finally click the command button to insert them. It seems like it would be much less painful if they could just select the things and drag them to where they should be on the tree. But it looks to me like the list box is not going to be capable of supporting that.

Any other thoughts?
 

Banana

split with a cherry atop.
Local time
Today, 10:43
Joined
Sep 1, 2005
Messages
6,318
Haven't used treeview control, so can't help with that.

Out of curiosity, does the treeview control fire a event whenever a node is clicked? This way, command button wouldn't be necessary. Alternatively, select a node, then double click items on listbox to automagically insert into the selected node.

But I do have to agree. For this case, drag'n'drop definitely is more intuitive- I've not seen any other controls like that that didn't use drag'n'drop and I'd personally expect that functionality myself.
 

Alisa

Registered User.
Local time
Today, 11:43
Joined
Jun 8, 2007
Messages
1,931
Haven't used treeview control, so can't help with that.

Out of curiosity, does the treeview control fire a event whenever a node is clicked? This way, command button wouldn't be necessary. Alternatively, select a node, then double click items on listbox to automagically insert into the selected node.

But I do have to agree. For this case, drag'n'drop definitely is more intuitive- I've not seen any other controls like that that didn't use drag'n'drop and I'd personally expect that functionality myself.

"Automagically" - that's cute

The tree control does have a node click event, but I can't use it to initiate the insertion because there are multiple list boxes they could be inserting FROM, and also they might be clicking on the node just to expand it or delete it, not necessarily to insert anything into it.

I had considered using the double click event on the list box as you suggested, but that will only help when they are inserting a single item from the list - they will still have to use the command button if they want to insert an extended selection.

The only other option I can think of is to go find some third party activex control to use instead of the list box, but I have had enough problems with reference distribution that I don't think I want to go there.

What is really frustrating is that the treeview itself has built in drag and drop events that work just fine. It's just the list box that can't handle it. Looks like this one might get added to my list of gripes about Access - it will be right up there along with not being able to enter data in crosstabs :)
 

Banana

split with a cherry atop.
Local time
Today, 10:43
Joined
Sep 1, 2005
Messages
6,318
A idea, but I am afraid this may run into a blind alley.

I think this will be much easier for you to create a custom form in VB6 or .NET (with COM interop) to act like a dialog box, where you can implement treeview with multiple listbox. In your Access environment, you call a public function in very similar manner to what we do with common dialog boxes, passing the source recordsets as a argument, then let the form itself process the data moving/inserting/deleting/whatever then return the modified recordset(s).

But first thing I'd check on is whether a custom dialog box can be called from within Access environment as I've never done that. I've successfully implemented .NET libraries, but not a form.
 

Alisa

Registered User.
Local time
Today, 11:43
Joined
Jun 8, 2007
Messages
1,931
Unfortunately I have no .NET, and no VB period, shocking I know. Thanks for the thought though.
 

Banana

split with a cherry atop.
Local time
Today, 10:43
Joined
Sep 1, 2005
Messages
6,318
psst... I did my libraries with express edition. Scandalous, isn't it? ;)
 

Alisa

Registered User.
Local time
Today, 11:43
Joined
Jun 8, 2007
Messages
1,931
Is that free? How do you get it?
 

Banana

split with a cherry atop.
Local time
Today, 10:43
Joined
Sep 1, 2005
Messages
6,318
Ayup!

Here.

You can choose between VB.NET, C#, and C++. There's supposed to be limitations, but compiling and building your own project isn't one of them. In my case, I needed two library, which both were written in C#, so I used 2005 #C (though 2008 is current, I opted to stay one version behind) and modified those two libraries for COM Interop and it works pretty good.

But I want to emphasize, I would want to ask other developers if Access can implement a dialog form first before wasting my time. I know for sure .NET controls can't be used, unless built as a ActiveX which has its problems, but imagine dialog forms would work provided that it was totally managed by its own class and merely accepts argument and pass it back, a la a library.
 

Alisa

Registered User.
Local time
Today, 11:43
Joined
Jun 8, 2007
Messages
1,931
Thanks for the info!
I think I will wait and see how much the users complain about the command button solution before I waste anymore time though.
 

Banana

split with a cherry atop.
Local time
Today, 10:43
Joined
Sep 1, 2005
Messages
6,318
A sensible decision!

BTW, here's a wiki article that's free of marketing fluff (and much more readable- that link was just horrid) and lists the limitations of express editions (I looked this after up after wondering about that).

Hopefully someone will show a good native solution. Less exotic the solution, the better for everyone! :)
 

datAdrenaline

AWF VIP
Local time
Today, 12:43
Joined
Jun 23, 2008
Messages
697
Check out the sample I have attached to this post ... Drag-n-Drop on a TreeView and between a ListView and TreeView.

The attached file is the file attached to the first link I reference in my post on utter access found by Clicking Here
 

Attachments

  • TreeViewSample.zip
    90.1 KB · Views: 800

Alisa

Registered User.
Local time
Today, 11:43
Joined
Jun 8, 2007
Messages
1,931
Ah, a ListView control, that is awesome, why didn't I think of that?
Thanks Brent!
 

Banana

split with a cherry atop.
Local time
Today, 10:43
Joined
Sep 1, 2005
Messages
6,318
Now aren't you glad you didn't take advice of silly banana and make a problem way more complicated?!? :p

Brent, I'll definitely take a look- it does sounds awesome! :)
 

datAdrenaline

AWF VIP
Local time
Today, 12:43
Joined
Jun 23, 2008
Messages
697
I know this is a late "You're welcome!" ... but ... You're Welcome!! ... Let me know if you have any issues!!
 

Alisa

Registered User.
Local time
Today, 11:43
Joined
Jun 8, 2007
Messages
1,931
I know this is a late "You're welcome!" ... but ... You're Welcome!! ... Let me know if you have any issues!!

Actually it worked so well that I have used it in several other places in my program! Thanks again!
 

Users who are viewing this thread

Top Bottom