tayto
asked on
Listview
How can i find out if the user right clicked on the column header of a listview - i know i can use oncolumnclick to find out when the user left clicked on the column heading but it does not give information on the right mouse button.
procedure TForm1.ListView1ColumnRigh tClick(Sen der: TObject;
Column: TListColumn; Point: TPoint);
begin
ShowMessage(IntToStr(colum n.Index));
end;
Column: TListColumn; Point: TPoint);
begin
ShowMessage(IntToStr(colum
end;
ASKER
ListView does not have any event of ListView1ColumnRightClick( Sender: TObject;
Column: TListColumn; Point: TPoint);
I am using Delphi 4 Professional.
Column: TListColumn; Point: TPoint);
I am using Delphi 4 Professional.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry, I meant to have the following for example 1:
if Button = mbRight then
begin
Col:= DBGrid1.Columns[DBGrid1.Mo useCoord(x ,y).x-1];
ShowMessage('Column Title: '+ Col.Title.Caption+#13+
'Column Field: '+ Col.FieldName);
end;
if Button = mbRight then
begin
Col:= DBGrid1.Columns[DBGrid1.Mo
ShowMessage('Column Title: '+ Col.Title.Caption+#13+
'Column Field: '+ Col.FieldName);
end;
ASKER
PierreC - i'm a little confused. Derive from DBGrid to use a listview?
Ivanov_G - i can find (X,Y) but translating it into which column title was clicked is the part i am having problems with
Ivanov_G - i can find (X,Y) but translating it into which column title was clicked is the part i am having problems with
ASKER
Ivanov_G - actually, using if Button = mbRight then in the mousedown event does not work when i click on the actual listview column title, only works when i click on a cell
Yep... I tried it. OnColumnClick catch only left button and OnMouseDown/Up is not capture on header click ... Bad ...
ASKER
It's ok - i finally worked out how to do it. Had to write a sub-class of the component but it did the trick.
I decided to just split the points between both Ivanov_G and PierreC as they both at least tried to help.
I decided to just split the points between both Ivanov_G and PierreC as they both at least tried to help.
Column: TListColumn; Point: TPoint);
begin
end;