B Banny Unregistered / Unconfirmed GUEST, unregistred user! 2000-08-04 #1 请问我如何通过程序控制一个edit里面的光标的位置?比如说我的光标在edit的最后面, 如果我输入了'a',那么光标就移动到edit的最前面,可以吗?
W wint Unregistered / Unconfirmed GUEST, unregistred user! 2000-08-04 #2 begin with edit1 do begin SelStart:=2; sellength:=2; setfocus; end; end; 请注意把EDIT1的AutoSelect属性改成False.
begin with edit1 do begin SelStart:=2; sellength:=2; setfocus; end; end; 请注意把EDIT1的AutoSelect属性改成False.
P popeye Unregistered / Unconfirmed GUEST, unregistred user! 2000-08-04 #3 winnt的方法我试不通 另一种方法: edit1.setfocus; 然后用keybd_event发送vk_left,vk_right消息,我一直这样用
P popeye Unregistered / Unconfirmed GUEST, unregistred user! 2000-08-04 #4 winnt的方法: 先把edit1的autoselect:=false with edit1 do begin SelStart:=2; sellength:=0; setfocus; end;
D driver Unregistered / Unconfirmed GUEST, unregistred user! 2000-08-04 #5 procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin Edit1.SelStart:=0; end;
procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin Edit1.SelStart:=0; end;
B beta Unregistered / Unconfirmed GUEST, unregistred user! 2000-08-05 #6 我喜欢发送虚拟键值. 向左:vk_left 向右:vk_right 最前:vk_home 最后:vk_end
X xiao_min Unregistered / Unconfirmed GUEST, unregistred user! 2000-08-05 #8 procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if key='a' then begin key:=#0; sendmessage(edit1.handle,wm_keydown,vk_home,0); //上一句换为edit1.SelStart:=0;也是一样行 end; end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if key='a' then begin key:=#0; sendmessage(edit1.handle,wm_keydown,vk_home,0); //上一句换为edit1.SelStart:=0;也是一样行 end; end;