Solved

Turning off the hint for a tree node

Posted on 2001-08-20
11
307 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Print Graphic and Text to Epson TM-T88v 12 539
find a node in VST 2 91
oracle global variables 4 80
TAction.OnAfterExecute? 2 30
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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

737 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