Recent

Author Topic: TMemo update  (Read 524 times)

eldonfsr

  • Hero Member
  • *****
  • Posts: 528
TMemo update
« on: September 28, 2024, 05:47:31 pm »
Hi i working on project with serial port using tmemo as terminal to received information from serial the problem i see  now is when user type command or information send to serial port when pressing enter key i tried to handle for form event and abbey others controls afaceted for key event.
Code: Pascal  [Select][+][-]
  1. procedure TFormMain.FormKeyPress(Sender: TObject; var Key: char);
  2. begin
  3.  if( Key =#13) then begin
  4.     if( (Not MTermSp1.Focused) and( Not MTermSp2.Focused) and (Not MTermSp3.Focused) and(Not MTermSp4.Focused) and(Not MTermSp5.Focused) ) then begin
  5.       FormMain.SelectNext(FormMain.ActiveControl,true, true);
  6.       key:=#0;
  7.     end else begin
  8.        Mtermsp1.Update;
  9.        Lsp1.WriteData(key);
  10.     end ;
  11.  end else if(key=#27) then begin
  12.       Lsp1.WriteData(key);
  13.  end;
  14. end;
  15. you can see first image when user typing and press enter
  16. on second is when receive information of serial port...
  17. my question is  on   Mtermsp1.Update;    must be affected memeo but not
  18. how i can send enter to memo before receive information from serial port or modem...
  19.  
  20. thanks to all, any idea please...
  21.  
  22.  

dbannon

  • Hero Member
  • *****
  • Posts: 3187
    • tomboy-ng, a rewrite of the classic Tomboy
Re: TMemo update
« Reply #1 on: September 29, 2024, 01:32:43 am »
Really unsure about your question here I am afraid. Firstly, your question actually appears in the code block making it hard to read. Secondly, you need to explain what you are looking for just a bit better. And perhaps either show more code of tell us what the various identifiers are.

Some answers that might, accidentally, help (but probably not).

  • You can send a 'enter' to a TMemo like this - Memo1.Append('');
  • There are extra events in addition to KeyPressed() that might help, OnKeyDown() happens as the key goes down, before OnKeyPress() and OnKeyUp() happens as the key is released and happens after OnKeyPress().


Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

eldonfsr

  • Hero Member
  • *****
  • Posts: 528
Re: TMemo update
« Reply #2 on: September 29, 2024, 05:02:59 am »
Thanks for replay well i tried on keypress on tmemo append(chr(13)+chr(100) FOR BERAK LINE, but don't show even after receive text from modem, for that move send the breakline to form event onkeypress think could be after form process key update tmemo....

user want to see clear what he type and what respond from modem...

thanks....so much for your help me...

 

TinyPortal © 2005-2018