PDA

View Full Version : ListView Drag and Drop Visual Cues...


Jon-Huhn
01-29-2008, 06:30 PM
Thanks to some other postings on this forum, I'm able to implement drag and drop functionality in DotNet listviews. However, I'd really like to give the user a visual cue as to where the drug content would go if they were to let go of the mouse button, maybe a line drawn in between the items that the mouse is over (like in Photosehop when you drag layers around to reorder them).

If needs be, I can probably figure out how to draw a line manually, but first I'd like to know if anyone knows if DotNet can create the visual cue automatically. I haven't found anything yet that would indicate as much, but it can be hard to get good info on this stuff anyway sometimes.

Thanks!

PEN
01-29-2008, 06:33 PM
I haven't looked for that sort of thing but what about just colouring the item when the mouse if over it. I believe that there is a hover option built in that will show you what you mouse is on. I guess you want to know that it is going above or below an item. So you could load a texture map in the slot your mouse is over with as small line along the bottom of it.

Jon-Huhn
01-29-2008, 06:53 PM
Ooo, a texture map. I hadn't thought of that. Maybe I could build it dynamically so the users wouldn't need to install any graphics files with the script.

I had tried the hover option previously, and evidently Microsoft defines a hover as keeping the mouse stationary over an item for a period of time, which feels sluggish. I want to keep the interactivity crisp, so I think I'll look into your texturing idea if I can't find an automatic solution in the next day.

Thanks!

RustyKnight
01-29-2008, 10:49 PM
Ooo, a texture map. I hadn't thought of that. Maybe I could build it dynamically so the users wouldn't need to install any graphics files with the script.

I had tried the hover option previously, and evidently Microsoft defines a hover as keeping the mouse stationary over an item for a period of time, which feels sluggish. I want to keep the interactivity crisp, so I think I'll look into your texturing idea if I can't find an automatic solution in the next day.

Thanks!Rather the a hover, can you capture a mouse enter/exit event??

Shane

RustyKnight
01-29-2008, 10:56 PM
ps: I think you might find you will have to "customise" the listview to handle much of the work you want to try...

As Paul said, I'd probably try and "insert" a "proxy" object into the list and highlight it some fashion, with a different background color or something...

One of the things that dot not really lacks is the ability to define "renderers" for many of it's classes...ie somekind of class that can be used to generate the visual look at feel of the data...mind you, they lack any kind of real mvc paradigm which would make this idea possible...but that's just me having a little rant...

Shane

Jon-Huhn
01-30-2008, 01:43 PM
So here's what I ended up doing, and it worked REALLY well, I'm very pleased with the results.

I used the Graphics.DrawLine method to draw a line between the two list view items in question, and when it was no longer needed, I called the .invalidate() method of the listview to erase that specific area.

PEN
01-30-2008, 01:56 PM
Wow very nice.

CGTalk Moderation
01-30-2008, 01:56 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.