pressing enter in editbox to perform action - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

pressing enter in editbox to perform action

i want to be able to press enter in a certain editbox when data is enetered and then call a procedure that can also be called by clicking a button, like a shortcut.

Comments

  • RichardKRichardK Posts: 14Member
    [b][red]This message was edited by RichardK at 2006-2-14 12:39:41[/red][/b][hr]
    : i want to be able to press enter in a certain editbox when data is enetered and then call a procedure that can also be called by clicking a button, like a shortcut.
    :
    Hi

    This code should work. You are trying to intercept the on key press event.

    procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
    begin
    if Key = #13 then //#13 = enter
    begin
    //----- Add Method Call in here -----
    //just a line to prove it works
    Messagebox(handle,'test','test',MB_Ok);
    end;
    end;




  • sarkiemarkiesarkiemarkie Posts: 89Member
    : [b][red]This message was edited by RichardK at 2006-2-14 12:39:41[/red][/b][hr]
    : : i want to be able to press enter in a certain editbox when data is enetered and then call a procedure that can also be called by clicking a button, like a shortcut.
    : :
    : Hi
    :
    : This code should work. You are trying to intercept the on key press event.
    :
    : procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
    : begin
    : if Key = #13 then //#13 = enter
    : begin
    : //----- Add Method Call in here -----
    : //just a line to prove it works
    : Messagebox(handle,'test','test',MB_Ok);
    : end;
    : end;
    :
    :
    :
    :
    : EXCELLENT, thank you!!

Sign In or Register to comment.