473,385 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

MSComctLib.TreeView CreateDragImage issue

FishVal
2,653 Expert 2GB
Hi!

Access2003, WinXP SP2, Control: MSComctLib.TreeView

I've recently add tree view to my database. Among other functionality it implements Drag-n-Drop. All works fine but one thing.
I want to create drag image from dragged node using Node.CreateDragImage function. But it returns IPictureDisp object containing a node image only, never the node text nothing to tell about a composite one I would like to see.
Any helpful advice will be appreciated.

Thanks.
Jun 11 '07 #1
11 8012
NeoPa
32,556 Expert Mod 16PB
Hi!

Access2003, WinXP SP2, Control: MSComctLib.TreeView

I've recently add tree view to my database. Among other functionality it implements Drag-n-Drop. All works fine but one thing.
I want to create drag image from dragged node using Node.CreateDragImage function. But it returns IPictureDisp object containing a node image only, never the node text nothing to tell about a composite one I would like to see.
Any helpful advice will be appreciated.

Thanks.
Fish,
You may be lucky here and find someone who knows about this software, but the expertise is generally around MS Access rather than specific add-ons.
Good luck anyway.
Jun 11 '07 #2
FishVal
2,653 Expert 2GB
Fish,
You may be lucky here and find someone who knows about this software, but the expertise is generally around MS Access rather than specific add-ons.
Good luck anyway.
Hmmm. You consider Treeview control is less native to Access than for example Chart control? :)
Anyway thanks.
Jun 11 '07 #3
NeoPa
32,556 Expert Mod 16PB
Hmmm. You consider Treeview control is less native to Access than for example Chart control? :)
Anyway thanks.
I'm not saying you won't get an answer, just that the chances are less because it's less common usage. I don't know it at all personally - is it a M$ add-in then? Is it included in the base Access package even? If it is either of these then it's more likely you'll find an answer (not from me though 'cause I've not even heard of it before :D).
Jun 11 '07 #4
FishVal
2,653 Expert 2GB
I'm not saying you won't get an answer, just that the chances are less because it's less common usage. I don't know it at all personally - is it a M$ add-in then? Is it included in the base Access package even? If it is either of these then it's more likely you'll find an answer (not from me though 'cause I've not even heard of it before :D).
It is in
"Microsoft Windows Common Controls 6.0 (SP6)"
\WINDOWS\system32\MSCOMCTL.OCX
MSDN documentation is minor.

Well. Maybe I should create mouseicon programmatically.
Really, I don't wait for solutions but for ideas.
Programming is much more interesting thing than program itself, isn't it?
Jun 11 '07 #5
ADezii
8,834 Expert 8TB
Hi!

Access2003, WinXP SP2, Control: MSComctLib.TreeView

I've recently add tree view to my database. Among other functionality it implements Drag-n-Drop. All works fine but one thing.
I want to create drag image from dragged node using Node.CreateDragImage function. But it returns IPictureDisp object containing a node image only, never the node text nothing to tell about a composite one I would like to see.
Any helpful advice will be appreciated.

Thanks.
I'm familiar with VB but I need to see your code in order to attempt a response.
  1. Are you using Manual or Automatic Drag-N-Drop operations?
  2. If you are manually using Drag-N-Drop, have you initiated the Drag operation via the Drag Method?
  3. What are your settings for the OLEDragMode and OLEDropMode Propeerties?
  4. How are you initializing the CreateDragImage Method (TreeViewName.SelectedItem.CreateImage)?
  5. This Method creates a dithered version of an Object's Image. What are you assigning this Image to?
  6. The Node selected for Drag Operations - is it declared Publically?
  7. Please post all relevant code.
Jun 12 '07 #6
FishVal
2,653 Expert 2GB
I'm familiar with VB but I need to see your code in order to attempt a response.
  1. Are you using Manual or Automatic Drag-N-Drop operations?
  2. If you are manually using Drag-N-Drop, have you initiated the Drag operation via the Drag Method?
  3. What are your settings for the OLEDragMode and OLEDropMode Propeerties?
  4. How are you initializing the CreateDragImage Method (TreeViewName.SelectedItem.CreateImage)?
  5. This Method creates a dithered version of an Object's Image. What are you assigning this Image to?
  6. The Node selected for Drag Operations - is it declared Publically?
  7. Please post all relevant code.
