ExplorerTreeView 2.0 development diary

The place for threads about version 2.x of TimoSoft ExplorerTreeView.
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

Great news: MultiSelect, Drag'n'Drop, SingleExpand and Label-Editing seem to work 100% in any combination. :D The code is even more compact and faster than before.
What's next? I've found some small things that will improve performance and code quality. These changes will be the last ones before starting to implement OLE Drag'n'Drop.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

The small improvements I mentioned are done and I've also found some time to work on OLE Drag'n'Drop. The drop target part is almost complete.

What's done
- poperty RegisterForOLEDragDrop
- events OLEDragEnter, OLEDragMove, OLEDragLeave and OLEDragDrop
- methods OLEDataObject.GetFormat and OLEDataObject.GetData

What's missing
- property OLEDataObject.Files
- drag source functionality including relevant events, properties and methods

Supported clipboard formats
- vbCFText
- vbCFBitmap
- vbCFMetafile
- vbCFDIB (it's still buggy - the colors are wrong)
- vbCFPalette (although I doubt it's correct how I've implemented it)
- vbCFEMetafile
- vbCFRTF
- CF_OEMTEXT
- CF_UNICODETEXT
- CF_DIBV5 (at least I'm working on this one)
- "HTML Format"
- "HTML (HyperText Markup Language)"
- "text/html" (used by Mozilla)
- "text/_moz_htmlcontext" (used by Mozilla)
Of course, other formats are supported, too, but you'll have to use Byte arrays then.
Some of you may of noticed, that vbCFLink is missing. Well, all I know about this format is, that it has to do with DDE. I neither know when this format is used nor how it is formated or how it should be handled. And I don't know anyone who's still using DDE. So I've decided to not support this format. If you need it, give me some details about it and I'll implement it; otherwise it would be just a waste of time.
Concerning the various image formats: I'm not sure my code is correct. Documentation on those formats is relative diffuse and good samples are rare. But I've done some tests and compared the results with those of VB's DataObject class and could not detect any differences.
Supporting text formats is easy and requires only 4 lines of code per format. So if you know more text formats that are often used, let me know.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

Good news: vbCFDIB and CF_DIBV5 are working now - at least if the color depth is higher than 8 bit.

Bad news: RightToLeft doesn't work with the WS_EX_COMPOSITED style and BkImage doesn't work without it (ugly drawing bugs). :angry: At the moment I've no idea how to fix it. Making WS_EX_COMPOSITED a property so that you can decide whether you want RightToLeft or BkImage wouldn't help much, because WS_EX_COMPOSITED doesn't exist on systems prior WinXP, so I guess BkImage isn't working on let's say Win2k, too.
Maybe I'll extend the helpfile by a note like "do not use BkImage together with RightToLeft or on systems prior WinXP", although I'd hate it.

/edit: Oh, and I guess the FavoritesStyle feature sucks without WS_EX_COMPOSITED, too. :angry: :( :cry:
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

VbCFDIB, CF_DIBV5 and vbCFFiles/OLEDataObject.Files are working 100% now. And OLE drag images are working, too.

Now I'll start to implement the drag source part, which is the more difficult one.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

Basic drag source support is working, i. e. the drag operation itself is working, but you can't yet transfer data, because all methods of the control's default IDataObject implementation, that is passed to the DoDragDrop API function, return E_NOTIMPL right now.
But you can pass a custom IDataObject implementation to the control's OLEDrag method. I've tested it with a shell object's IDataObject implementation and it works fantastic.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

I've removed the OLEDataObjectFiles class. Files now get handled via String arrays, e. g.:

Code: Select all

Private Sub ExTVwU_OLEDragDrop(ByVal data As ExTVwLibUCtl.IOLEDataObject, effect As ExTVwLibUCtl.OLEDropEffectConstants, ByVal dropTarget As ExTVwLibUCtl.ITreeViewItem, ByVal button As Integer, ByVal shift As Integer, ByVal x As Single, ByVal y As Single, ByVal yToItemTop As Long, ByVal hitTestDetails As ExTVwLibUCtl.HitTestConstants)
  Dim files() As String
  Dim str As String

  On Error Resume Next
  files = data.GetData(vbCFFiles)
  If Err Then
    str = "No files dropped."
  Else
    str = "Dropped " & (UBound(files) - LBound(files) + 1) & " files:" & vbNewLine & Join(files, vbNewLine)
  End If
  MsgBox str
End Sub
The reasons are:
- for me it's much easier to implement
- IMO a special class for something, that can be done using arrays, is overkill
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

I'm working on the OLEGetData event, which is fired if ExplorerTreeView is the source during OLE drag'n'drop and the target (or a potential target) requests data from the source. The event has two parameters: A ByVal Long defining the requested format's ID and a ByRef Variant that takes the data.

ATM the event can handle the following data formats:
- vbCFFiles
- vbCFText
- vbCFRTF
- CF_OEMTEXT
- CF_UNICODETEXT
- "HTML Format"
- "HTML (HyperText Markup Language)"
- "text/html" (used by Mozilla)
- "text/_moz_htmlcontext" (used by Mozilla)
and actually any other format (via Byte arrays) except those:
- vbCFBitmap
- vbCFMetafile
- vbCFDIB
- vbCFPalette
- vbCFEMetafile
- CF_DIBV5
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

OLE drag'n'drop is complete. Now the bad news: I have to rewrite some parts of it.
I wondered why the drag image disappears when the data is dragged out of the window. And I wondered even more why this doesn't happen if I use the IDataObject implementation of a shell object instead of my own. This means my IDataObject implementation is buggy. Well, unfortunetely it's not only buggy, but seriously broken and maybe you know the saying: "Don't fix it, if it's broken - redo it."
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

The rewrite is complete. :)
Now I'll implement a small enhancement that came to my mind yesterday; somehow fix the WS_EX_COMPOSITED thing and run some extensive tests on other versions of Windows than XP (especially 2000 and 2003). I plan to release Beta 1 this weekend or early next week. ATM I'm not 100% sure whether I'll implement property pages before this release or afterwards, but I tend to do it before.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

The last hours I installed Windows 2003, 2000, NT4 and 95 under VMWare and did some quick tests. Here're the results:
Windows 2003: The control runs fine.
Windows 2000: ATL seems to fail on creation of the control window, so the control doesn't work. I'm afraid I'll have to install Visual Studio 2003 on this Virtual Machine, so I can debug this problem.
Windows NT 4.0: Same as on 2000.
Windows 95: Fails because of the TrackMouseEvent API function which isn't available on Windows 95. I expected this and have decided to not support Windows 95 anyway.

I'll test Windows 98 and Me later. Installing so many OS is boooring... ;)
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

I got it working on Windows NT 4.0 and 2000. But there's another problem: In one of the sample projects you can create items yourself. If there's only one item, it is not drawn. This happens on NT 4.0, 2000, 98, Me and on WinXP without themes (probably also on 2003 without themes). :dontknow:

Here're the results of 98/Me:
Windows 98: The control seems to run fine. I've not tested all samples, because they all use the Unicode version, which of course doesn't work on Windows 9x. Those samples, that I've created ANSI versions of, run fine (besides the mentioned drawing issue).
Windows Me: This one is a beast (well, that's nothing new). The control runs, but besides the already mentioned drawing issue, there're 2 other problems - both concerning OLE drag'n'drop: 1) Although Windows Me should support it, the drag-image isn't shown if the control is the source. 2) If the control is the target, auto-scrolling doesn't work, i. e. it scrolls, but the control doesn't get redrawn. Smells like some if(runningOnCrappyWinMe) statements...
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

The Beta 1, that I've just released, doesn't have the drawing issue. But it does have the Windows Me problems.

I think I'll work on ExplorerTreeView 1.9.0 and ExplorerListView now.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Post Reply