GrapeCity.Win.MultiRow.v80 アセンブリ > GrapeCity.Win.MultiRow 名前空間 : FocusProcess クラス |
Public Class FocusProcess Inherits CellValidateAction Implements INamedObject
public class FocusProcess : CellValidateAction, INamedObject
このアクションは、GcMultiRow.CellValidatingイベントのCancelプロパティをtrueに設定するのとよく似ています。ただし、DoActionReasonを変更した場合、このアクションの動作は独特です。たとえば、ValidateReasons.EndEditとValidateReasons.CancelEditを追加した場合は、たとえ現在のセルから離れなくても、検証対象のセルの編集状態は終了できません。
このアクションは、PreventFocusLeaveプロパティの値をtrueに設定した場合にのみ有効です。
void setRegularExpressionValidator_Click(object sender, EventArgs e) { Template template = Template.CreateGridTemplate(1); RegularExpressionValidator regularExpressionValidator = new RegularExpressionValidator(); //Define a regular expression for currency values. regularExpressionValidator.Expression = @"^-?\d+(\.\d{2})?$"; regularExpressionValidator.RegexOptions = System.Text.RegularExpressions.RegexOptions.CultureInvariant; FocusProcess focusProcess = new FocusProcess(); focusProcess.PreventFocusLeave = true; //When CurrentCell move to another Row, the action will be done. focusProcess.DoActionReason = ValidateReasons.RowValidating; regularExpressionValidator.Actions.Add(focusProcess); template.Row.Cells[0].Validators.Add(regularExpressionValidator); this.gcMultiRow1.Template = template; label .Text = @"The RegularExpressionValidator.Expression is '^-?\d+(\.\d{2})?$', which expresses one currency value, input '-!2.05', then move CurrentCell to another Row to trigger validation(DoActionReasion is RowValidating), You will find the focus cannot move out, input '-12.05',the focus can move to another Row."; }
Private Sub setRegularExpressionValidator_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setRegularExpressionValidator.Click Dim template As Template = template.CreateGridTemplate(1) Dim regularExpressionValidator As New RegularExpressionValidator() 'Define a regular expression for currency values. regularExpressionValidator.Expression = "^-?\d+(\.\d{2})?$" regularExpressionValidator.RegexOptions = System.Text.RegularExpressions.RegexOptions.CultureInvariant Dim focusProcess As New FocusProcess() focusProcess.PreventFocusLeave = True 'When CurrentCell move to another Row, the action will be done. focusProcess.DoActionReason = ValidateReasons.RowValidating regularExpressionValidator.Actions.Add(focusProcess) template.Row.Cells(0).Validators.Add(regularExpressionValidator) Me.gcMultiRow1.Template = template label.Text = "The RegularExpressionValidator.Expression is '^-?\d+(\.\d{2})?$', which expresses one currency value, input '-!2.05', then move CurrentCell to another Row to trigger validation(DoActionReasion is RowValidating), You will find the focus cannot move out, input '-12.05',the focus can move to another Row." End Sub
System.Object
GrapeCity.Win.MultiRow.CellValidateAction
GrapeCity.Win.MultiRow.FocusProcess