Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
310
EditorWithMask usage in UltraWinGrid
posted

Hi,

I have a requirement to support data validation within my editor control.  To support this I've created a -class -which derives from Infragistics.Win.EditorWithMask.

I attach this editor to the appropriate grid cell when the Grid row is initialized. I configure it to display the mask - DisplayFormattedTextWhenNotFocused = true

In the InitializeRow event, I set this custom editor into the cell.

Cell.Editor = mUnitNoEditor
Cell.Column.MaskInput = "AAA\.AA\.AA" 

In the InitializeLayout of the grid, I set this column up to return all characters :

.UseEditorMaskSettings = True -(edit- ' my first mistake)
.MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeBoth
.MaskDataMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeBoth

And yet, I only see the mask when I am editing the cell.  When the cell is not actively edited, the mask characters are removed. 

This is not what I want.  I want to see the mask and the characters at all times and I want the value of the column to be this as well.  ( It is this when I set the value, but the mask characters are stripped out)

 Please tell me where I've gone wrong.  Thanks.

 Edited:          Summary of where I went wrong, (BTW - very frustrating experience with the half-there half-not there help docs and all the many control choices available - Why Me Lord.)

  1. if you set the column to use a mask, let the column control the mask - don't try to do it in the editor control.
  2. if you set an editor derived from EditorWithMask, don't expect you can set a mask value.  The mask value will be whatever you've assigned to the column.  (apparently?)
  3. use the OnAfterActivateCell event to set any custom data you need to validate the control
  4. don't try to set the editor in InitializeRow, setting editor in the cell is resource hog
  5. do set the editor in InitializeLayout - although because InitializeLayout is executed after InitializeRow you will have to set your cell validation data in the OnAfterActivateCell event.
Parents Reply Children
No Data