I am trying to create a custom button from a TPanel component. To do this, I provided an override for the onmousedown and onmouseup events (to make some drawings), and I used the onclick event to handle clicks.
Unfortunately, if I quickly click on my panel, every other click is βlostβ, but I cannot understand why.
Even the lightest examples in this regard will not work. I created a new VCL application, added a list, one panel, and implemented the events as follows:
procedure TForm1.Panel1Click(Sender: TObject); begin listbox1.Items.Add('click'); end; procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin listbox1.Items.Add('mouse down'); end; procedure TForm1.Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin listbox1.Items.Add('mouse up'); end;
The result is as follows:
mouse down click mouse up mouse down mouse up
etcetera ... Every second click is ignored, but I have no idea why.
Can someone explain this please?
source share