Drawing in an SDI view?
-
I have an SDI app where I am using Chris Maunder's MFC grid control. In View::OnInitialUpdate() I init some headers of the grid. In View::OnDraw() I try to fill the grid with data from the Doc. But I only get some kind of frames around the cells instead of cells with data in. And I cannot manually edit these cells after trying to fill them. Am I going about it the wrong way or what :confused: Cheers, Fredrik
Sonork ID: 100.11430:PhatBoy
"Felix qui potuit rerum cognoscere causas." -
I have an SDI app where I am using Chris Maunder's MFC grid control. In View::OnInitialUpdate() I init some headers of the grid. In View::OnDraw() I try to fill the grid with data from the Doc. But I only get some kind of frames around the cells instead of cells with data in. And I cannot manually edit these cells after trying to fill them. Am I going about it the wrong way or what :confused: Cheers, Fredrik
Sonork ID: 100.11430:PhatBoy
"Felix qui potuit rerum cognoscere causas."Hello! If you have a view which uses Chris Maunder's MFC grid control, then you the grid control should fill up the entire view area, and thus perform all the drawing. You should not put anything into OnDraw, because that function either will never be called, or will be called multiple times, giving you undesireable results. Read the part in Chris Maunder's article about how to have a grid control in a view to make sure you have properly implemented sizing the control, etc. In order to add data to the grid, I suggest one of two things: 1) Add the data in your OnInitialUpdate function, along with your initialization of the grid headers. 2) Make another function where you add the data and call this function sometime later in your application. In other words, you shouldn't use OnDraw to fill the grid. :-D Bit of a long-winded answer, but I hope that helps! ;P (The part of Chris's article about having a grid control in a view is very useful to get that up and running properly) P.S. I like your signature: 'Felix qui potuit rerum cognoscere causas.', which means 'Happy is he who is able to know the causes of things.'. Take a look at my sig! :cool: Sincerely, Alexander Wiseman Est melior esse quam videri It is better to be than to seem