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
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    perrb01 said:
    To support this I've created a control which derives from Infragistics.Win.EditorWithMask.

    EditorWithMask is not a control. Did you mean to say you derived a class from EditorWithMask?

    perrb01 said:
    Cell.Editor = mUnitNoEditor
    Cell.Column.MaskInput = "AAA\.AA\.AA" 

    This is a little odd. You are assigning the editor to the cell, but you are setting a mask on the entire column. This probably has nothing to do with the issue at hand, but I just want to make sure you are aware that the Column property on the cell applies to the entire column, but just the one cell. If you want to apply your editor to the whole column, you would be better off using the InitializeLayout event and just setting it once for the whole column instead of on each cell in InitializeRow. If you only want this editor on certain cells, then you should set the Mask property on the editor itself and then you will need an Editor Control, not just a class, and that means that you won'y be able to do any special validation on the editor-level.

    perrb01 said:
    .UseEditorMaskSettings = True
    .MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeBoth
    .MaskDataMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeBoth

    UseEditorMaskSettings means that the column will use the mask settings of the editor and the properties on the grid will be ignored. So MaskDisplayMode and MaskDataMode here will have no effect. If you want these properties to work, don't set UseEditorMaskSettings.

    You seem to be mixing up a lot of different properties on different objects here. You are setting properties on the editor, cell, and column in very odd and even contradictory ways. There's so much going on here that's hard for me to know where to start. Perhaps if you explained in more detail exactly what you are trying to achieve, I could tell you the simplest way to do it.

     

     

     

     

     

     

Reply Children