导航:  Windows Controls Procedures > List View Control > Structures >

LVITEM

上一页返回章节概述下一页

描述

 

指定或接收列表视图项的属性.这种结构已被更新,以支持新的掩码值(LVIF_INDENT)使项缩进.这种结构取代LV_ITEM结构.

 

FreeBASIC 语法

 

TYPE LVITEMW

  mask       AS UINT

  iItem      AS LONG

  iSubItem   AS LONG

  state      AS UINT

  stateMask  AS UINT

  pszText    AS LPWSTR

  cchTextMax AS LONG

  iImage     AS LONG

  lParam     AS LPARAM

  iIndent    AS LONG

  iGroupId   AS LONG

  cColumns   AS UINT

  puColumns  AS PUINT

#if _WIN32_WINNT = &h0602

  piColFmt   AS LONG PTR

  iGroup     AS LONG

#endif

END TYPE

 

成员

mask

Set of flags that specify which members of this structure contain data to be set or which members are being requested. This member can have one or more of the following flags set:

 

LVIF_COLFMT

Microsoft Windows Vista and later. The piColFmt member is valid or must be set. If this flag is used, the cColumns member is valid or must be set.

LVIF_COLUMNS

Windows XP and later.The cColumns member is valid or must be set.

LVIF_DI_SETITEM

The operating system should store the requested list item information and not ask for it again. This flag is used only with the LVN_GETDISPINFO notification message.

LVIF_GROUPID

Windows XP and later. The iGroupId member is valid or must be set. If this flag is not set when an LVM_INSERTITEM message is sent, the value of iGroupId is assumed to be I_GROUPIDCALLBACK.

LVIF_IMAGE

The iImage member is valid or must be set.

LVIF_INDENT

The iIndent member is valid or must be set.

LVIF_NORECOMPUTE

The control will not generate LVN_GETDISPINFO to retrieve text information if it receives an LVM_GETITEM message. Instead, the pszText member will contain LPSTR_TEXTCALLBACK.

LVIF_PARAM

The lParam member is valid or must be set.

LVIF_STATE

The state member is valid or must be set.

LVIF_TEXT

The pszText member is valid or must be set.

iItem

Zero-based index of the item to which this structure refers. flag is set; otherwise it appears before the specified item.

iSubItem

One-based index of the subitem to which this structure refers, or zero if this structure refers to an item rather than a subitem.

state

Indicates the item's state, state image, and overlay image. The stateMask member indicates the valid bits of this member.

 

Bits 0 through 7 of this member contain the item state flags. This can be one or more of the item state values.

 

Bits 8 through 11 of this member specify the one-based overlay image index. Both the full-sized icon image list and the small icon image list can have overlay images. The overlay image is superimposed over the item's icon image. If these bits are zero, the item has no overlay image. To isolate these bits, use the LVIS_OVERLAYMASK mask. To set the overlay image index in this member, you should use the INDEXTOOVERLAYMASK macro. The image list's overlay images are set with the ImageList_SetOverlayImage function.

 

Bits 12 through 15 of this member specify the state image index. The state image is displayed next to an item's icon to indicate an application-defined state. If these bits are zero, the item has no state image. To isolate these bits, use the LVIS_STATEIMAGEMASK mask. To set the state image index, use the INDEXTOSTATEIMAGEMASK macro. The state image index specifies the index of the image in the state image list that should be drawn. The state image list is specified with the LVM_SETIMAGELIST message.

stateMask

Value specifying which bits of the state member will be retrieved or modified. For example, setting this member to LVIS_SELECTED will cause only the item's selection state to be retrieved.

 

This member allows you to modify one or more item states without having to retrieve all of the item states first. For example, setting this member to LVIS_SELECTED and state to zero will cause the item's selection state to be cleared, but none of the other states will be affected.

 

To retrieve or modify all of the states, set this member to (UINT)-1.

 

You can use the macro ListView_SetItemState both to set and to clear bits.

pszText

If the structure specifies item attributes, pszText is a pointer to a null-terminated string containing the item text. When responding to an LVN_GETDISPINFO notification, be sure that this pointer remains valid until after the next notification has been received.

 

