?
Solved

Turning off the hint for a tree node

Posted on 2001-08-20
11
Medium Priority
?
318 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 800 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month15 days, left to enroll

840 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