Print Page | Close Window

MarkupLabel Drag & Drop List Sample & Questions

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=13709
Printed Date: 22 November 2024 at 8:06pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: MarkupLabel Drag & Drop List Sample & Questions
Posted By: jpbro
Subject: MarkupLabel Drag & Drop List Sample & Questions
Date Posted: 17 March 2009 at 1:20pm
I'm posting this here for 2 reasons:

1) I'm not sure anyone ever looks at the Markup board :)
2) I'll be running a bug/question list based on the results of this continuing experiment.

First, I'll describe my requirements:

1) Create a list of attachments (with markup support) that supports OLE Drag & Drop from Windows Explorer
2) Allow the list of attachments to be reorganized via internal drag & drop
3) Dragging outside of the visible area of the list should automatically scroll the list items if required.

An example of what an attachment list item might look like is:



Originally, I had hoped to use the ReportControl for this task since it supports markup and OLE Drag & Drop (with a nice insert point marker). Unfortunately, the markup support is only aesthetic, as UI items are non-interactive. So instead, I've attempted to use the MarkupLabel control to achieve these goals, but I've encountered some other limitations:

1) The MarkupLabel has no OLE Drag & Drop support.
2) There doesn't seem to be a way to tell when MouseUp has occurred outside of the control area.
3) I haven't figured out a way to track when the mouse has left the control area to automatically scroll up and down the list while dragging.

I imagine subclassing could fix #1, and a timer with mouse position checking could likely fix #2 & #3, but these are ugly solutions. Nicer would be:

1) CJ could add the standard OLE Drag & Drop events to the MarkupLabel.
2) The LostMouseCaptureEvent could fire when the mouse button has been released outside of the object that the mouse button was originally depressed over. But maybe I am misunderstanding the purpose of this event?

Here's a demo of what I have got working so far:

uploads/20090317_131915_XamlAttachments.zip - uploads/20090317_131915_XamlAttachments.zip

There are some known limitations & bugs:

1) While dragging, if the mouse button is released over the insertion point, the item won't be dropped and the drag operation will get stuck until a text item is clicked.
2) While dragging, if the mouse is released outside of the control area, the item won't be dropped and the drag operation will get stuck until a text item is clicked.
3) There is no auto-scroll when dragging items. Anyone have any good ideas on how to achieve this?
4) The "attachment" items are just TextBlocks right now, but it should be easy enough to add nicer looking markup items (as in my screenshot)
5) The code uses an ugly naming/id system that requires string handling. I will be updating this to use a class system in the Tag property I think...

Anyway, feedback and ideas are welcome, and I'll post updates as they are available.

-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net