Home Forums WinForms controls Xceed Grid for WinForms SetControlValueCore not called in ImageViewer

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15775 |

    Hi Andre,

    Hey I’ve got an ImageViewer class to handle the display of a set of cells in a grid (Xceed Grid 3.0) and this override is being called:

    protected override void System.Drawing.Image GetImageCore()

    but this override is not being called

    protected override void SetControlValueCore()

    The cell is a custom class derived from DataCell
    The cell is part of a custom class derived from DataRow

    The viewermanager is assigned when adding a new row

    the custom cell class has overridden PaintForeground
    the custom cell class has overridden PaintBackground

    Imported from legacy forums. Posted by camera (had 5014 views)

    User (Old forums)
    Member
    Post count: 23064

    Hmm. I’ve looked into this some more and even though ImageViewer inherits from CellViewManager, SetControlValueCore() doesn’t seem to be called ever. Could this be a bug?

    Imported from legacy forums. Posted by camera (had 363 views)

    User (Old forums)
    Member
    Post count: 23064

    Could [not] overriding CreateControlMode() have something to do with this behavior?

    Imported from legacy forums. Posted by camera (had 281 views)

    User (Old forums)
    Member
    Post count: 23064

    * blank look into space. look at wristwatch. *

    Imported from legacy forums. Posted by camera (had 273 views)

    Xceed Support
    Member
    Post count: 5658

    The SetControlValueCore is only called if the CellViewerManager uses a sub-control. The ImageViewer does not use any sub-control, it only overrides the getImageCore to extract the image from the cell value.

    In the Paint, the received image is painted. After, if the viewer uses a control, the control is painted. In this case (ImageViewer), there is no control to paint.

    If you the SetControlValueCore to be called, you need to use the CellViewerManager’s constructor that takes a control and a property as parameters.

    Imported from legacy forums. Posted by CharlesB (had 221 views)

    User (Old forums)
    Member
    Post count: 23064

    Excellent Excellent reply as usual, Charles. This makes perfect sense.

    Of course the fact that ImageViewer inherits from CellViewerManager but then suppresses the base class’s SetControlValueCore method is unusual but understandable. You might want to mention this in your documentation. I don’t see this mentioned anywhere.

    As a workaround, I am “manually” calling a SetValue function from my Paint call.

    AH — you state that If I want SetControlValueCore to be called I need to [use a CellViewerManager class]. I tried that. When I changed my ImageViewer to a CellViewerManager, then my GetImageCore() wasn’t called. [Because, of course, if I wanted GetImageCore() to be called, then I would need an ImageViewer class.] This is Catch-22.

    I need a class that calls BOTH GetImageCore() and SetControlValueCore(). I don’t think Xceed has one of those. So for now, my GetImageCore() will set the cell value AND return an image.

    If you know of a class that calls both methods, please let me know. Thanks!

    Imported from legacy forums. Posted by camera (had 322 views)

    Xceed Support
    Member
    Post count: 5658

    The SetControlValueCore will assign a property of the control through the viewer from the value of the corresponding cell. On the other hand, the GetControlValueCore will set the value of the cell through the editor (will get the value of the control to the cell).

    The GetImageCore (like GetTextCore) is only called when there is no control assigned to the CellViewerManager.

    Ultimately, I am not completely sure to understand what you are trying to achieve. If you want to set an image, you need to set the control used by the CellViewerManager (a control that accepts image and a value). If you need to paint some text and an image, you can override GetImageCore and GetTextCore to return the text to paint depending on the cell value.

    Imported from legacy forums. Posted by CharlesB (had 6260 views)

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.