Click here to Skip to main content
15,885,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello! I'm writing a control that inherits from ListView. I need to override MouseDown propertie. To do this I am writing nex declaration in the class of my component:
C++
public:
DYNAMIC void __fastcall MouseDown(System::Uitypes::TMouseButton Button, System::Classes::TShiftState Shift, int X, int Y);

and realization:
C++
void __fastcall TMyListView::MouseDown(System::Uitypes::TMouseButton Button, System::Classes::TShiftState Shift, int X, int Y)
{
     if(Items->Count > 0 && ItemIndex != -1)
     {
	 Beep(1000, 300);
     }
}

As a signal when mouse pressed on item I use Beep() function. But Beep sounds when mouse was upped, i.e. was made a full click. And there is a problem.
How to fix this? I do not need to override SelectItem event because it occurs when item selected or unselected only. I need to handle the mouse pressing.
Please help to solve my problem.
Posted
Comments
Kenneth Haugland 7-Feb-15 7:18am    
Hrmf, I don't want to sit next to you while you are debugging. That Beep sound would make me want to go crazy :laugh:
Sergey Alexandrovich Kryukov 7-Feb-15 8:31am    
I think Kenneth is right. Here is the thing: did you, instead of just observing the sound, executed these lines under the debugger? The code looks right, so the problem could be elsewhere.
—SA
Igor-84 7-Feb-15 8:38am    
Sergey Alexandrovich Kryukov, open C++Builder or Delphi (you can use any versions - from 6 to XE7), create new project, put ListView and fill it with items, and in the onMouseDown handler paste my code. And you can see it independently. Problem is in MouseDown. How to fix this?
Sergey Alexandrovich Kryukov 7-Feb-15 9:16am    
I don't anything of it installed at the moment, but handling this event wasn't a problem so far, that's why I'm asking.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900