Can Access 2003 show ControlTip Text without the mouse event (1 Viewer)

darbid

Registered User.
Local time
Today, 11:38
Joined
Jun 26, 2008
Messages
1,428
Is it possible to get a controltip text to show without user interaction or the mouse hover?

I am guessing no, but thought I would ask.

I would be willing to do a little Windows API stuff but not huge amounts.
 
Last edited:

Trevor G

Registered User.
Local time
Today, 10:38
Joined
Oct 1, 2009
Messages
2,341
My Immediate thought is you can add status bar text? So when a user enters the field it indicates a message

What is the purpose of this?
 

darbid

Registered User.
Local time
Today, 11:38
Joined
Jun 26, 2008
Messages
1,428
My Immediate thought is you can add status bar text? So when a user enters the field it indicates a message
My status bar is not visible.

What is the purpose of this?

Well........I have just added a reference to Communicator 2007 RS. Each time the user goes to a record, the owner of the record is checked for his status by Communicator, further this status can change while looking at a record. Thus I have sunk a WithEvents for status changes. When a status changes I add the status information to the tool tip of a button. I just wanted it too look better and the tool tip show up quickly.

Kind a like when you minimize a program to the system tray a small message pops up and then goes away.

I suppose I could make my own popup form and position it next to the button but that is a lot of work. Plus it could be annoying to someone that is typing or doing something as the popup would steal focus and control.
 

ghudson

Registered User.
Local time
Today, 05:38
Joined
Jun 8, 2002
Messages
6,195
How about updating a label in the form with the status changes? That method will not interfere with the user nor require the user to click something to make it go away.
 

darbid

Registered User.
Local time
Today, 11:38
Joined
Jun 26, 2008
Messages
1,428
That great thininking but I dont have a lable associated with the button. I could put a label at the bottom of the screen somewhere I suppose.

I have looked at http://www.lebans.com/tooltip.htm

That might be the only remote possibility, but from what i can understand he simply plays around with the default Tooltip iwth sendmessage, and thus the actual showing of it is not altered in his code.
 

ghudson

Registered User.
Local time
Today, 05:38
Joined
Jun 8, 2002
Messages
6,195
Use an unattached label. My mouseoverpopups.zip sample might give you an idea, forget that I am using the mouse move event in that sample.
 

darbid

Registered User.
Local time
Today, 11:38
Joined
Jun 26, 2008
Messages
1,428
Thank you for that but I really wanted to get it. And it did.

It appears that you need to tell windows 2 things. 1 the position of the tooltip and to show it. Lebans code gives you the new tooltip but then leaves it up to windows to show it.

The trick is this You need to set the position of the tooltip

SendMessage(myHWAND, TTM_TRACKPOSITION, 0, ByVal dx)

Then this being True will show it

SendMessage(myHWAND, TTM_TRACKACTIVATE, True, theTI)

You then have to make this false to get rid of it.

I think this will only work with lebans code because myHWAND is the handle of a window which is the Tooltip.

Now I just gotta get it to position right and I am done.
 

darbid

Registered User.
Local time
Today, 11:38
Joined
Jun 26, 2008
Messages
1,428
Ok so for people reading this who have/want nice finished code for tool tips then please use Lebans. It is nicer as far as coding is concerned.

The thing is that his code overtakes everything on the form that you choose. Further it uses fairly standard tooltips.

I wanted nice looking tooltips without a border. This meant that I had to rewrite the tooltip during creation. This involves subclassing which is not easy. ALSO very important subclassing crashes programs if you use it with the VBE or stop your editor.

With this you can basically call on function with your target control, text and title and that control alone will get the control. I also have NOT enabled the automatic on mouse over tooltip function so if you want that to happen here you just use the onmouse over event of the control.

Anyway here is an example of what I have done. If any brainy person can add a drop shadow to this which is available to the tool tip class as far as I can tell.

edit: I just noticed my hack at changing the tooltips size and shape does not work on Vista. I also could not see how to make it work on Vista.
 

Attachments

  • db5.mdb
    228 KB · Views: 318
  • New Picture.jpg
    New Picture.jpg
    12 KB · Views: 508
Last edited:

darbid

Registered User.
Local time
Today, 11:38
Joined
Jun 26, 2008
Messages
1,428
And cause it is all about the iCandy here is it in my DB.

Basically the reason why I wanted my own tooltip is that it is connected to MS Communicator.

Basically I have set up a listener for the Communicator which receives changes of status from our Exchange server. These are pmumped into my tooltip and as you can see I get the response as a new tool tip.
 

Attachments

  • New Picture (21).jpg
    New Picture (21).jpg
    16.9 KB · Views: 366

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 04:38
Joined
Feb 28, 2001
Messages
27,179
If you aren't using mouse events then the issue is how do you know where you are in order to display the right message? Answer: Lots of VERY simple coding and a dedicated unbound text box.

