组件的OnClick事件触发速度

I was using two TButton components on a form that functioned as Plus and Minus. When clicked they would add or subtract from an integer which would then be displayed on a TLabel.

This functioned as desired where the speed at which I would click would fire the OnClick event without fault.

I have replaced the buttons with PNGButton components so that I could make them look more pretty. Everything still works as before except that the OnClick event doesn't seem to be firing every time I click the components. I tested this with a simple TImage component also and the result is the same.

If I click very slowly it will fire every time, but if I click at a regular pace it only seems to fire every second click.

What can I do to make sure that the OnClick event is fired every time?

#0

Instead of using the OnClick event, use the OnMouseUp event:

procedure TForm.btnMinusMouseUp(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if Self.NumSelected > 0 then begin
    Self.NumSelected := Self.NumSelected - 1;
    Self.UpdateLabel;
  end;
end;

推荐文章

Spree、Rails 3和主题化

Spree、Rails 3和主题化

推荐文章

LLVM编译器2.0:警告“使用命名空间std;”

LLVM编译器2.0:警告“使用命名空间std;”

推荐文章

opengl重新编译显示列表

opengl重新编译显示列表

推荐文章

php-echo ascii字符?

php-echo ascii字符?

推荐文章

在xml文件asp.net中存储多个连接字符串

在xml文件asp.net中存储多个连接字符串

推荐文章

C++函数重写或重载

C++函数重写或重载

推荐文章

如何确保我的移动应用程序仅在一部手机上运行

如何确保我的移动应用程序仅在一部手机上运行

推荐文章

没有闪光CS5的声音?

没有闪光CS5的声音?

推荐文章

java中的死锁与同步

java中的死锁与同步

推荐文章

类似于youtube的javascript滑块控件

类似于youtube的javascript滑块控件

推荐文章

将errno.h错误值转换为Win32 GetLastError()等效值

将errno.h错误值转换为Win32 GetLastError()等效值

推荐文章

PHP:我不认为我可以重新编译PHP,我应该如何使用bzip2库?

PHP:我不认为我可以重新编译PHP,我应该如何使用bzip2库?

推荐文章

条令1.2:在记录模板中添加验证方法

条令1.2:在记录模板中添加验证方法

推荐文章

从visio图表或JPEG文件在HTML中创建悬停效果

从visio图表或JPEG文件在HTML中创建悬停效果

推荐文章

Linq query,选择inner query into list?

Linq query,选择inner query into list?

推荐文章

Lua中的n位模式匹配

Lua中的n位模式匹配