Detailed introduction of lvcolumn and lvitem in clistctrl in VC

Source: Internet
Author: User

List Control)
The List View control is a very common control. When you need to display data in the form of reports, the list control is usually the best choice. Many dedicated data report controls, it is also derived from it. Similar to the Tree View, the list control can be composed of multiple sub-projects and displays information in four ways: Large icons, small icons, lists, and reports, as shown in 1.
Figure 1 four display modes in the List View
The list view contains a project list. Each project consists of icons, project names, and multiple sub-items. Each sub-item must contain the same number of projects, each subitem with the same attributes is displayed in the same column. The List View control has two important data structures: lvcolumn and lvitem. Lvcolumn is used to define the structure of the "column" in the report mode; lvitem is used to define the structure of the "item. The definitions and descriptions of these two structures are as follows:

Typedef struct _ lvcolumn {
Uint mask; // indicates which Members in this structure are valid.
Int FMT; // column alignment
Int CX; // The initial width of the column
Lptstr psztext; // Column Title
Int cchtextmax; // the size of the buffer to which psztext points
Int isubitem; // the index value of the subitem associated with the column, starting from 0.
Int iimage; // the index value of the specified image in the image list associated with the column
Int iorder; // The column number. 0 indicates the leftmost column.
} Lvcolumn, far * lplvcolumn;


Typedef struct _ lvitem {
Uint mask; // specifies which members are valid in the lvitem structure.
Int iItem; // the index value of the project (which can be regarded as the row number) starts from 0.
Int isubitem; // the index value of the subitem (which can be regarded as the column number) starts from 0.
Uint state; // subitem state
Uint statemask; // valid shielding bits in the status
Lptstr psztext; // name of the primary or subitem
Int cchtextmax; // the buffer size pointed to by psztext
Int iimage; // the index value of the specified image in the associated image list
Lparam; // The 32-bit parameter defined by the program
Int iindent; // the unit in which the image is indented.
} Lvitem, far * lplvitem;

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:

Flag Description
Lvif_columns TheCcolumnsMember is valid or must be filled in.
Lvif_di_setitem The operating system shocould store the requested list item information and not ask for it again. This flag is used only with thelvn_getdispinfo notification message.
Lvif_groupid TheIgroupidMember is valid or must be filled in.
Lvif_image TheIimageMember is valid or must be filled in.
Lvif_indent TheIindentMember is valid or must be filled in.
Lvif_norecompute The control will not generate
Lvn_getdispinfo to retrieve text information if it exceeds es
Lvm_getitem message. Instead,PsztextMember will contain lpstr_textcallback.
Lvif_param TheLparamMember is valid or must be filled in.
Lvif_state TheStateMember is valid or must be filled in.
Lvif_text ThePsztextMember is valid or must be filled in.

Common attributes of a list item are as follows:

View specifies how the List View control is initially displayed after the program runs. It can be set to icon (large icon), smallicon (small icon), list (list), or report (report ); single Selection indicates that only one item can be selected at a time;

Auto arrange enables projects to be automatically sorted in the icon and small icon display modes. Edit labels indicates that the project's volume label can be edited. No column header indicates that the title of all columns of the control is canceled.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.