Frage zu Sft Tree
-
Hallo, ich hab ein Problem mit Sft Tree. Ich möchte in meinem SftTree-Objekt ein Picture anzeigen. Die einzelnen Spalten sind folgendermaßen definiert worden:
int w0 = AfxGetApp()->GetProfileInt("SpoolManager", "w0", 100); w0 = min(max(1, w0), 400); int w1 = AfxGetApp()->GetProfileInt("SpoolManager", "w1", 100); w1 = min(max(1, w1), 400); int w2 = AfxGetApp()->GetProfileInt("SpoolManager", "w2", 200); w2 = min(max(1, w2), 400); int w3 = AfxGetApp()->GetProfileInt("SpoolManager", "w3", 100); w3 = min(max(1, w3), 400); int w4 = AfxGetApp()->GetProfileInt("SpoolManager", "w4", 100); w4 = min(max(1, w4), 400); int w5 = AfxGetApp()->GetProfileInt("SpoolManager", "w5", 100); w5 = min(max(1, w5), 400); int w6 = AfxGetApp()->GetProfileInt("SpoolManager", "w6", 100); w6 = min(max(1, w6), 400); int w7 = AfxGetApp()->GetProfileInt("SpoolManager", "w7", 050); w7 = min(max(1, w7), 400); int w8 = AfxGetApp()->GetProfileInt("SpoolManager", "w8", 100); w8 = min(max(1, w8), 400); HBITMAP hbm; CBitmap bmp; bmp.LoadBitmap(IDB_WARN); hbm = (HBITMAP) bmp; SFTTREE_CELLINFOPARM cip; cip.version=4; cip.index=-1; cip.iCol=0; GetCellInfo(&cip); cip.Cell.hBmp = hbm; SetCellInfo(&cip); SetShowHeader(TRUE); SetShowHeaderButtons(TRUE); // Define columns SFTTREE_COLUMN_EX aCol[] = { { 0, 0, w7, ES_LEFT | SFTTREE_TOOLTIP, // Reserved, Reserved, Width (pixels), Cell alignment ES_LEFT | SFTTREE_HEADER_UP, // Title style "Warnung", // Column header title NULL, NULL, SFTTREE_BMP_RIGHT, // Reserved field and bitmap handle, bitmap alignment 0, 0, 0, // Reserved fields SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Cell background(COLOR_BTNFACE|0x80000000L),foreground color SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Selected cell background, foreground color 0, // Real column position (set by SetColumns call) 0, // Display column number (display position) 0, 0 }, // Reserved, minimum column width { 0, 0, w8, ES_LEFT | SFTTREE_TOOLTIP, // Reserved, Reserved, Width (pixels), Cell alignment ES_LEFT | SFTTREE_HEADER_UP, // Title style "Batch-Nr", // Column header title NULL, NULL, SFTTREE_BMP_RIGHT, // Reserved field and bitmap handle, bitmap alignment 0, 0, 0, // Reserved fields SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Cell background(COLOR_BTNFACE|0x80000000L),foreground color SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Selected cell background, foreground color 0, // Real column position (set by SetColumns call) 1, // Display column number (display position) 0, 0 }, // Reserved, minimum column width { 0, 0, w0, ES_LEFT | SFTTREE_TOOLTIP, // Reserved, Reserved, Width (pixels), Cell alignment ES_LEFT | SFTTREE_HEADER_UP, // Title style "Formularname", // Column header title NULL, NULL, SFTTREE_BMP_RIGHT, // Reserved field and bitmap handle, bitmap alignment 0, 0, 0, // Reserved fields SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Cell background(COLOR_BTNFACE|0x80000000L),foreground color SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Selected cell background, foreground color 0, // Real column position (set by SetColumns call) 2, // Display column number (display position) 0, 0 }, // Reserved, minimum column width { 0, 0, w1, ES_LEFT | SFTTREE_TOOLTIP, // Reserved, Reserved, Width (pixels), Cell alignment ES_LEFT | SFTTREE_HEADER_UP, // Title style "Brieftyp", // Column header title NULL, NULL, SFTTREE_BMP_RIGHT, // Reserved field and bitmap handle, bitmap alignment 0, 0, 0, // Reserved fields SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Cell background(COLOR_BTNFACE|0x80000000L),foreground color SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Selected cell background, foreground color 0, // Real column position (set by SetColumns call) 3, // Display column number (display position) 0, 0 }, // Reserved, minimum column width { 0, 0, w2, ES_LEFT | SFTTREE_TOOLTIP, // Reserved, Reserved, Width (pixels), Cell alignment ES_LEFT | SFTTREE_HEADER_UP, // Title style "Beschreibung", // Column header title NULL, NULL, SFTTREE_BMP_RIGHT, // Reserved field and bitmap handle, bitmap alignment 0, 0, 0, // Reserved fields SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Cell background(COLOR_BTNFACE|0x80000000L),foreground color SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Selected cell background, foreground color 0, // Real column position (set by SetColumns call) 4, // Display column number (display position) 0, 0 }, // Reserved, minimum column width { 0, 0, w3, ES_LEFT, // Reserved, Reserved, Width (pixels), Cell alignment ES_LEFT | SFTTREE_HEADER_UP, // Title style "Sachgebiet", // Column header title NULL, NULL, SFTTREE_BMP_RIGHT, // Reserved field and bitmap handle, bitmap alignment 0, 0, 0, // Reserved fields SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Cell background, foreground color SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Selected cell background, foreground color 0, // Real column position (set by SetColumns call) 5, // Display column number (display position) 0, 0 }, // Reserved, minimum column width { 0, 0, w4, ES_LEFT, // Reserved, Reserved, Width (pixels), Cell alignment ES_LEFT | SFTTREE_HEADER_UP, // Title style "erstellt am", // Column header title NULL, NULL, SFTTREE_BMP_RIGHT, // Reserved field and bitmap handle, bitmap alignment 0, 0, 0, // Reserved fields SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Cell background, foreground color SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Selected cell background, foreground color 0, // Real column position (set by SetColumns call) 6, // Display column number (display position) 0, 0 }, // Reserved, minimum column width { 0, 0, w5, ES_LEFT, // Reserved, Reserved, Width (pixels), Cell alignment ES_LEFT | SFTTREE_HEADER_UP, // Title style "erstellt von", // Column header title NULL, NULL, SFTTREE_BMP_RIGHT, // Reserved field and bitmap handle, bitmap alignment 0, 0, 0, // Reserved fields SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Cell background, foreground color SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Selected cell background, foreground color 0, // Real column position (set by SetColumns call) 7, // Display column number (display position) 0, 0 }, // Reserved, minimum column width { 0, 0, w6, ES_RIGHT, // Reserved, Reserved, Width (pixels), Cell alignment ES_LEFT | SFTTREE_HEADER_UP, // Title style "Anzahl Datensätze", // Column header title NULL, NULL, SFTTREE_BMP_RIGHT, // Reserved field and bitmap handle, bitmap alignment 0, 0, 0, // Reserved fields SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Cell background, foreground color SFTTREE_NOCOLOR, SFTTREE_NOCOLOR, // Selected cell background, foreground color 0, // Real column position (set by SetColumns call) 8, // Display column number (display position) 0, 0 }, // Reserved, minimum column width }; SetColumns(9, aCol); // Set column attributes SetShowHeader(TRUE); // Show column headers // SetTreeLineStyle(SFTTREE_TREELINE_NONE); // No tree lines SetShowButtons(TRUE); // No expand/collapse buttons SetShowGrid(TRUE); // Show grid SetShowTruncated(TRUE); // Show ... if truncated SetNoFocusStyle(SFTTREE_NOFOCUS_FRAME); // No focus, show frame SetSelectionStyle(SFTTREE_SELECTION_ALL); // Select all cell SetFlyby(FALSE); // no Flyby highlighting SetScrollTips(TRUE); // Show Scrolltips SetInheritBgColor(TRUE); // Inherit background color of first cell SetCrossColumnResize(TRUE); // Resize multiple columns SetReorderColumns(TRUE); // Column reordering SetOpenEnded(TRUE); // Last column width SetShowHeaderButtons(TRUE); // Show column header as buttons SetShowRowHeader(SFTTREE_ROWSTYLE_NONE); // no Row style SetRowHeaderStyle(ES_CENTER | SFTTREE_HEADER_UP); // Row header style SetShowRowColHeaderButton(FALSE); // Row/column header as title SetRowColText("?"); // Row/column header text SetRowColHeaderStyle(ES_LEFT | SFTTREE_HEADER_UP); // Row/column header style SetCharSearchMode(SFTTREE_CHARSEARCH_ALLCHARS, -1); // Consider all characters typed RecalcHorizontalExtent();Für die Darstellung der einzelnen Zeilen benutze ich folgen Code:
void CwinEFWSplDlg::fill(const char* caller) { const bool dbg = false; if (!m_Table) return; iStatus = ((CButton*)GetDlgItem(IDC_Neu))->GetCheck() ? 0 : 1; if (!(pKate=(CListBox*)GetDlgItem(IDC_Kategorie))) return; if (!(pSach=(CTabCtrl*)GetDlgItem(IDC_TAB))) return; int iKate = pKate->GetCurSel(); int iSach = pSach->GetCurSel(); if (dbg) print("%s fill iStatus=%d iKate=%d iSach=%d ", caller, iStatus, iKate, iSach); sachSel[iKate] = iSach; // Sachgebiet zur Kategorie merken m_Table.ResetContent(); if (iKate != LB_ERR && iSach != -1) { for (int k=0; k < gwiManager.arr[iStatus].GetSize(); k++) { Gwi* pgwi = gwiManager.arr[iStatus][k]; if (!xmlVerfahren.sachMatch(pgwi->sachgebiet, iKate, iSach-1))// -1 wg. Kartei: 'alle Verfahren ..' continue; int i = m_Table.AddString(pgwi->batchNr); m_Table.SetItemData(i, (DWORD)pgwi); //(DWORD)&(*(gwis.arr[iStatus][k]))) //m_Table.SetItemBitmap(i, bmp); HBITMAP hbm; CBitmap bmp; bmp.LoadBitmap(IDB_WARN); hbm = (HBITMAP) bmp; SFTTREE_CELLINFOPARM cip; cip.version=4; cip.index=i; cip.iCol=0; m_Table.GetCellInfo(&cip); cip.Cell.hBmp = hbm; m_Table.SetCellInfo(&cip); m_Table.SetText(i, 0, pgwi->warnung); m_Table.SetText(i, 1, pgwi->batchNr); m_Table.SetText(i, 2, pgwi->dateiname); m_Table.SetText(i, 3, pgwi->dokName); m_Table.SetText(i, 4, pgwi->beschreibung); m_Table.SetText(i, 5, pgwi->sachgebiet); m_Table.SetText(i, 6, pgwi->erstelltAm); m_Table.SetText(i, 7, pgwi->erstelltVon); m_Table.SetText(i, 8, pgwi->anzSaetze); } } print("mTable.GetCount=%d\n", m_Table.GetCount()); // m_Table.SetTreeLineStyle(SFTTREE_TREELINE_NONE); // No tree lines // m_Table.MakeColumnOptimal(-1); // Make column widths optimal // m_Table.MakeRowHeaderOptimal(); // Make row header width optimal m_Table.RecalcHorizontalExtent(); // Update horizontal scroll bar m_Table.SortDependents(-1, sortCol, SortCallback); // all items at the root level are sorted }Das komische an der Sache ist, das in den Spalten zwar entsprechend Platz für IDB_WARN vorgesehen wird, allerdings bleibt der Bereich weiss. Kennt irgendjemand dieses Problem?
Vielen Dank schonmal im Vorraus.Grüße, Manuel Kipke