Solved

Turning off the hint for a tree node

Posted on 2001-08-20
11
301 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
 
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now