Hello Everyone
I have a UltraGrid filled with a singleband DataSet. What I need now, is to disable a row if a certain value in a row is found.
How can I do that and would that be done in the InitializeLayoutEventHandler or somewhere else?
Furthermore, I need to change the available ToolStripMenuItems when the user clicks on a disabled row. I am looking for this since quite some time every now and then but still I couldnt find a solution on how to do this in a clean way.
Thanks
maschlegel said:I have a UltraGrid filled with a singleband DataSet. What I need now, is to disable a row if a certain value in a row is found.
The InitializeRow event would be the best place to do this. Just set the Activation proeprty on the row.
maschlegel said:Furthermore, I need to change the available ToolStripMenuItems when the user clicks on a disabled row. I am looking for this since quite some time every now and then but still I couldnt find a solution on how to do this in a clean way.
What part of this are you having trouble with?
The only part of this that seems like it might be a bit tricky it that wou will need to use MouseDown to identify the row the mouse is over. Here's how you do it: HOWTO:UltraWinGrid Mouse Position and Row Identification
Thanks for the help. I modified it (InitialiyeLayout) in a way that only the foregroundcolor gets changed (light gray for locked data).
Now I have another problem. When data is locked we still present this but all controls are then disabled. An administrator can unlock this elements though which works and the grid reflects that updated value right away. Only the forecolor is not changed back to black. Of course I need to have an event for that since InitializeLayout is only called once, so I looked around and found AfterRowUpdate should do the trick, but when my presenter is changing the row this event is not fired by the grid (event though the cell gets changed. The same goes for AfterCellUpdate.
So how can I listen to a changeEvent on my rows in order to update the forecolor again?
Thanks again
maschlegel said:I need to have an event for that since InitializeLayout is only called once
If you need to apply a setting to a row based on the value in the row, you should be using InitializeRow, not InititializeLayout. InitializeRow will fire every time a value in the row changes - it doesn't just fire once.
maschlegel said:AfterRowUpdate should do the trick, but when my presenter is changing the row this event is not fired by the grid (event though the cell gets changed. The same goes for AfterCellUpdate.
These events will only fire if the value of a cell is changed through the grid. If you are changing the value of a cell in the data source, they will not fire, because the data source presumably has it's own events and it doesn't make sense for the grid to repeat them. But again, InitializeRow is the perfect event for things like this, since it fires every time a value in the row changes.