Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

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?

like image 700
Sherlock70 Avatar asked Jun 18 '13 06:06

Sherlock70


People also ask

How do I program my keyboard to type text?

With AutoHotkey, any key on your keyboard can be programmed to type any text you desire. You have little programs (called scripts) running in your taskbar which change what a key-press on the keyboard does. They run silently in the background and get your keyboard working for you for a change. Find out where the program looks for your scripts.

Should the text entry raise up when typing in forms?

When developing forms, a good practice is that when the keyboard is shown we shouldn’t hide the text entries behind it. Instead of that the text entry should raise up while typing.

How to hide text entries behind the keyboard in Xamarin forms?

When developing forms, a good practice is that when the keyboard is shown we shouldn’t hide the text entries behind it. Instead of that the text entry should raise up while typing. This is pretty easy to do in Xamarin Forms, by just adding the entry inside the Scrollview and that’s it.


1 Answers

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

like image 184
Peter Avatar answered Oct 21 '22 15:10

Peter