In each form, have a Help/Hints unbound text box big enough to hold your biggest comment. It can have a label "Help & Hints" or something similar. Call the control HelpHints (or some other convenient name).

In each control on each form where you want this kind of help, have two events:

xxx_GotFocus and xxx_LostFocus.

In the _GotFocus event, do a

[HelpHints] = "my helpful comments for using control xxx"

In the _LostFocus event, do a

[HelpHints] = ""

This works when you tab in or click in on any control, and for tabs, even works for command buttons that are currently enabled. (Yes, a command button can get focus without being triggered if you used the TAB key.)

This never gets confused because only one control ever has focus. Also, no matter how a control gains focus, its predecessor always loses focus first. The events fire back-to-back as far as I can tell.

Side note: If you have two forms open, you'll also get Enter/Exit events or Activate events as well. In that case, when you exit a form in favor of another form, the predecessor control fires the LostFocus before the Exit. The gaining form fires the Activate before any GotFocus.
 

smig

Registered User.
Local time
Today, 12:38
Joined
Nov 25, 2009
Messages
2,209
is it possible to make Leban's ToolTip into Right to Left alligned ?
 

smig

Registered User.
Local time
Today, 12:38
Joined
Nov 25, 2009
Messages
2,209
I'm trying to right allign Leban's tooltips http://www.lebans.com/tooltip.htm with no success

here is a snip from original and canged code:
original:
Code:
      m_hwndTT = CreateWindowEx(0, TOOLTIPS_CLASS, _
                                vbNullString, TTS_ALWAYSTIP Or TTS_BALLOON, _
                                0, 0, _
                                0, 0, _
                                m_Form.hWnd, 0, _
                                hInstance, ByVal 0)

modified:
Code:
      m_hwndTT = CreateWindowEx(&H1000 Or &H2000, TOOLTIPS_CLASS, _
                                vbNullString, TTS_ALWAYSTIP Or TTS_BALLOON, _
                                0, 0, _
                                0, 0, _
                                m_Form.hWnd, 0, _
                                hInstance, ByVal 0)

I changed it based on the dwExStyle of CreateWindowEx
http://msdn.microsoft.com/en-us/library/ms632680(VS.85).aspx

I prefer Leban's code over this http://www.teebo.com/tssBalloonTip.htm as it's not an ActiveX


What am I doin'g wrong ?
 
Last edited:

darbid

Registered User.
Local time
Today, 11:38
Joined
Jun 26, 2008
Messages
1,428
I'm trying to right allign Leban's tooltips http://www.lebans.com/tooltip.htm with no success

See here http://msdn.microsoft.com/en-us/library/bb760256(VS.85).aspx

Normal windows display text left-to-right (LTR). Windows can be mirrored to display languages such as Hebrew or Arabic that read right-to-left (RTL). Normally, tooltip text is displayed in the same direction as the text in its parent window. If TTF_RTLREADING is set, tooltip text will read in the opposite direction from the text in the parent window.

Basically the parent to the tool tip should be your form BUT in Access the actual form and the handle that is the parent are not the same. Way too technical for me.

I have not tried this but you use this either when you build it or you can use the send message.
 

darbid

Registered User.
Local time
Today, 11:38
Joined
Jun 26, 2008
Messages
1,428
smig what are the extended window styles or what are you trying to achieve in your CreateWindowEx function?
 

darbid

Registered User.
Local time
Today, 11:38
Joined
Jun 26, 2008
Messages
1,428
.uFlags is the correct place to make the text right to left and .uFlags is also right. Change the oder of the flags and check that something else is not effecting it. I always find that theory and practice do not always make sense with the Windows API.
 

smig

Registered User.
Local time
Today, 12:38
Joined
Nov 25, 2009
Messages
2,209
WS_EX_LAYOUTRTL or WS_EX_RIGHT or WS_EX_RTLREADING
 

darbid

Registered User.
Local time
Today, 11:38
Joined
Jun 26, 2008
Messages
1,428
hey smig if you set up a mdb with just this in it and post it I will test it. I am not an expert but I will have a go for you.
 

smig

Registered User.
Local time
Today, 12:38
Joined
Nov 25, 2009
Messages
2,209
I only tried the changes I wrote to Leban's tooltip http://www.lebans.com/tooltip.htm

I added &H400000 Or &H1000 Or &H2000 (WS_EX_LAYOUTRTL or WS_EX_RIGHT or WS_EX_RTLREADING) as the extended window styles of CreateWindowEx

and the TTF_RTLREADING flag to the ToolInfo part in CreateWindowEx - 4th. var in function (CreateWindowEx is calling to he ToolInfo)
TTF_RTLREADING already declared by Leban
 

Users who are viewing this thread

Top Bottom