Hi! Thanks for cooperation. Hereby I'm providing code of Drag events handlers.
It is located in custom Class module as you can see. Treeview object is a global variable in Class module and is retrived via Me.TreeView property.


Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub trvTreeView_OLEDragDrop(Data As MSComctlLib.DataObject, _
  3.             Effect As Long, Button As Integer, Shift As Integer, _
  4.             x As Single, y As Single)
  5.  
  6.     With Me.TreeView
  7.         DragCompleted .SelectedItem, .HitTest(x, y), Shift
  8.         .DropHighlight = Nothing
  9.         .MousePointer = ccArrow
  10.     End With
  11.  
  12. End Sub
  13.  
  14. Private Sub trvTreeView_OLEDragOver(Data As MSComctlLib.DataObject, _
  15.             Effect As Long, Button As Integer, Shift As Integer, _
  16.             x As Single, y As Single, State As Integer)
  17.  
  18.     With Me.TreeView
  19.         If .SelectedItem Is Nothing Then
  20.             .SelectedItem = .HitTest(x, y)
  21.             .MouseIcon = .SelectedItem.CreateDragImage
  22.             .MousePointer = ccCustom
  23.         End If
  24.         .DropHighlight = .HitTest(x, y)
  25.     End With
  26.     If (Shift And 2) = 0 Then
  27.         Effect = ccOLEDropEffectMove
  28.     Else
  29.         Effect = ccOLEDropEffectCopy
  30.     End If
  31.  
  32. End Sub
  33.  
  34. Private Sub trvTreeView_OLEGiveFeedback(Effect As Long, _
  35.             DefaultCursors As Boolean)
  36.     DefaultCursors = False
  37. End Sub
  38.  
  39. Private Sub trvTreeView_OLEStartDrag(Data As MSComctlLib.DataObject, _
  40.             AllowedEffects As Long)
  41.  
  42.     Me.TreeView.SelectedItem = Nothing
  43.     AllowedEffects = ccOLEDropEffectCopy + ccOLEDropEffectMove
  44.  
  45. End Sub
  46.  
  47.  
Drag properties are the following:
.OLEDragMode = ccOLEDragAutomatic
.OLEDropMode = ccOLEDropManual

As I've already stated the result is that mouse cursor image changes to Node.Image with low resolution.
If Node object contains no Image and TreeView.Style=tvwTreelinesPlusMinusText CreateDragImage method returns empty bar image.

Actually I'm thinking about manual image creation instead of CreateDragImage method. Could you suggest how to create IPictureDisp object from text? Maybe some WinAPI function?

Thanks.
Jun 12 '07 #7
ADezii
8,834 Expert 8TB
Hi! Thanks for cooperation. Hereby I'm providing code of Drag events handlers.
It is located in custom Class module as you can see. Treeview object is a global variable in Class module and is retrived via Me.TreeView property.


Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub trvTreeView_OLEDragDrop(Data As MSComctlLib.DataObject, _
  3.             Effect As Long, Button As Integer, Shift As Integer, _
  4.             x As Single, y As Single)
  5.  
  6.     With Me.TreeView
  7.         DragCompleted .SelectedItem, .HitTest(x, y), Shift
  8.         .DropHighlight = Nothing
  9.         .MousePointer = ccArrow
  10.     End With
  11.  
  12. End Sub
  13.  
  14. Private Sub trvTreeView_OLEDragOver(Data As MSComctlLib.DataObject, _
  15.             Effect As Long, Button As Integer, Shift As Integer, _
  16.             x As Single, y As Single, State As Integer)
  17.  
  18.     With Me.TreeView
  19.         If .SelectedItem Is Nothing Then
  20.             .SelectedItem = .HitTest(x, y)
  21.             .MouseIcon = .SelectedItem.CreateDragImage
  22.             .MousePointer = ccCustom
  23.         End If
  24.         .DropHighlight = .HitTest(x, y)
  25.     End With
  26.     If (Shift And 2) = 0 Then
  27.         Effect = ccOLEDropEffectMove
  28.     Else
  29.         Effect = ccOLEDropEffectCopy
  30.     End If
  31.  
  32. End Sub
  33.  
  34. Private Sub trvTreeView_OLEGiveFeedback(Effect As Long, _
  35.             DefaultCursors As Boolean)
  36.     DefaultCursors = False
  37. End Sub
  38.  
  39. Private Sub trvTreeView_OLEStartDrag(Data As MSComctlLib.DataObject, _
  40.             AllowedEffects As Long)
  41.  
  42.     Me.TreeView.SelectedItem = Nothing
  43.     AllowedEffects = ccOLEDropEffectCopy + ccOLEDropEffectMove
  44.  
  45. End Sub
  46.  
  47.  
Drag properties are the following:
.OLEDragMode = ccOLEDragAutomatic
.OLEDropMode = ccOLEDropManual

As I've already stated the result is that mouse cursor image changes to Node.Image with low resolution.
If Node object contains no Image and TreeView.Style=tvwTreelinesPlusMinusText CreateDragImage method returns empty bar image.

Actually I'm thinking about manual image creation instead of CreateDragImage method. Could you suggest how to create IPictureDisp object from text? Maybe some WinAPI function?

