Solved

Turning off the hint for a tree node

Posted on 2001-08-20
11
305 Views
Last Modified: 2010-04-04
Hi,
Can anyone tell me how i can turn off the hint that pops up everytime my mouse moves on the tree node of a tree view (provided that it is cut). I want to suppress that. Is there anyway i can accomplish that.
Note: it has nothing to do with Showhint property.

Thanx in advance.
Hammad
0
Comment
Question by:hammadmajeed
  • 6
  • 2
  • 2
  • +1
11 Comments
 
LVL 4

Accepted Solution

by:
fva earned 200 total points
ID: 6405356
It's a tooltip, not a hint. Very annoying.
My workaround:

unit UTVPatch;
// deactivates tooltip for TTreeView
// Usage: Call PatchTreeView once, after creating the TreeView, somewhere in the Show section of the form (where there is a "true" TreeView handle)

interface

uses Windows,Messages,Classes,ComCtrls,commctrl;

procedure PatchTreeView(atv:TTreeView);

implementation

var FTVList:TList;
    hhook:THandle;

function HookProc(nCode:integer;wPar:WPARAM;lPar:LPARAM):LRESULT;stdcall
var idx:integer;
begin
     if nCode=HC_ACTION then begin
        with PCWPStruct(lPar)^ do begin
             idx:=FTVList.IndexOf(Pointer(hwnd));
             if idx>=0 then begin
                // target is one of our monitored TTreeViews
                if message=WM_NOTIFY then begin
                   if PNMHdr(lParam)^.code=TTN_NEEDTEXTW then begin
                      SendMessage(PNMHdr(lParam)^.hwndFrom,TTM_ACTIVATE,0,0);
                      FTVList.Delete(idx);
                      if FTVList.Count=0 then begin
                         UnhookWindowsHookEx(hhook);
                         hhook:=0;
                      end;
                   end;
                end;
             end;
        end;
        Result:=0;
     end else
        Result:=CallNextHookEx(hhook,nCode,wPar,lPar);
end;

procedure PatchTreeView(atv:TTreeView);
begin
     if FTVList.IndexOf(Pointer(atv.Handle))>=0 then exit;
     FTVList.Add(Pointer(atv.Handle));
     if hhook=0 then
        hhook:=SetWindowsHookEx(WH_CALLWNDPROC,HookProc,0,MainThreadID);
end;

initialization
   FTVList:=TList.Create;
   hhook:=0;
finalization
   FTVList.Free;
   if hhook<>0 then begin
      UnhookWindowsHookEx(hhook);
      hhook:=0;
   end;
end.

Basically it "knocks out" the tooltip window the first time it wants to pop-up.

F.
0
 
LVL 17

Expert Comment

by:inthe
ID: 6405386
i havent tried it but dont see why it wouldnt work:
in object inspector set tooltips to false.

or on a mouse event
treeview1.tooltips := false;
0
 
LVL 4

Expert Comment

by:fva
ID: 6405410
Depends on Delphi version.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 3

Expert Comment

by:smurff
ID: 6405463
Havent tried it but its what Ive ot listed as doing the job... worth a try.
regards
Smurff

procedure TForm1.FormCreate(Sender: TObject);
 begin
   SetWindowLong(TreeView1.Handle,
                              GWL_STYLE,
                              GetWindowLong(TreeView1.Handle,GWL_STYLE) or $80);
 end;
0
 
LVL 4

Expert Comment

by:fva
ID: 6405494
Well, I admit, I was overkilling. Version 4.70 and above of commctrl (I think IE 3.0 and above) support the TVS_NOTOOLTIPS which is $80 and unless you are using a very old version of the library smurff is right.

F.
0
 
LVL 4

Expert Comment

by:fva
ID: 6405501
And it works, too. Nice to learn new things.
0
 

Author Comment

by:hammadmajeed
ID: 6407198
the codes u ppl wrote only work in win2k, if u try that code in win95/98, it still is displaying tooltip. i think it is coz of older version of commctrl, is it right?

Hammad
0
 
LVL 4

Expert Comment

by:fva
ID: 6408747
Installing a newer Internet Explorer (e.g. 5.0 or later) _will_ fix it even on 95/98.

F.
0
 

Author Comment

by:hammadmajeed
ID: 6409304
cant it is possible with the default version that is installed with 95/98(without any kind of upgradation).

Hammad
0
 
LVL 3

Expert Comment

by:smurff
ID: 6409509
I guess not. If the functions not in the .dll then you`ll have to upgrade if you want this functionality. If I were you put something in your app. that will check the version number and if its the wrong one then automatically run the upgrade.

regards
Smurff
0
 
LVL 4

Expert Comment

by:fva
ID: 6412495
Thank you Hammad for accepting my comment as answer. It's a nice thing to get points while learning new tricks, too :)

F.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question