Hola Rofocale.
No conozco el componente TcxTextEdit, y este comentario:
Me hace dudar si hago bién al suponer que queres limitar el ingreso a dos caracteres luego del separador decimal. Si es eso, fijate si podés adaptar este código para el TcxTextEdit:
Código Delphi
[-]
procedure TForm1.EditKeyPress(Sender: TObject; var Key: Char);
var
PosDe: Integer; LenDe: Integer; begin
if Key = '.' then Key:= ','; if not(Key in ['0'..'9', #8, ',']) then begin
MessageBeep(MB_ICONERROR);
Key:= #0
end
else
begin
PosDe:= Pos(',', TEdit(Sender).Text); if PosDe > 0 then
begin
LenDe:= Length(TEdit(Sender).Text) - PosDe; if(LenDe > 1) and (Key in ['0'..'9']) and (TEdit(Sender).SelStart > PosDe-1) then
Key:= #0;
end;
end;
end;
Pienso que cambiando los cast TEdit(Sender) por TcxTextEdit(Sender) debería funcionar si este último tiene la propiedad SelStart.
Saludos.