I want to judge the Timer is less than 2 seconds, and the Memo receive feedback data, suggest sending a message success; Conversely, if more than 2 seconds, have yet to receive the data indicates that memo sent failed! How should do?
CodePudding user response:
Original: Timer1 - & gt; Enabled to false, the Interval is 2000 milliseconds
Send the message code; Send out immediately:
Timer1 - & gt; Enabled=true;
Timer1 OnTimer event handling function:
Timer1 - & gt; Enabled=false;
The Memo received feedback data, suggest sending message is successful, otherwise, the prompt send failure,
Twice before and after comparison Memo1 - & gt; Lines - & gt; Count (rows) determine whether receive feedback data,
CodePudding user response:
reference 1st floor u010165006 response: initial: Timer1 - & gt; Enabled to false, the Interval is 2000 milliseconds Send the message code; Send out immediately: Timer1 - & gt; Enabled=true; Timer1 OnTimer event handling function: Timer1 - & gt; Enabled=false; The Memo received feedback data, suggest sending message is successful, otherwise, the prompt send failure, Twice before and after comparison Memo1 - & gt; Lines - & gt; Count (rows) determine whether receive feedback data, That's what I did! But there are two problems; First, he will keep the pop-up prompt window; Second, is not only a data have feedback has a lot of all have, if the following judgment, there is a mistake! Memo for more than 10 guilds automatically reset once, but as long as there are data, program will prompt sends success, sometimes may not be successful! My code is as follows: Timer1 - & gt; The Enable=true; If (Form1 - & gt; Memo1 - & gt; Lines - & gt; Count>=1)//later discovered to judge it is 1, is, if it itself has data, will be mistaken for a successful { ShowMessage (" success "); Timer1 - & gt; The Enable=false; } The else { ShowMessage (" failure "); Timer1 - & gt; The Enable=false; } Form1 - & gt; Memo1 - & gt; Lines - & gt; Count> 10; Form1 - & gt; Memo1 - & gt; Text=""; CodePudding user response:
Someone at? Quite worry! CodePudding user response:
Timer1 - & gt; The Enable=true; This sentence you in where? Twice before and after comparison Memo1 - & gt; Lines - & gt; Count (rows) determine whether receive feedback data, Do you understand? CodePudding user response:
reference 4 floor u010165006 response: Timer1 - & gt; The Enable=true; This sentence you in where? Twice before and after comparison Memo1 - & gt; Lines - & gt; Count (rows) determine whether receive feedback data, Do you understand? Timer1 - & gt; The Enable=true; I am send commands to the lower machine, a machine under active feedback data, This sentence in my send commands that button at the end of the event; Two more didn't understand? CodePudding user response:
reference 5 floor u014393164 reply: Quote: refer to 4th floor u010165006 response: Timer1 - & gt; The Enable=true; This sentence you in where? Twice before and after comparison Memo1 - & gt; Lines - & gt; Count (rows) determine whether receive feedback data, Do you understand? Timer1 - & gt; The Enable=true; I am send commands to the lower machine, a machine under active feedback data, This sentence in my send commands that button at the end of the event; Two more didn't understand? Timer1 - & gt; The Enable=true; This problem has been solved, just now you said that two comparison, the two should be how to compare? Would you help me write the? CodePudding user response:
Using a variable, before sending data record Memo number of rows, in Timer1 OnTimer event handler: Timer1 - & gt; Enabled=false; Compare the Memo record before the number of rows and the number of rows, it represents the Memo received feedback data, But the question is if it is on the last time to send failure delay feedback, is impossible to distinguish, CodePudding user response:
refer to 7th floor u010165006 response: with a variable, Memo before sending data records the number of rows, in Timer1 OnTimer event handler: Timer1 - & gt; Enabled=false; Compare the Memo record before the number of rows and the number of rows, it represents the Memo received feedback data, But the question is if it is on the last time to send failure delay feedback, is impossible to distinguish, I am new to c + + Builder soon, a lot of things still don't understand! I probably can understand what you said two times more! But, at present is entangled with how to determine the current number of rows; If I now define int n; N=StrTOInt (Memo - & gt; Lines - & gt; The Count); The statistics should be present in the Memo line number! Click on the button are first but I failed prompt box! Then after the second to judge! And every time is popup tooltip first, I didn't receive the data, so even if I received the data, sometimes prompt failure! So would like to ask you to do your ideas in the code or simply write it for me, I just want to have a look at, where I am now stuck! Has not correct! Could you be convenient CodePudding user response:
refer to 7th floor u010165006 response: with a variable, Memo before sending data records the number of rows, in Timer1 OnTimer event handler: Timer1 - & gt; Enabled=false; Compare the Memo record before the number of rows and the number of rows, it represents the Memo received feedback data, But the question is if it is on the last time to send failure delay feedback, is impossible to distinguish, Don't bother! To solve! Don't need two more! Only judge feedback data! CodePudding user response:
It is good to solve the By the way, Memo - & gt; Lines - & gt; The Count is type int