Board index » cppbuilder » Re: Fixing TreeView RightClickSelect; FIXED

Re: Fixing TreeView RightClickSelect; FIXED


2005-04-17 12:38:31 PM
cppbuilder114
"Jon Berndt" < XXXX@XXXXX.COM >wrote in message news:425d1421
Quote
I'm using Builder 3.0. As is well-known, the RightClickSelect property
doesn't work for TTreeView. Since I have the VCL source, is it recommended
to fix the source code and rebuild the package? It's been a while since I
did anything like this, but I think I have enough material so that I could
fix this seemingly simple bug. But, rebuilding the package ... I'm not
sure
that's a desirable path, either. Anyone else face this obstacle?

Jon
This turned out to be quite easy. I took the file ComCtrls.pas, copied it
into my project directory and modified one line in the
TCUstomTreeView::WMRButtonDown() function call:
procedure TCustomTreeView.WMRButtonDown(var Message: TWMRButtonDown);
var
MousePos: TPoint;
begin
FRClickNode := nil;
try
if not RightClickSelect then
begin
inherited;
if FRClickNode <>nil then
begin
GetCursorPos(MousePos);
with PointToSmallPoint(ScreenToClient(MousePos)) do
Perform(WM_RBUTTONUP, 0, MakeLong(X, Y));
end;
end
else Selected := GetNodeAt(Message.XPos, Message.YPos);
finally
FRClickNode := nil;
end;
end;
The difference is in this line:
else Selected := GetNodeAt(Message.XPos, Message.YPos);
Prior to the fix, it called a DefaultHandler.
Jon
 
 

Re:Re: Fixing TreeView RightClickSelect; FIXED

"Jon Berndt" < XXXX@XXXXX.COM >wrote:
Quote

This turned out to be quite easy. [...]
Too bad your solution won't be included with the thread when
it gets archived. That's what happens when one changes the
subject.
~ JD
 

Re:Re: Fixing TreeView RightClickSelect; FIXED

"JD" < XXXX@XXXXX.COM >wrote in message news:42624ce5
Quote
"Jon Berndt" < XXXX@XXXXX.COM >wrote:
>
>This turned out to be quite easy. [...]

Too bad your solution won't be included with the thread when
it gets archived. That's what happens when one changes the
subject.

~ JD
<slaps forehead>
Thanks for pointing that out. I hadn't considered that. I reposted it
without the modified subject line - which will probably be just as
irritating to some.
Jon
 

{smallsort}