Some novice issues with a custom CCustomGrid subclass


Author: Ian Schraeder Asked: 2 years 2 months 21 days 2 hours 14 minutes ago Viewed: 486 times Activity: 2 years 2 months 20 days 13 hours ago

0

Hello, in trying to learn the framework I have created a subclass of CCustomGrid in a library project. The only real changes made to the class are in the constructor and CreateItem() functions, as listed below: CByDesignGrid::CByDesignGrid() : standard::CCustomGrid(L"ByDesignGrid") { setColumns(4); setRows(10); setDefaultColumnResizable(true); setDefaultRowResizable(true); setDefaultColumnWidth(100.0f); setDefaultRowHeight(100.0f); setService(new standard::CCustomGridService(this), true); CControl::setSize(PointF{ 300, 300 }); } IListItem* CByDesignGrid::CreateItem(const int column, const int row) { if (column) return new standard::CListItemLabel(L"TestText"); return new standard::CListItemIcon(); } At first glance, placing this in a form runs fine. The first column is blank white rectangles, and the rest are captions with the "TestText" previously specified, but it does not resize the rows, the hover animation lags slightly, and pushing an arrow key crashes the program giving a "vector subscript out of range error". I cannot tell if I need to implement something in a service, or how this is handled. The other grids do not seem resizable either, which is odd since they have this property. Any help would be appreciated as this rookie tries to figure this out.

add comment


0

Answered by Ian Schraeder at Feb 5, 2022, 9:46:07 PM

I've resolved most of these issues. I don't know why I felt so lost last night. Thank you.

add comment