doublemax wrote: ↑Sat Jul 03, 2021 12:59 am
Do you need to display text in that column? If not, did you try AppendBitmapColumn()?
No I don't need text in this column only bitmap.
I tried AppendBitmapColumn(), but the bitmaps in the columns are not showing up,
Here is the relevant code,
Code: Select all
m_SampleListView->AppendBitmapColumn(wxBitmap(ICON_COLOURED), 0, wxDATAVIEW_CELL_ACTIVATABLE, 30, wxALIGN_CENTER, wxDATAVIEW_COL_RESIZABLE);
m_SampleListView->AppendTextColumn("Filename", wxDATAVIEW_CELL_INERT, 320, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE);
m_SampleListView->AppendTextColumn("Sample Pack", wxDATAVIEW_CELL_INERT, 200, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE);
I did not understand what the 2nd argument is for, it says model_column, what is model_column.
Here is how I insert the image, with some help from this post -
viewtopic.php?t=41192
Code: Select all
wxVector<wxVariant> data;
// wxVariant icon;
// icon << wxDataViewIconText(wxEmptyString, wxIcon(ICON_GREYSCALE));
if (tags.IsFileValid())
{
data.clear();
data.push_back(wxVariant(wxBitmap(ICON_GREYSCALE))); // <-----------
data.push_back(filename);
data.push_back(sample.GetSamplePack());
EDIT:
I got it working, I had to change one of my function which loads the database back to application, it was still inserting,
Code: Select all
wxVariant icon_c, icon_gs;
// icon_c << wxDataViewIconText(wxEmptyString, wxIcon("../assets/icons/icon-hive_16x16.png"));
// icon_gs << wxDataViewIconText(wxEmptyString, wxIcon("../assets/icons/icon-hive_16x16-gs.png"));
I changed it to,
Code: Select all
wxVariant icon_c, icon_gs;
// icon_c << wxDataViewIconText(wxEmptyString, wxIcon("../assets/icons/icon-hive_16x16.png"));
// icon_gs << wxDataViewIconText(wxEmptyString, wxIcon("../assets/icons/icon-hive_16x16-gs.png"));
icon_c = wxVariant(wxBitmap("../assets/icons/icon-hive_16x16.png"));
icon_gs = wxVariant(wxBitmap("../assets/icons/icon-hive_16x16-gs.png"));
Also had to change these, in multiple places, to toggle the image from coloured to greyscale, so it acts like a toggle column.
Code: Select all
m_SampleListView->SetValue(wxVariant(wxBitmap(ICON_GREYSCALE)), selected_row, 0);
So I guess this is fixed.