First define a variable m_list
Style options in the list control:
M_list1.setextendedstyle (lvs_ex_fullrowselect | lvs_ex_gridlines | lvs_ex_checkboxes );
Lvs_ex_fullrowselect indicates that you can select this record from any column in the row.
Lvs_ex_gridlines indicates that there is a separator between columns
Lvs_ex_checkboxes indicates that the first column of each row is checkbox.
M_list.setextendedstyle (lvs_ex_fullrowselect | lvs_ex_gridlines );Style settings
M_list.setbkcolor (RGB (247,247,255 ));Color settings
M_list.settextcolor (RGB (0, 0, 255 ));
M_list.settextbkcolor (RGB (247,247,255 ));
While (m_list.deletecolumn (0); // clear the header
M_list.deleteallitems (); // Clear the table content
lv_column LVC;
LVC. mask = lvcf_fmt | lvcf_width | lvcf_text; Add a header
LVC. FMT = lvcfmt_left;
LVC. CX =120;
LVC. psztext = "fdid";
m_list.insertcolumn (0, & LVC);
LVC. psztext = "alarmstyle";
m_list.insertcolumn (1, & LVC);
LVC. psztext = "action";
m_list.insertcolumn (2, & LVC);
LVC. psztext = "tel";
m_list.insertcolumn (3, & LVC);
Int IPOs = m_list.insertitem (0, "200000000100012060 ");// Add an item to the list
M_list.setitemtext (IPOs, 1, "fire ");
M_list.setitemtext (IPOs, 2, "Keep local ");
M_list.setitemtext (IPOs, 3, "13966678889 ");
Int ipos1 = m_list.insertitem (0, "2 ");
M_list.setitemtext (ipos1, 1, "sanhua ");
M_list.setitemtext (ipos1, 2, "Sss ");
M_list.setitemtext (ipos1, 3, "dfdf ");
Delete selected rows:
position P = m_list.getfirstselecteditemposi tion (); // Delete the selected column
while (P)
{< br> int nselected = m_list.getnextselecteditem (P );
m_list.deleteitem (nselected);
P = m_list.getfirstselecteditemposi tion ();
}
Combo box:
M_fdid.insertstring (0, theapp. m_fdid.c_str ()); //Add
// Obtain the value of the selected item
int Index = m_alarm.getcursel ();
cstring str_alarm;
m_alarm.getlbtext (index, str_alarm);