在StringGrid中輸入值時是否有辦法設置鍵盤類型?

[英]Is there a way to set the Keyboard Type when entering a value in a StringGrid?


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?

我想創建一個iOS應用,固定的StringGrid。每個單元格只接受數值。為此,我想將KeyboardType設置為vktNumberPad…但到目前為止,還沒有找到這方面的切入點。有人知道怎么做嗎?

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

根據Mikes的提示,我開始使用我自己的列類。

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 :(

我們的好朋友編譯器不知道vktNumberPad是什么。即使我用電線桿FMX.Types.TVirtualKeyboardType(vktNumberPad),我也不會把它指向它。我想我做錯了什么

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?

最后編輯:正如彼得指出的,我確實做錯了什么。上面的代碼和彼得斯提示一切都可以。嗯……我如何完成這個問題?

1 个解决方案

#1


2  

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

編譯器不知道vktNumberPad,因為您沒有正確地尋址它。用途:TNumEditCell(結果)。KeyboardType:= TVirtualKeyboardType.vktNumberPad


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2013/06/18/72f6efd55599c725c8f80fd2f8089dc3.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com