Home Forums WinForms controls Xceed Grid for WinForms Some custom editors not working as expected

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

    I’ve got a problem with some custom controls, specifically a custom DatePicker control I wrote. I implemented ICellEditor and ICellViewer, and to begin with, everything seemed just peachy. But now, it seems as though I have to set the value twice for it to actually register as the cell value.

    My implementation of ICellEditor.SetControlValue and ICellEditor.GetControlValue looks like the following:

    public void SetControlValue(object value, IFormatProvider customFormatProvider)
    {
    this.Value = (value != DBNull.Value) ? (DateTime)value : this.NullDate;
    }

    public object GetControlValue()
    {
    return this.Value;
    }

    Any ideas as to what might be wrong?

    Imported from legacy forums. Posted by macke (had 4483 views)

    User (Old forums)
    Member
    Post count: 23064

    Actually, there seems to be a problem with a custom ComboBox as well, but only in some places. This is very weird. These things have just recently popped up as issues, before it all worked flawlessly. Another weird thing to bake your noodle is that the ComboBox in _one_ instance doesn’t work properly at all, you can’t set cell values with it it seems, it just reverts to whatever is the standard value. But not in all cells. Only in one specific cell. In all the other cells where the same control is used (but not the same instance) it works flawlessly. The DatePickers are however, totally borked.

    Any clues?

    Imported from legacy forums. Posted by macke (had 290 views)

    User (Old forums)
    Member
    Post count: 23064

    I noticed that putting a breakpoint on the line in SetControlValue makes it break before you actually set a value. It breaks as soon as the control is activated, but not after you’ve actually set a value. Why is that? And is it infact in this function where the cell value is set? I can’t really figure out how the cell value is set using the ICellEditor and ICellViewer interfaces. I’m very confused =(

    Imported from legacy forums. Posted by macke (had 255 views)

    User (Old forums)
    Member
    Post count: 23064

    I also noticed just now, that this happens with a specific detailgrid. None of the other grids, detail or master, work just fine, no issues whatsoever with the controls in those. And they are used in the EXACT same way in those. So does this mean it must be something wrong with the detailgrid, or is it my datasource? I’m binding the grid to a dataset. I’ll keep investigating…

    Imported from legacy forums. Posted by macke (had 218 views)

    User (Old forums)
    Member
    Post count: 23064

    I did some changes to the dataset, and noticed the problem seemed to have disappeared. For a short while at least. It then reappeared in all it’s glory. I still have no clue as to what’s causing this, but I’m guessing it’s something wrong with the dataset.

    Has anyone experienced anything like this?

    Imported from legacy forums. Posted by macke (had 421 views)

    User (Old forums)
    Member
    Post count: 23064

    To answer your question about SetControlValue and GetControlValue: SetControlValue is called when the editor is activated (the value of the cell is transfered to the editor), and GetControlValue is called when the editor is deactivated (the value of the editor is transfered back to the cell).
    I’m sorry but I don’t know what’s causing your problem.

    Imported from legacy forums. Posted by Tommy (had 224 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks tommy, you actually led me onto the right track. Using that information I was able to step through my code and eventually figure out what the problem was.

    My problem wasn’t with the grid or the dataset, but with an event handler which had a bug in it where it basicly just un-did any operations on that specific detailgrid.

    Now I have a different issue though, none of my insertionrows works! ;oP
    Nothing happens when I true to edit their cell values, it’s as if they can’t be selected. And indeed the rows did have CanBeSelected set to false, but even with it set to true, nothing is happening. Click and DoubleClick events gets fired, but editing never begins. Any ideas?

    Imported from legacy forums. Posted by macke (had 5438 views)

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