// the heading text is in the format of "text,width,format;text,width,format;..." BOOL CReportCtrl::SetColumnHeader(const CString& strHeadings) { DeleteAllItems(); DeleteAllColumns(); EndEdit(TRUE); BOOL bInserted = FALSE; CStringArray aLong, aShort; _StringSplit(strHeadings, aLong, _T(';')); for (int i = 0; i < aLong.GetSize(); i++) { _StringSplit(aLong[i], aShort, _T(',')); if (aShort.GetSize() > 0) { const int WIDTH = aShort.GetSize() > 1 ? _ttoi(aShort[1]) : 100; int nFormat = aShort.GetSize() > 2 ? _ttoi(aShort[2]) : 0; if (nFormat == 1) nFormat = LVCFMT_CENTER; else if (nFormat == 2) nFormat = LVCFMT_RIGHT; else nFormat = LVCFMT_LEFT; bInserted |= (InsertColumn(GetColumnCount(), aShort[0], nFormat, WIDTH) >= 0); } } return bInserted; }
void CUITextBox::StringEllipsis( int nCnt ) { if (nCnt <= 0 || m_vecBoxString.size() <= nCnt) { m_bEllipsis = false; return; } CTString strTemp; strTemp = GetLineString(nCnt - 1) + GetLineString(nCnt); strTemp = UtilHelp::getSingleton()->GetCalcStringEllipsis(strTemp, GetWidth(), CTString("..")); m_Str = CTString(""); for (int i = 0; i < nCnt - 1; ++i) { m_Str += GetLineString(i); } m_Str += strTemp; _StringSplit(); _UpdateBoxSize(); m_bEllipsis = true; }
bool LoadCSV(const std::string& i_file_path, THandleLine i_line_handler) { std::string line; std::ifstream csv_file(i_file_path); if (csv_file.is_open()) { while (std::getline(csv_file, line) ) { TValues values; _StringSplit(line, g_delimiter, values); if (! i_line_handler(values)) return false; } csv_file.close(); return true; } else { return false; } }
void CUITextBox::OnUpdateBoxInfo() { _StringSplit(); _UpdateBoxSize(); m_nScrollPos = 0; }