Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.