If the structure receives item attributes, pszText is a pointer to a buffer that receives the item text. Note that although the list-view control allows any length string to be stored as item text, only the first 260 TCHARs are displayed.

 

If the value of pszText is LPSTR_TEXTCALLBACK, the item is a callback item. If the callback text changes, you must explicitly set pszText to LPSTR_TEXTCALLBACK and notify the list-view control of the change by sending an LVM_SETITEM or LVM_SETITEMTEXT message.

 

Do not set pszText to LPSTR_TEXTCALLBACK if the list-view control has the LVS_SORTASCENDING or LVS_SORTDESCENDING style.

cchTextMax

Number of TCHARs in the buffer pointed to by pszText, including the terminating NULL.

 

This member is only used when the structure receives item attributes. It is ignored when the structure specifies item attributes. For example, cchTextMax is ignored during LVM_SETITEM and LVM_INSERTITEM. It is read-only during LVN_GETDISPINFO and other LVN_ notifications.

 

Note Never copy more than cchTextMax TCHARs—where cchTextMax includes the terminating NULL—into pszText during an LVN_ notification, otherwise your program can fail.

iImage

Index of the item's icon in the control's image list. This applies to both the large and small image list. If this member is the I_IMAGECALLBACK value, the parent window is responsible for storing the index. In this case, the list-view control sends the parent an LVN_GETDISPINFO notification message to retrieve the index when it needs to display the image.

lParam

Value specific to the item. If you use the LVM_SORTITEMS message, the list-view control passes this value to the application-defined comparison function. You can also use the LVM_FINDITEM message to search a list-view control for an item with a specified lParam value.

iIndent

Version 4.70. Number of image widths to indent the item. A single indentation equals the width of an item image. Therefore, the value 1 indents the item by the width of one image, the value 2 indents by two images, and so on. Note that this field is supported only for items. Attempting to set subitem indentation will cause the calling function to fail.

iGroupId

Version 6.0 Identifier of the group that the item belongs to, or one of the following values.

 

I_GROUPIDCALLBACK

The listview control sends the parent an LVN_GETDISPINFO notification message to retrieve the index of the group.

I_GROUPIDNONE

The item does not belong to a group.

cColumns

Version 6.0 Number of data columns (subitems) to display for this item in tile view. The maximum value is 20. If this value is I_COLUMNSCALLBACK, the size of the column array and the array itself (puColumns) are obtained by sending a LVN_GETDISPINFO notification.

puColumns

Version 6.0 A pointer to an array of column indices, specifying which columns are displayed for this item, and the order of those columns.

piColFmt

Windows Vista A pointer to an array of the following flags (alone or in combination), specifying the format of each subitem in extended tile view. Not implemented.

 

LVCFMT_LINE_BREAK

Forces the column to wrap to the top of the next list of columns.

LVCFMT_FILL

Fills the remainder of the tile area. Might have a title.

LVCFMT_WRAP

Allows the column to wrap within the remaining space in its list of columns.

LVCFMT_NO_TITLE

Removes the title from the subitem.

LVCFMT_TILE_PLACEMENTMASK

Equivalent to a combination of LVCFMT_LINE_BREAK and LVCFMT_FILL.

iGroup

Windows Vista Group index of the item. Valid only for owner data/callback (single item in multiple groups).

 

备注

 

LVITEM结构使用的一些信息,包括LVM_GETITEM,LVM_SETITEM,LVM_INSERTITEM,和LVM_DELETEITEM.

在平铺视图中,项目名称显示在图标右侧.你可以指定额外的子项(详细信息视图中的列对应的),将显示在项目名称下面的线.的puColumns数组包含的子项的索引将显示.指标应大于0,因为0的子项,项目名称,已经显示.列的信息,也可以设置在LVTILEINFO结构时修改列表项.

Note COMCTL32.DLL 6版是不可再发行的但它是包含在微软Windows XP或更高版本.使用COMCTL32.DLL版本6,它在一个清单指定.

 

引用文件

 

CommCtrl.bi