Thanks.
  1. Is the TreeView Property setting an explicit reference to tvwTreeView, and not a TreeView Object?
  2. Shouldn't there be some kind of specific reference to the actual Node being dragged in the MouseDown () Event? e.g.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub TreeView1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
    2.   Set MyNode = Me.TreeView.SelectedItem
    3. End Sub
  3. I definitely think that it is a bad idea to use 'TreeView' as a Custom Property. There could be some ambiguity - did you try changing this Property Name?
  4. A Picture Object implements an iPictureDisp Interface in order to provide access to trhe Picture's properties through Automation.From what I have researched, this interface is not meant to be implemented since there is an OLE-provided Picture Object. For all practical purposes, all properties contained within iPictureDisp are Read Only. I'm sure that an API Function exists to create one, but I have no idea of its name.
Jun 12 '07 #8
FishVal
2,653 Expert 2GB
  1. Is the TreeView Property setting an explicit reference to tvwTreeView, and not a TreeView Object?
  2. Shouldn't there be some kind of specific reference to the actual Node being dragged in the MouseDown () Event? e.g.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub TreeView1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
    2.   Set MyNode = Me.TreeView.SelectedItem
    3. End Sub
  3. I definitely think that it is a bad idea to use 'TreeView' as a Custom Property. There could be some ambiguity - did you try changing this Property Name?
  4. A Picture Object implements an iPictureDisp Interface in order to provide access to trhe Picture's properties through Automation.From what I have researched, this interface is not meant to be implemented since there is an OLE-provided Picture Object. For all practical purposes, all properties contained within iPictureDisp are Read Only. I'm sure that an API Function exists to create one, but I have no idea of its name.
Thanks.
  • Surely TreeView property references TreeView object, not a trvTreeView control
  • What concerns referencing Node object, I'm 100% sure having debugged this that the referenced object is a right one
  • "TreeView" name of the custom class property does not conflict with class name TreeView, you can find many examples when a property returning particulary object has the same name as the object class has.
  • Finally, I've tried the folowing code after the tree has been populated, not in Drag-n-Drop context:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim pic As stdole.IPictureDisp
  3. ........................
  4. Set pic = .Nodes(2).CreateDragImage
  5. SavePicture pic, "C:\pic.dib"
  6. Set pic = Nothing
  7. .......................
  8.  
No way. Opened it in Paintbrush - image corresponding to the node, no text.
I think I will try search WinAPI. This seems to be more promissing.

Anyway thanks.
Jun 12 '07 #9
TheSmileyCoder
2,322 Expert Mod 2GB
I do realise this thread is ancient, but I also know both of you are still active on the forum. Did you ever find a way to create a composite image of the node icon and caption? I've been searching myself, and trying myself with no luck.
May 19 '11 #10
ADezii
8,834 Expert 8TB
Sorry TheSmileyCode, no luck on this end. I'll have a fresh look later on and see if anything comes up.
May 19 '11 #11
TheSmileyCoder
2,322 Expert Mod 2GB
Thank you for replying ADezii. The best I have come up with myself is to use the OLEDragOver to continously remove the node, and add it at the location of the mouse. (I have to remove it and add it again, since I cannot change its index at runtime)

It almost looks like dragging, but its not perfect, I would prefer the CreateDragImage to work.
May 19 '11 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Robert Robinson | last post by:
I have been working for the past week on what seems to be a bug with the VB TreeView control. I have changed the background of the treeview to a light beige, this works fine except for the white...
0
by: MarkD | last post by:
I have an ASP.NET (VB.NET) application that calls all VB6 COM DLL via Interop. The DLL uses functionality contained in a Custom OCX Control (Also VB6) that in turn contains a standard TreeView...
14
by: Evan Kontos | last post by:
I am trying to implement a Treeview w/an XML file and I even copied and pasted examples from MSDN but can't get them to work. Any suggestions welcome. XML File <TREENODES> <TREENODE...
6
by: L.M | last post by:
Hello, I knew how to use the treeview under VB6. After migrating to .NET, well, I'm lost. I try to add a new node, either to the same level or as a child to a selected node in the treeview....
2
by: Tymbow | last post by:
I'm building a web application that is analogous to the Windows XP file explorer in function. The left column contains a TreeView, and the right column a DataGrid populated by selecting TreeView...
6
by: cyriel1920 | last post by:
Hi, I use the selectednodestyle with a white background so the user can see which item was chosen in the treeview navigation. The nodes have a navigateURL with a target to another frame....
8
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the...
1
by: Nikron | last post by:
Hi, I'm having an issue with the ASP.NET 2.0 Treeview control and persisting its' state accross requests. My Control is embedded within a master page and is used for site navigation. My problem...
2
by: makennedy | last post by:
Hi Experts, Please help, I am a newbie to ASP.NET 2.0 may be I am doing something wrong or there may be a bug somewhere. Basically I have a TreeView Control which I have created...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.