Create Custom ToolTips using API - Page 2-VBForums
Page 2 of 2 FirstFirst 12
Results 41 to 57 of 57

Thread: Create Custom ToolTips using API

  1. #41
    New Member
    Join Date
    Jun 2007
    Posts
    1

    Re: Create Custom ToolTips using API

    Hello,

    I need your help on using the tooltip, for a Combo. In the sense when the Mouse moves over each of the ListItems in the Combo, a respective TootTip must trigger.

    Say A,B,C are the listItems, then on mouseOver, a respective Tooltip needs to be displayed.

    I guess as the Combo does not have a MouseOver event, will it be possible to establish this using some APIs.

    Can you tell me on how to do this?

    Thanks & Regards

    Ramasubramanian Radhakkrishnan

  2. #42

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,633

    Re: Create Custom ToolTips using API

    You need to subclass the combo and then trap for the event that if fired when moving the mouse over the items. I am afraid I don't know what the exact windows msg is that you would have to handle.

    If you look in the tooltips project there is a module called modMsgHook. This is used to subclass the tooptip window. This can also be used to subclass the combo box.

    You can only set opne tooltip for each control, so once you handle the moveover event you need to change the entire tooltip for the combo. An example of this is shown in the demo app using the listview control...as the mouse moves over each listitem the listviews tooltip gets changed.

    Hope this helps.

    Woka

  3. #43
    Cyberman Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,487

    Re: Create Custom ToolTips using API

    Just a thought, but any chance of adding code for clickable links in the tooltip?
    John Lord, Evansville Indiana

  4. #44

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,633

    Re: Create Custom ToolTips using API

    That is perfectly possibe, however, I have not developed in VB6 for 2-3 years now and I have stopped maintaining and adding features to my VB6 source codes.
    Feel free to give it a go yourself.

    Woka

  5. #45
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: Create Custom ToolTips using API

    Hi,

    I am using your code in my software and it is working 100% fine. But I would be really grateful if it will be applicable on the following conditions:

    Is is possible to show tooltips on controls (having .text property) without mouse intervention. If I come straight to the point, can the tips be shown on control_change() event or control_gotfocus() event.

  6. #46

  7. #47
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: Create Custom ToolTips using API

    Quote Originally Posted by Wokawidget
    Yes. Just trap the msg in the message handler class and call the draw tooltip function.

    Woka
    Could you just show me how to handle the events cos' I have no idea. It would be thankful if you show both ways:

    1. TextBox_Change()
    2. TextBox_GotFocus()

  8. #48
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: Create Custom ToolTips using API

    Quote Originally Posted by Wokawidget
    ths is because it uses the control name for a key, and the control name is the same for all controls in an array. U need to modify the code to change the key it's saving in the collection when adding a tooltip to a control.

    Woka
    Hi Woka ,

    Thanks your work of this, Can you guide me how to save the control array to the collection ?

    Thanks woka :-)
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  9. #49

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,633

    Re: Create Custom ToolTips using API

    I dont have a machine with VB6 on it I am afraid, so can't test this.
    But in the function that adds the control to the collection it uses the controls name as the key.
    You need to modify that 1 line of code so that it:

    a) Tests if the control is part of an arry
    b) If so then get index of control and add that to the control name to get your unique key
    c) You need to modify the code where it gets the control tooltip from the array in the same manner. it needs the index adding to the name.

    Woka

  10. #50
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: Create Custom ToolTips using API

    Thanks woka,

    I will try your suggested method..




    NuFLaVoRs
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  11. #51
    New Member
    Join Date
    Jan 2008
    Posts
    1

    Re: Create Custom ToolTips using API

    Anyone know how to get the tooltip to work with a LABEL. It seems to work with most other controls...

  12. #52

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,633

    Re: Create Custom ToolTips using API

    This is because the code requires the control to have a handle, hWnd, which a label simply does not have.

    You will need to create your own label usercontrol that has a hWnd property. This is simply a limitation of a VB6 label, nothing really you can do about it.

    Do a search on google for this code.

    Woka

  13. #53
    Fanatic Member
    Join Date
    Jan 2007
    Location
    Middletown, CT
    Posts
    951

    Re: Create Custom ToolTips using API

    Anyone know how to only bold a part of the text you want in the tooltip and not all of it?

  14. #54
    Lively Member
    Join Date
    Dec 2005
    Location
    Ontario, Canada
    Posts
    67

    Re: Create Custom ToolTips using API

    I have tried this tooltip out and it works great. However, I ran into a problem if the tooltip is set on a button and the button launches a form. The tooltip doesn't appear for that button anymore.

    In the "Stage 10" code, if you add an empty form and paste this code into one of the buttons click events:

    Code:
    Dim f As Form1
    Set f = New Form1
    
    f.Show vbModal
    
    Set f = Nothing
    If you hover over the button before clicking, the tip shows up. After clicking and dismissing the form it doesn't show up any more. Any ideas?

    Thanks...

  15. #55

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,633

    Re: Create Custom ToolTips using API

    Quote Originally Posted by drag0n_45
    Anyone know how to only bold a part of the text you want in the tooltip and not all of it?
    This would be a lot more complex to handle...off the top of my head you could pass in text like: "This is <b>MY</b> tooltip", and then in the code that writes the message you would have to validate your text and write different bits out with different formatting.

    The code does not handle this natively as it stands now.

    Woka

  16. #56

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,633

    Re: Create Custom ToolTips using API

    Quote Originally Posted by fenrisW0lf
    I have tried this tooltip out and it works great. However, I ran into a problem if the tooltip is set on a button and the button launches a form. The tooltip doesn't appear for that button anymore.

    In the "Stage 10" code, if you add an empty form and paste this code into one of the buttons click events:

    Code:
    Dim f As Form1
    Set f = New Form1
    
    f.Show vbModal
    
    Set f = Nothing
    If you hover over the button before clicking, the tip shows up. After clicking and dismissing the form it doesn't show up any more. Any ideas?

    Thanks...
    This is because you used vbModal.
    This locks the Form1 as the top most form in a windows app. The form below it does not receive mouse events.
    I do not have VB6 installed on this PC anymore, but from what I can remember even a normal default vb6 tooltip would fail on this.

    Woka

    Try using vbModeless instead.

  17. #57
    New Member
    Join Date
    Aug 2009
    Posts
    1

    Re: Create Custom ToolTips using API

    I found this thread very helpful and the code supplied here works perfectly, except one thing... From version 2 it doesn't work with non-English text... I try to print something in Greek and it doesn't work... Only the first version displays Greek correctly...
    Anyone has an idea?

    PS I know this is a very old thread and i probably won't get an answer...

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.