/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY void OnApplyClick(wxCommandEvent& event) { CWaitCursor wc(this); btnOK->Enable(false); FreeTokenInfo(); FetchTokenInfo(); lstTokens->ClearAll(); InsertListViewItems(); }
BOOL InitListView(HWND hwndListView) { LV_COLUMN lvColumn; int i = 0; TCHAR szString[2][20] = { _T("Window Name"), TEXT("Window Class") }; ListView_DeleteAllItems(hwndListView); lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvColumn.fmt = LVCFMT_LEFT; lvColumn.cx = 250; for (auto& x : szString) { lvColumn.pszText = x; ListView_InsertColumn(hwndListView, i++, &lvColumn); } InsertListViewItems(hwndListView); return TRUE; }
void InitListView() { UINT rw; int maxCol = 3; char szString[3][20] = { ("Token Name"), ("Type"), ("Serial Number") }; double fColWidths[3] = { 0.55, 0.30, 0.15 }; //ListView_SetExtendedListViewStyle // (m_hwndListView, LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP); //empty the list lstTokens->ClearAll(); m_nLVWidth = lstTokens->GetClientSize().GetWidth(); rw = m_nLVWidth; lstTokens->SetImageList(&images, wxIMAGE_LIST_SMALL); //initialize the columns wxListItem lvColumn; lvColumn.SetAlign(wxLIST_FORMAT_LEFT); lvColumn.SetImage(-1); lvColumn.SetText("Token Name"); lvColumn.SetWidth(UINT(m_nLVWidth * fColWidths[0])); lstTokens->InsertColumn(0, lvColumn); lvColumn.SetText("Type"); lvColumn.SetWidth(UINT(m_nLVWidth * fColWidths[1])); lstTokens->InsertColumn(1, lvColumn); lvColumn.SetText("Serial Number"); lvColumn.SetWidth(UINT(m_nLVWidth * fColWidths[2])); lstTokens->InsertColumn(2, lvColumn); btnOK->Enable(false); InsertListViewItems(); } // end InitListView