December 15th, 2002, 02:46 AM
|
#1 (permalink)
| | Member
Join Date: Sep 2002
Posts: 364
| VB 6, data list and drag and drop
I'm talking about the list controls that have the little blue icons on your tool bar.
Drag and drop works great with a regular list box, but I need the data list so I can drag a description, but actually drop the bound text.
It has a hard time realizing that when I push the mouse down that I'm picking something. Starting the drag kind of hinders it or something. I usually have to drop the item, them click again on the control that I dropped it to to get the right value inside -- otherwise, it shows my previously selected value.
Anyone have any luck with this?
I was gonna try db list control, but it doesn't like to connect to sql server. |
| |
December 17th, 2002, 12:52 AM
|
#2 (permalink)
| | Ultimate Member
Join Date: Oct 2001
Posts: 21,019
| Re: VB 6, data list and drag and drop Quote: Originally posted by Creosote I'm talking about the list controls that have the little blue icons on your tool bar. | Ok not sure what you're referring to here...
Are you trying to drag text or whatever onto a button, have it activate that button with the given text?
Not quite sure what you're asking for 
Maybe an example or a product that has this kind of functionality? |
| |
December 17th, 2002, 03:21 AM
|
#3 (permalink)
| | Member
Join Date: Sep 2002
Posts: 364
|
Can't send an example, cuz I'm at home.
OK, I've got two list boxes. Or it can be one list box and a text box. Regardless, I drag text from the list box to the other control.
Now this works perfect using regular list box controls.
It doesn't work well using db list controls. db list controls are more data aware than list boxes. db list controls allow you to display text, but also have bound text.
So I'm display some text, but actually dragging the bound text over.
Normally, when you mouse down on a list box, it changes to the property to the text that your mouse was over. This works great with list box controls.
I can mouse down, and begin my drag, and place it in another control.
With a db list control, it doesn't work that way. It drags the PREVIOUSLY selected text over.
Its just like dragging a shortcut out to your desktop from windows explorer. Except instead of using explorer as the source, I'm using a list box, and instead of an icon, its text. |
| |
December 17th, 2002, 03:37 AM
|
#4 (permalink)
| | Ultimate Member
Join Date: Oct 2001
Posts: 21,019
|
ah IC
hmmm
sounds like a crappy control.. I haven't used too many 3rd party controls to tell you if there is a better one on the market, but my guess would be yes...
I'm wondering if there is a way to fool the control.
For instance
Mouse down on dblist control
picks up previously selected item
(while mouse is still down) call mouse up event, then mouse down event again to make the currently selected text the 'previous' text.
Then you should be able to do your drag drop...
Will that work?
Private Sub List1_MouseDown(blahblahblah)
Call List1_MouseUp
Call List1_MouseDown
End Sub
You'll have to do a check, maybe set a global flag to see if your calling the mouse event or if the mouse is calling it to avoid the infinite loop... |
| |
December 18th, 2002, 01:56 AM
|
#5 (permalink)
| | Member
Join Date: Sep 2002
Posts: 364
|
I think that would make an infinite loop, unless I used a counter. It might work. I'll give it a try. There are other things about that control that are different, or harder than the regular list box. For example, I haven't figured out how to scroll the list with code. There is no list index property.
I've just checked, out home, the component is called 'Microsoft DataList Controls 6.0 (SP3)'. Hopefully, I'm running a later service pack at home, maybe this one works OK. |
| |
December 18th, 2002, 02:55 AM
|
#6 (permalink)
| | Ultimate Member
Join Date: Oct 2001
Posts: 21,019
|
ya you'll want to set a flag Code: ' global variables
Dim g_RecursiveCall as Boolean
Private Sub List1_MouseDown(blahblahblah)
If Not g_RecursiveCall Then
g_RecursiveCall = True
Call List1_MouseUp
Call List1_MouseDown
End If
g_RecursiveCall = False
End Sub |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | |
Posting Rules
| You may post new threads You may post replies You may not post attachments You may not edit your posts HTML code is Off | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |