Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report