Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use FormActivate to close the interface automatically in actual combat in Delphi

Shulou Source: shulou.com Published: 2022-06-01 05:18:24 09月18日 Update

This article is about how to use FormActivate to automatically close the interface in Delphi. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it.

Below we mainly explain how to automatically close the payment interface to return data after a successful payment.

Code demonstration

Let's still use our paid project.

Go back to the FormActivate in Trade.pas in the previous chapter

If we understand it in a normal way, we should all write it in this function. When the call returns the result, we can add two lines of code at last.

Sleep (1500)

Close

To enable the interface to close automatically.

When we ran the program after we added it, we found that the interface was not closed. In other words, adding Close to FormActivate doesn't work.

So how should we deal with it? In fact, it is quite simple, we add a Timer control, a common parameter variable, can be implemented.

Add a Timer control to the interface

Then add a variable of boolean to Private

Then in the FormShow event, the transaction variable is defined as the incomplete, Timer-controlled interval and start-up.

BisTradeover: = False

Timer1.Interval: = 1500

Timer1.Enabled: = True

Finally, write the judgment in the Timer1Timer of the Timer control, delay 1.5 seconds when the transaction flag is successful, and then close the current form.

In this way, we automatically detect whether the transaction is completed every 1.5 seconds, which is used to close our form.

The above is how to use FormActivate to automatically close the interface in Delphi. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Interfaces variables controls transactions payments practices successes codes ways more knowledge forms articles utility that is events actions functions parameters Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Microsoft Shulou Tech Info Huawei MySQL