AD
Administrator
Syncfusion Team
July 7, 2005 02:05 PM UTC
If you need to get at it through the designer for your outer usercontrol, then it will have to be a public property of that class. And this suggests that this DataSource will not vary from cell to cell in any of the grids as there will only be a single property. If down where you need to know this datasource, you have knowledge of your ''inner'' usercontrol, then you could probably use the UserControl.Tag property to pass this DataSource from the outer UC.DataSource to the inner UC.Tag, and finally have it available in the OnDraw through the instance of the inner UC via its Tag property.
MC
Martin Cyr
July 7, 2005 02:41 PM UTC
That''s my problem, I don''t know how I should access the inner UC. I could declare it in the outter UC, but then I don''t know how to add it to the correct cell, or I can declare it in the cell, but then I don''t know how to access it from the outter UC. Just to make it more clear, here is a demo. On another subject, another problem I encountered is that the cell I selected from one of the inner grid cell gets a border in every other grid cell too.
MC
Martin Cyr
July 7, 2005 03:23 PM UTC
Sorry forgot to attach the demo... Silly me...
or maybe not so much :
"Web site found... Waiting for reply"
I justed waited 5 mins for it, but it''s not loaded yet. Is there a problem with the site?
MC
Martin Cyr
July 7, 2005 04:12 PM UTC
My biggest problem, from what I understand, is that I seem to loose track of the parent when I create a cell embeded grid. I don''t know how to access the parent grid from the cells inside the cell embeded grid.
AD
Administrator
Syncfusion Team
July 7, 2005 04:49 PM UTC
Are you parenting the embedded grid to the parent grid (ie, parentGrid.Controls.Add(embeddedGrid)? If so, you use embeddedGrid.Parent to get at the parentGrid.
We have had soem glitches with uploads to our website this morning, but I think that has been corrected now.
MC
Martin Cyr
July 7, 2005 06:12 PM UTC
Just great, exactly what I wanted!
But now that I can access the data, I realize that I might have a problem : is there a way that from the cells within the CellEmbededGrid, I could know the location of the CellEmbededGrid in it''s parent grid?
Also, I need to know more about the conceptual approach. How should I provide the data to my UC? I can now access the data from the UC, but I want to do a nicer approach to providing data to my control. I could, from the OnDraw event, do like the RepeaterCell sample and simply call a function to put the data in the control, but I''d like it if I could create a more professionnal, reusable control. Less hard-coding, more flexibility.
MC
Martin Cyr
July 7, 2005 06:44 PM UTC
Btw, the upload script still doesn''t answer.
MC
Martin Cyr
July 7, 2005 07:12 PM UTC
I''m getting closer. I found some row/col info in the cellRenderer for the parent, but it only has the col/row of the selected cell (the active CellEmbededGrid), so I don''t know how to handle the inactive (static) control.
MC
Martin Cyr
July 7, 2005 08:00 PM UTC
Got it!
Just adding two members in the parent renderer that holds row/col at OnDraw() wich I can then query in the CellEmbededGrid solves most of the problem. Now I realise that the parent renderer hasn''t finished the rendering job yet, so I get the old values, as if the parent renderer haven''t been called since the cell change, but the child renderer is still rendering. I tried to handle the CurrentCellChanged event in the parent grid, but it never seems to get fired, is it because I inherited from GridControl, is that wrong?
MC
Martin Cyr
July 7, 2005 08:25 PM UTC
I realized my mistake, CurrentCellChanged should''ve been CurrentCellActivated in the last post. But the problem is the same, the grid doesn''t seem to realise that the current cell has changed ie. the CurrentCell property on the grid doesn''t reflect the actual currently selected cell, I mean that when the CurrentCellActivated event gets fired, it''s still the old CurrentCell row and col that are reported.
MC
Martin Cyr
July 7, 2005 08:42 PM UTC
Wow, this is looking more and more like a novel. Anyways, I found that the event I was looking for is CurrentCellMoved, now the CurrentCell is the right one, but the OnDraw for the child grid cells is already done wrong. The values used in the OnDraw to identify the row/col are now good AFTER the CurrentCellMoved occurs but the draw happens before this update is made. I tried to refresh about every thing from the renderers to the cells to the grids, but no good.
Also, when the form is minimized or scrolled too quick, the rendering stops working right.
And I still can''t upload!
AD
Administrator
Syncfusion Team
July 7, 2005 10:34 PM UTC
I am not sure I follow everything, but you want to know the parent grid''s row and col of the cell that holds the embedded grid when you are drawing cells in the embedded grid. Is this what you need?
Try setting the row/col information into the embeddedgrid.TableStyle.Tag object. Then this values should then be available in any style.Tag object for any cell in the embedded grid in any method that gets a style object passed to it (like OnDraw).
MC
Martin Cyr
July 8, 2005 12:58 PM UTC
How should I set the tag? I mean where/when? I could do it in the parent cell renderer, but is it the best thing to do?
MC
Martin Cyr
July 8, 2005 01:39 PM UTC
If you''re suggesting that I should store a Point() structure in the tag of the cellembededgrid wich I would define in the renderer of the previous grid, then I tried that already. It works fine EXCEPT for the currently selected cell. From what I see, the parent grid renderer hasn''t been called yet when the inner grid renderer is called, so I still have the row/col values from the previously rendered cell.
MC
Martin Cyr
July 8, 2005 02:03 PM UTC
After closer inspection, correct me if I''m wrong, but I understand that when the current cell changes the following happens : the old cell is deselected and deactivated, then CurrentCellMoving, redrawn in its static state, then the new cell gets a OnDraw, but not the inner cell yet, the renderer rather goes back to the last cell, redraw it again (??? why ???) then the inner cell get drawn. But since the position is obtained from the parent renderer, I''m stuck with the position of the last drawn cell, wich is not the good one...
And this time, since the upload script is fixed, I can show you what I mean!! Try moving around (oh and also try minimize/restore, what should I do to fix the refresh issue?)
GridTest_689.zip
AD
Administrator
Syncfusion Team
July 8, 2005 02:07 PM UTC
The cellrenderer.OnInitialize method should be called before you try drawing any part of the active cell. That method has the row/col passed into it. You could try saving these values at that point so they are available later when the active cell is drawn.
MC
Martin Cyr
July 8, 2005 03:23 PM UTC
Please check the project!
I don''t know how the OnInitialize would be of any use to me. My problem seems to be caused by the OnDraw sequence with multiple layer of grids.
AD
Administrator
Syncfusion Team
July 8, 2005 05:30 PM UTC
I worked with your project for a while, and have it working a little better by listening to the currentcellmoved event within the renderer class. Here are teh modified files back.
http://www.syncfusion.com/Support/user/uploads/GridTest_c028842d.zip
But it is not perfect. I think the main problem is that the PlanificationCellRenderer class does not have 2 embeddedgrids, one ot handle the static drawing and one ot handle the active drawing. In your embeddedgrid cell, you are trying to share instances of the cell control across many cells. If you want to do this, then you need a grid to handle the static drawing and a grid to handle the active drawing. You will notice in our sample where we did the GridInCell, we avoided this complication by having an new embeddedgrid instance for each cell that used this celltype. You are not doing this (and would not want to do this as you have many such cells).
MC
Martin Cyr
July 11, 2005 12:40 PM UTC
Wow! thanks for the help! I''ll keep on working from what you said...
Again, THANKS! You definately provide the best support I EVER seen.
MC
Martin Cyr
July 11, 2005 01:15 PM UTC
About the resize/refresh, anytime one of those events are fired, only the currentcell gets redrawn in the top left corner of the form and the rest of the grid disapears. What''s happening?
MC
Martin Cyr
July 11, 2005 07:54 PM UTC
It''s ok, I fixed it. I rewrote the whole thing. Didn''t changed squat, but now the resize works and the selection change works too without the change you did. Sorry for making you work for nothing, but I still don''t even understand why it works now and it didn''t earlier.
Perhaps it''s useless, but I''ll include the code, just in case it''s usefull to anyone.
GridTest_2679.zip