Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 527
  • Last Modified:

ToolTip and TreeView

Hi,

Is there any way to hide the ToolTips for TreeView?

Thanks!
SP
0
Nirmal Sharma
Asked:
Nirmal Sharma
  • 4
  • 4
2 Solutions
 
pcelbaCommented:
Are you able to see all TreeView properties? Does any of them say something about tooltips?

And did you ask TreeView author already?
0
 
Nirmal SharmaSolution ArchitectAuthor Commented:
I'm using the example given here: http://fox.wikis.com/wc.dll?Wiki~TreeView

and the example given here to hide tooltips does not see to work:

#DEFINE TVS_NOTOOLTIPS 128
#DEFINE GWL_STYLE -16
DECLARE INTEGER SetWindowLong IN WIN32API INTEGER, INTEGER, INTEGER
DECLARE INTEGER GetWindowLong IN WIN32API INTEGER, INTEGER

LOCAL lnRet, lnHwnd
lnHwnd = THISFORM.yourTreeView.hWnd
lnRet = SetWindowLong(lnHwnd,GWL_STYLE, BITOR(TVS_NOTOOLTIPS,GetWindowLong(lnHwnd,GWL_STYLE)))

When I use the above example it says: The object TreeViewName is not evaluated to an object.


Thanks!
SP
0
 
Olaf DoschkeSoftware DeveloperCommented:
You need to change "yourTreeView" to the real of your treeview. Is it so hard to see that this is just a placeholder? The author of that code does not know how your treeview object is named.

The code just turns off tipp texts for a hwnd window handle, which each activeX control has, so this works with no matter what activeX treeview, but you need to apply the name the treeview has in your form, most probably that will be thisform.olecontrol1 instead.

Bye, Olaf.
0
Technology Partners: 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!

 
Nirmal SharmaSolution ArchitectAuthor Commented:
Thanks Olaf!

It's working now...earlier I was using this:

Form..
   
  AddObject as TTree

Define Class TTree As OleControl
   proc init
     LOCAL lnRet, lnHwnd
     lnHwnd = THISFORM.yourTreeView.hWnd
     lnRet = SetWindowLong(lnHwnd,GWL_STYLE, BITOR     (TVS_NOTOOLTIPS,GetWindowLong(lnHwnd,GWL_STYLE)))
endproc
enddefine

it didn't work!!!

but it's working if I use:

Form..
   
  AddObject as OcleControl

  proc init
     LOCAL lnRet, lnHwnd
     lnHwnd = THISFORM.yourTreeView.hWnd
     lnRet = SetWindowLong(lnHwnd,GWL_STYLE, BITOR     (TVS_NOTOOLTIPS,GetWindowLong(lnHwnd,GWL_STYLE)))
endproc

the question is why it didn't work when I defined a class outside the Form Define?

Thanks!
SP
 
0
 
Olaf DoschkeSoftware DeveloperCommented:
yourTreeview does not work as long as the name is otherwise. I don't see your code defining a treeview in either way, your class definition is an olecontrol, your AddObject as Olecontrol also does not explicitly add a treeview.

The foxpro base class Olecontrol rather is an empty container for any ole control, no more, no less. Only as you choose what type of olecontrol it get's that olecontrol. Only after that there is a hwnd property you can read.

Bye, Olaf.
0
 
Nirmal SharmaSolution ArchitectAuthor Commented:
Well, I tried to put everything as shortcut.

Define MyForm As Form
    Add Object MyTree as TTree
Enddefine

Define Class TTree As OleControl
   procedure init
     LOCAL lnRet, lnHwnd
     lnHwnd = THISFORM.TTree.hWnd
     lnRet = SetWindowLong(lnHwnd,GWL_STYLE, BITOR     (TVS_NOTOOLTIPS,GetWindowLong(lnHwnd,GWL_STYLE)))
   endproc

The question is: Why VF says "TTree" is not evaluted to an object?

If I use this inside Form Init it doesn't.

Thanks!
SP
0
 
Olaf DoschkeSoftware DeveloperCommented:
Because you name your object MyTree in the form in the Add Object clause, TTree is the class name, MyTree is the object name.

Bye, Olaf.
0
 
Olaf DoschkeSoftware DeveloperCommented:
The general problem is, you define your class with code that only works, if you instanciate the class with a certain name, that is you're making the class dependant on the environment. Such code should be self referential, eg you say THIS, not THISFORM.objectname in the init of a class definition and then that works anywhere.

The sample of the wiki was rather for the form.init(), not for the treeview init.

So afterall the better class definition would be:


#DEFINE...
...

Define Class TTree As OleControl
   procedure init
     LOCAL lnRet, lnHwnd
     lnHwnd = THIS.hWnd
     lnRet = SetWindowLong(lnHwnd,GWL_STYLE, BITOR (TVS_NOTOOLTIPS,GetWindowLong(lnHwnd,GWL_STYLE)))
   endproc

...
EndDefine

Open in new window

0
 
Nirmal SharmaSolution ArchitectAuthor Commented:
Thanks Olaf for the solution!
Thanks Pcelba for the response!

SP
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now