📄 elv.txt
字号:
handler to get the OnDrawSubItem event to fire.
* Changing column information (ColumnsFormat property) screws up the header
image stuff. For example, if you have set up the ColumnsFormat such that
you have images appearing in your column headers and then you change the
alignment of one of the TListColumns (an item of the Columns property), the
header image will disappear. I could catch this if Borland would have been
a little more liberal with their virtual/dynamic declarations, but the one
I need isn't declared that way, so I can't override it. Instead, you will
just have to be aware of the situation and manually refresh it yourself.
Example:
// Change column 3's text alignment.
ExtListView.Columns[2].Alignment := taRightJustify;
// Screwed up header image, refresh it
ExtListView.UpdateColumnImage(2);
If you need to refresh all of the column images, just use
UpdateColumnsImages.
* Changing order of a list item when lvxCheckboxes style is set causes
incorrect painting and/or loss of the check state. This appears to be a
problem in either the COMCTL32.DLL implementation or the handling of moving
items around in the TListView implementation, or both. Either way, there's
not much I can do about it.
* Setting a subitem image (lvxSubItemImages ExtendStyle) to -1 does not
properly clear the image for the subitem. The current COMCTL32.DLL
implementation does not seem to store this value and instead it gets a
random value assigned to it. The work-around that I have found is to set
the index to a value that does not exist in the image list. To make this
a bit easier, I have declared a constant named ELV_NO_SUBITEM_IMAGE that
is equal to MaxInt-1 (MaxInt seems to suffer the same problem as -1). This
will work fine as long as your image list does not have more than
2,147,483,646 images in it. :)
* OnVMStateChanged event does not fire as documented by Microsoft for virtual
mode list views. It appears to only fire when a range of items changes,
and even that appears sporadic in my informal testing. Sorry, I didn't
write COMCTL32.DLL, so I can't fix it. On the bright side, OnChange still
fires. On the dark side, it passes a TListItem which is always NIL in
virtual mode.
Update: H.D.Berretz reports that if you hold the shift key down and click
on an item, this event will fire.
I have no idea how that would be useful, you'll have to ask Microsoft.
* lvxCheckboxes extended style does not work with virtual mode. Seems to be
a limitation of virtual mode as implemented by Microsoft in COMCTL32.DLL.
* Adding a column to a TdfsExtListView component at run-time seems to cause
an EAccessViolation if you do it in the owning form's OnCreate event handler
sometimes. I have found that this can be worked around by moving the code
that creates the column into the OnShow handler. Your mileage may vary.
* The new multiple work areas and region stuff introduced in the 4.71.xxx
version of COMCTL32.DLL is not supported yet.
* NMITEMACTIVATE structure introduced in the IE 4 version of COMCTL32.DLL
is not supported yet.
* I tried adding stuff for the background image, but it doesn't seem to work.
If you want to fool with it, enable the DFS_TRY_BACKGROUND_IMAGE define at
the top of ExtListView.pas. Let me know if you have any luck.
Revision History:
3.72: + Updated for Delphi 6 compatibility. See updated install directions
above.
3.71: + Updated for C++Builder 5 compatibility.
3.70: + Fixed problem with using an image list for SmallImages property where
the image list is on a different form than the form the list view is on.
+ Deleting the image list assigned to SmallImages would not clear the
SmallImages property. Fixed. Thanks to Norbert Adamko for both of
these fixes.
+ State images wouldn't work at all with virtual mode. This has been
fixed. Further, if you didn't know a great deal about the API calls
involved, it was very hard to use the state and overlay images with
virtual mode. This has been addressed by adding two var parameters,
OverlayImage and StateImage, to the OnVMGetItemInfo event.
Unfortunately, this means you will have to reset any OnVMGetItemInfo
event handlers you have in existing code. Just cut the code you have
to the clipboard, remove the event handler, re-add the handler and
paste the code back in.
+ Added new ExtendedSytle option, lvxInfoTip. This flag causes
partially hidden captions to be displayed in a hint-type window. It
is enabled by default. Also, related to this, there is a new event
called OnInfoTip. This allows you to change the text that will be
displayed in the hint-type window, OR (not both) allows you to specify
additional text to be displayed in a hint window below the item when
the mouse is over the item. Also, the SubItemIndex parameter is for
future use only. Currently, Windows passes this parameter but does
not use it for anything and it is always 0. I have included it in
anticipation of Windows actually using the parameter some day.
+ Added new ExtendedStyle option, lvxLabelTip. If a partially hidden
label in any list view mode lacks tooltip text, the list view control
will unfold the label. If this style is not set, the list view control
will unfold partly hidden labels only for the large icon mode. This
style requires v5.80 or higher of ComCtl32.dll.
3.62: + Saving the view style (SaveSettings.SaveViewStyle) did not work in
TdfsExtListView, only TdfsEnhListView.
+ Added OnItemChecked event to TdfsExtListView. This event fires when
an item's checked state changes. I pass the item index rather than the
TListItem so that users of virtual mode can use it (since all
TListItems would be NIL in that case). I found this code in The Delphi
Magazine, Issue 55, March 2000. Although a bit pricey, I highly
recommend this magazine (http://www.thedelphimagazine.com/).
3.61: + Updated information about the DCLSTD35.LIB Known Issue in C3. See
above.
+ The TRect parameter passed in the OnDrawSubItem event was incorrectly
shifted to the left by the amount in DefDraw_TextOffset value (4 by
default). This has been corrected and now only the actual default
text drawing uses this value.
+ Added new event to TdfsExtListView, OnVMCaptionEdited. This event fires
after the user has finished editing a list item when in virtual mode.
The handler is responsible for storing the string passed (unless the
edit was canceled) in the appropriate place since no data is stored by
the list view in virtual mode.
+ Added ELV_EditCaption method to use when in virtual mode since
TListItem.EditCaption can't be used (no TListItems exist in virtual
mode).
+ Added a little sanity checking to the MoveItem method to make sure the
indicies passed are valid.
+ ExtColEd.dfm had some properties that weren't valid in older versions
of Delphi and Builder.
+ Added SaveViewStyle property to SaveSettings property. This will save
and restore the value of the ViewStyle property.
3.60: + Added new property to TdfsEnhListView, NoColumnResize. Prevents all
columns from being resized. There is one small quirk to this, so see
the top of the Known Issues section above. Also, Michael Fritz sent me
code to do nearly the same thing, except it does it on a per column
basis. I just wish I'd read through all my old email before I started
NoColumnsResize, it would have saved me several hours of work. Anyway,
if you want to prevent individual columns from resizing, you can use
the AllowResize property of the ColumnsFormat property of
TdfsExtListView. Thanks again to Michael for this.
+ Smart sorting enhanced a bit courtesy of Joachim Marder. When checking
for valid numeric values, it will now recognize data like "12 kb" as a
number value of 12. It scans for a space and then checks to see if the
data to the left of that is a number.
+ Smart sorting enhanced also by Holger Dors. When checking for valid
numeric values, it will scan for thousandths seperators and remove
them so that numbers like "1,039" can be recognized.
+ OnSortItems event has been enhanced with new SortAs var parameter. If
you want to keep using OnSortItems as you have before, you can simply
ignore this parameter. It helps when you find that smart sorting isn't
quite smart enough. In the event, you can simply set SortAs to one of
the values (saString, saNumeric, saDateTime) and then the control will
do the comparison for you based on what you told it the data should be
treated as. Note also that you could do some really strange things
since OnSortItems is called for each comparison in the sort; i.e. you
could sort two items as strings, and then two other items in the same
sort as integers. I can't think of any useful purpose for that, but
it sounds really cool and I can't think of any useful purpose for cats
either, but some people really like them. :) Oh wait, they're good for
parking lot speed bumps. (Sorry, it's really late and I've been
working on this stuff way to long -- please, you cat lovers out there,
don't mail bomb me)
+ Fixed old Known Issue of OnMeasureItem event for lvOwnerDrawFixed Style
not working if the SmallImages property is assigned. This still
appears to be a bug in the list view implementation by Microsoft or in
TCustomListView class in the VCL. Fortunately, I found a way to work
around the problem.
+ Removed BackgroundImage property. It was broken (scrolling drove it
nuts), and I've given up on trying to get this to work.
+ Updated the page link for downloading COMCTL32.DLL in the
"Redistributing COMCTL32.DLL" section above.
+ TCustomExtListView.ApproximateViewRect passed parameters incorrectly
(Count was in the wrong place). Should be find now.
+ Added new public method, MoveItem. Let's you move a list item from
one index to another. This will not have an effect on auto sorted
listviews since they will just resort the data after any change. Also,
don't even think about using this with virtual mode. This code is
courtesy of Jon Robertson, many thanks to him.
+ There may have been some situations where the list view was recreating
the window handle when it may not have been valid to do so.
+ Fixed strange column drag/drop problem: If you drug a column to a new
position and then double clicked the divider to resize it, it would
resize both the correct column and the column occupying the position
where the correct column used to be.
+ Added new property, ColumnSearch. If enabled, this overrides the
normal keyboard search of the listview such that it searches the
sorted column instead of the caption column. This could be very
confusing to some users, so you'll definitely want to point it out to
users if you take advantage of this feature. This code was sent to me
by Bas Ovink, many thanks to him.
+ Item checked state and subitem image index was not preserved if the
window handle was recreated. This has been fixed.
+ Added OnGetImageIndex event. It works just like the same one that was
introduced in Delphi 4's TListView. See Known Issues section above
for a note about using it.
+ Added OnGetSubItemImage event to TExtListView for Delphi & C++Builder
versions 5 and higher.
+ The Items property should now work in VirtualMode for Delphi &
C++Builder versions 4 and higher. I tried again to get this to work in
D2/D3, but simply can't because I don't have direct access (it's
private to ComCtrls.pas) to some stuff that is required to make it
work. So, I just let D4 & up's OwnerData property do the work for me.
This means you should be able to do things like:
ShowMessage(AnExtListView.Items[0].Caption);
and
ShowMessage(AnExtListView.Selected.Caption);
However, I've not had a chance to test this beyond rudimentary uses,
such as the example above. If you find any problems, let me know ASAP.
3.55: + It's *really* D5 compatible now. Small change between the D5 eval
version and the real, shipping D5 version broke it.
+ Added note for C3 users to Known Issues section above.
3.54: + My search and replace went a little nuts and some things got renamed
that shouldn't have when I changed over the class names. This caused
it to not compile in Delphi 2, and to have some really funky
identifier names in all versions. Fixed now.
3.53: + TEnhListView classname changed to TdfsEnhListView, TExtListView
changed to TdfsExtListView.
+ Delphi 5 compatibility.
3.52: + In D4, reordering columns (lvxHeaderDragDrop) would not always refresh
the items in the listview, so it looked like the items weren't in
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -