delphi 设置文本框中光标的位置在最后  
官方Delphi 学习QQ群: 682628230(三千人)
频道

delphi 设置文本框中光标的位置在最后


设置光标的位置

 edt1.SelStart := Length(edt1.Text);
 edt1.SelLength := length(edt1.Text);

 

虚拟键盘的点击事件

//1、操作的事件

procedure TForm1.JPSR(s:String);
var
  i: integer;
  p: string;
begin
  if s='Del' then
  begin
    i := Length(edt1.Text);
    i := i-1;
    edt1.Text := copy(edt1.Text,1,i);
  end
  else
  begin
    edt1.Text := edt1.Text + s;
  end;
  edt1.SelStart := Length(edt1.Text);
  edt1.SelLength := length(edt1.Text);
end;

2、//模拟删除最后一个字节

procedure TForm1.lbl3Click(Sender: TObject);
var
  s: string;
begin
  s := 'Del';
  JPSR(s);
end;

3、//输入字节字节

procedure TForm1.lbl1Click(Sender: TObject);
var
  s: string;
begin
  s := '1';
  JPSR(s);
end;
————————————————

原文链接:https://blog.csdn.net/xiongmao000738/article/details/6804500

推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号

执行时间: 0.055272102355957 seconds