作成日: 2018/05/17 最終更新日: 2018/07/06
文書種別
不具合
状況
修正済み
詳細
最小値/最大値を設定した数値型セルに対して、セルが非編集の状態で数値を入力すると、最小値に強制されます。
たとえば、最小値を「100」、最大値を「500」に設定した数値型セルに対して、「200」を入力しようとすると、はじめの「2」を入力した時点で最小値の「100」に強制されます。
なお、編集状態で入力した場合には、この事象は発生しません。
たとえば、最小値を「100」、最大値を「500」に設定した数値型セルに対して、「200」を入力しようとすると、はじめの「2」を入力した時点で最小値の「100」に強制されます。
なお、編集状態で入力した場合には、この事象は発生しません。
回避方法
Service Pack 1(v2.0.2018.0706)で修正済みです。
Service Pack 1(v2.0.2018.0706)より前のバージョンでは次の回避方法が有効です。
------------------------------------------
数値型セル(NumberCellType)の動作を変更します。
◎サンプルコード(C#)
Service Pack 1(v2.0.2018.0706)より前のバージョンでは次の回避方法が有効です。
------------------------------------------
数値型セル(NumberCellType)の動作を変更します。
◎サンプルコード(C#)
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
MyNumberCellType num2 = new MyNumberCellType();
num2.FieldSet = new NumberFieldSet("##0,,,-,");
num2.WatermarkDisplayNull = "<100以上999以下>";
num2.WatermarkDisplayNullForeground = new SolidColorBrush(Colors.LightGray);
num2.MinValue = 100;
num2.MaxValue = 999;
gcSpreadGrid1.Columns[1].CellType = num2;
this.PreviewTextInput += MainWindow_PreviewTextInput;
this.TextInput += MainWindow_TextInput;
}
static bool isTextInputing = false;
private void MainWindow_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
var spread = (e.Source as GcSpreadGrid);
var textEditor = (e.OriginalSource as System.Windows.Controls.TextBox);
if (spread != null && textEditor != null && (spread.ActiveCell.InheritedCellType is MyNumberCellType) && spread.EditElement == null)
{
isTextInputing = true;
var parent = VisualTreeHelper.GetParent(textEditor);
while (parent != null && !(parent is NumberEditElement))
{
parent = VisualTreeHelper.GetParent(parent);
}
var editor = parent as NumberEditElement;
if (editor != null)
{
editor.Value = null;
}
}
}
private void MainWindow_TextInput(object sender, TextCompositionEventArgs e)
{
isTextInputing = false;
}
public class MyNumberCellType : NumberCellType
{
protected override void SetEditValue(FrameworkElement editElement, object value)
{
if (!isTextInputing)
{
base.SetEditValue(editElement, value);
}
}
}
旧文書番号
82682