I would like to create an iOS App, with a fixed StringGrid. Every cell of this thing should only accept numeric values. For this I want to set the KeyboardType to vktNumberPad...but so far have not found a point of entry for this. Does anyone here have a clue on how to do this?

OK, so following Mikes hint I started to use my own column class.

TNumEditCell = class(TEdit)
end;
TNumberColum = class(TStringcolumn)
private
  function CreateCellControl: TStyledControl; override;
end;

And here comes the baffling part:

function TNumberColum.CreateCellControl: TStyledControl;
begin
  result := TNumEditCell.Create(Self);
  TNumEditCell(result).KeyboardType := vktNumberPad; // <- is undeclared!! What?!
  TNumEditCell(result).OnChange := DoTextChanged;
end;

Our good friend the compiler does not know what vktNumberPad is. Not even if I point him to it with a telephone pole FMX.Types.TVirtualKeyboardType(vktNumberPad). I guess I'm doing something wrong :(

Final edit: Indeed I did something wrong, as Peter pointed out. So with the code above and Peters hint everything works. Ummm...how do I finish this question?

有帮助吗?

解决方案

Compiler doesn't know about vktNumberPad because you aren't addressing it correctly. use : TNumEditCell(result).KeyboardType := TVirtualKeyboardType.vktNumberPad

其他提示

Just go to de column properties and in Column style select Currency column, or Float Column, depending on the type of column will be the kind of Keyboard showsen.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top