Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Move Cursor to after Text in TEdit
Fri, Jul 26 2019 1:26 AMPermanent Link

KimHJ

Comca Systems, Inc

I have a ReadOnly TEdit, I will allow the user to change the content after answering Yes to a MessageDilalog.

In Delphi I would use SelLength, but it is not in EWB. After setting the TEdit to ReadOnly := false I use the SelectNone to turn of the selection, but I can't get the cursor inside the edit box, not even with SetFocus.

if (DlgResult=mrYes) then
     begin
        LNameEd.ReadOnly := False;
        LNameEd.SelectNone;
        LNameEd.SetFocus;
     end;

I found that after this the foucs must be on the web form, if I hit the BackSpace key the browser goes back to the prior url.

Kim
Fri, Jul 26 2019 9:30 PMPermanent Link

Raul

Team Elevate Team Elevate

On 7/26/2019 1:26 AM, KimHJ wrote:
> I have a ReadOnly TEdit, I will allow the user to change the content after answering Yes to a MessageDilalog.
>
> In Delphi I would use SelLength, but it is not in EWB. After setting the TEdit to ReadOnly := false I use the SelectNone to turn of the selection, but I can't get the cursor inside the edit box, not even with SetFocus.
>
> if (DlgResult=mrYes) then
>        begin
>           LNameEd.ReadOnly := False;
>           LNameEd.SelectNone;
>           LNameEd.SetFocus;
>        end;
>
> I found that after this the foucs must be on the web form, if I hit the BackSpace key the browser goes back to the prior url.

Try change order of this and see if it helps:

   LNameEd.Setfocus;
   LNameEd.SelectNone;

Raul
Sat, Jul 27 2019 12:52 PMPermanent Link

Ronald

Hi Kim,

I used the keypressed event:

function Txx.Edit1KeyPress(Sender: TObject; Key: Char; ShiftKey, CtrlKey, AltKey: Boolean): Boolean;
begin
Edit1.SelectNone;
Result:=true;
end;

That always "prepares" my TEdit.

Ronald
Sun, Aug 4 2019 12:04 AMPermanent Link

KimHJ

Comca Systems, Inc

Raul wrote:
>>Try change order of this and see if it helps:

   LNameEd.Setfocus;
   LNameEd.SelectNone;
<<

Thanks Raul i will give it a try.

Kim
Sun, Aug 4 2019 12:06 AMPermanent Link

KimHJ

Comca Systems, Inc

Ronald wrote:

>>Hi Kim,

I used the keypressed event:

function Txx.Edit1KeyPress(Sender: TObject; Key: Char; ShiftKey, CtrlKey, AltKey: Boolean): Boolean;
begin
Edit1.SelectNone;
Result:=true;
end;

That always "prepares" my TEdit.<<

Thanks Ronald, that works.
Kim
Image