Recent

Author Topic: Tmemo don't control when is not visible  (Read 313 times)

eldonfsr

  • Hero Member
  • *****
  • Posts: 517
Tmemo don't control when is not visible
« on: October 07, 2024, 08:39:34 pm »
Hi i scare i have tmemo control to receive from serial port, but is not visible the content is in two tmemos
but one is for keep last result what i need to keep, generate chart but the problem is cheking if memo has a text "TEST DONE" but never found but when tmemo is visble find it and fire up  DatasToChart(VMTerminal);

Code: Pascal  [Select][+][-]
  1. procedure TFormMain.OnDatasChart(Sender: TObject; var Str: string);
  2. Var vv,lc:Integer;
  3. begin
  4. //  Vmterminal.BeginUpdateBounds;
  5.   for lc:=0 to length(Str) do begin
  6.      vv:=ord(Str[lc]);
  7. //     VMTerminal.Text := VMterminal.Text+ '['+IntToSTr(vv)+']' + str[lc];
  8.      VMTerminal.Text := VMterminal.Text+ str[lc];
  9.   end;
  10.   for lc:=0 to VMTerminal.Lines.Count-1 do begin
  11.      if( VMTerminal.Lines[lc]='') then begin
  12.         VmTerminal.Lines.Delete(lc);
  13.      end;
  14.   end;
  15. //  Vmterminal.EndUpdateBounds;
  16.   if(AnsiContainsText(VMTerminal.Text,'Single cycle') ) then begin
  17.       if( (Chart1.Visible=false) and (Not AnsiContainsText(VMTerminal.Text,'MD')) and (not AnsiContainsText(VMTerminal.Text,'>'))) then begin
  18.         PanelChart.Height:=210;
  19.         PanelChart.Visible:=true;
  20.         PanelBtnsAcc.Visible:=false;
  21.       end;
  22.    end;
  23.    if(  AnsiContainsText(VMTerminal.Text,'TEST DONE') and (PanelChart.Visible= true) and (AnsiContainsText(VMTerminal.Text,'>')))  then Begin
  24.        if(ChartCount <=10) then begin
  25.             DatasToChart(VMTerminal);
  26.          end else begin
  27.          ChartCount:=1;
  28.           DatasToChart(VMTerminal);
  29.        end;
  30.        chart1.Repaint;
  31.   end;
  32. //  Vmterminal.Text:= Trim(Vmterminal.Text);
  33.  
  34.   ComTerm.SetFocus;
  35. end;
  36.  
  37.  

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1180
Re: Tmemo don't control when is not visible
« Reply #1 on: October 13, 2024, 09:39:51 am »
Quote
for lc:=0 to length(Str) do begin
     vv:=ord(Str[lc]);
What is that part for? Testing?
Code: Pascal  [Select][+][-]
  1. for lc:=0 to VMTerminal.Lines.Count-1 do begin
  2.      if( VMTerminal.Lines[lc]='') then begin
  3.         VmTerminal.Lines.Delete(lc);
  4.      end;
That code is wrong. If any lines are deleted you will no longer be referencing lines correctly. I would do
Code: Pascal  [Select][+][-]
  1.  
  2. With VMTerminal do
  3.        for lc:= Lines.Count-1 downto 0 to do
  4.             if (Lines[lc]='')
  5.               then Lines.Delete(lc);
« Last Edit: October 13, 2024, 09:52:56 am by Joanna »
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

eldonfsr

  • Hero Member
  • *****
  • Posts: 517
Re: Tmemo don't control when is not visible
« Reply #2 on: October 13, 2024, 11:25:27 pm »
OK i can change thanks...

 

TinyPortal © 2005-2018