Copyright: Hint Control v1.0


Table of Contents
ToolTips Custom Control v1.1

About the Author

Overview

The ToolTips Control makes it easy to provide context-sensitive hints to the user of your application. It passes the value of the Name and Tag properties of controls when the mouse passes over them (including menu items) and/or a control receives the input focus. When the mouse pointer lingers over a control, it will display an MS-style ToolTip under the pointer until the user moves the mouse off of the control.

What's New in Version 1.1?

Control Reference

Quick Start

Getting Help at Design Time

Using Multiple Controls

How to Register

Distribution Note

When you create and distribute applications that use the ToolTips control. You should install the TOOLTIPS.VBX file in the customer's Microsoft Windows \SYSTEM subdirectory.


About the Author
The ToolTips Control was developed by:

Jim Lamb
CompuServe ID: 76400,2225

Registered users may receive technical support via E-Mail to my CompuServe ID. Suggestions for improvements are welcome.


Control Reference
ToolTips Control Reference

Contents

Description

The ToolTips Control is easy to use. Just drop it onto the main form of your application and use the MenuSelect and ControlTip events to set the Caption of the control your using for a status line. Then set the Tag property of the controls you want supported.

Properties

About

Enabled
BackColor
FontBold
FontItalic
FontSize
FontStrike
FontUnder

IgnorePrefix

ShowTips

Left
Name

TipDelay

TipSource

Tag
Top

Events

ControlTip

FetchTip

FocusControl

MenuSelect

OnToolTip


How to Register

Contents

There are several ways to register your Hint control:

Send $30 and your CompuServe ID to the address below. A licensed version of the control  will be sent to you via E-Mail.

Send $30 + $6 for shipping and handling to the address below. A distribution disk will be sent to the address you provide.

Register via the SWREG form on CompuServe. The registration ID for ToolTips is 2302. Your account will be billed $30.

If registering via e-mail or SWREG, you will receive the registered version of the control via e-mail. If registering via mail, send a check or money order payable to Jim Lamb to:

Jim Lamb, Attn: ToolTips
4126 400 Ave. W., Suite #1
Oak Harbor, WA 98277

Please allow 2-4 weeks for delivery.


ShowTips Property

Control Reference

Contents

Description

Determines whether or not floating hints will appear below the mouse pointer when it lingers stationary over a control with a non-null Tag property.

Remarks

Although the ToolTips control uses the Tag property of controls the user is pointing to, you can still store your own data there. Tag property values can be formatted as follows: long hint|short hint;extra.

The long hint comes first. This is the string passed by the ControlTip, FocusControl, and MenuSelect events. The short hint (after the pipe "|" character) will be shown in the floating ToolTip popup window. Any text after a semi-colon is ignored.

The standard font properties determine the font used in the ToolTip. The standard BackColor property determines the background color for the ToolTip.

Data Type

Boolean


TipDelay Property

Control Reference

Contents

Description

In tenths of a second, the time the mouse pointer must remain stationary over a control before a floating hint appears.

Remarks

This value applies only if ShowTips is True. The default value of 12 (1.2 seconds) works well.

Data Type

Integer


About Property

Control Reference

Contents

Description

Displays version and copyright information for the control. Read-only at design time and unavailable at run time.

Remarks

You can click on the ellipsis ("...") button to the right of the settings box in the properties window to display the About dialog box. The dialog contains the toolbox icon for the control, the version number, and copyright information.

Data Type

None


ControlTip Event

Control Reference

Contents

Description

Occurs when the user moves the mouse pointer over a control. Event is fired only upon entering the client area of a control (unlike the MouseMove event).

Syntax

Sub CtlName_ControlTip ( ControlName as String, ControlTag as String )

Remarks

ControlTag contains a portion of the Tag property of the control. Use the pipe character ("|") to separate the short hint (used in floating hints) from the long hint passed in ControlTag. Any text after a semi-colon is ignored by the ControlTip, FocusControl, MenuSelect and OnToolTip events.

Example code snippet


MenuSelect Property
MenuSelect Event

Control Reference

Contents

Description

Occurs when the user moves the mouse pointer over a menu item. If the menu is cancelled, an MenuSelect event is fired passing a blank string.

Syntax

Sub CtlName_MenuSelect ( MenuName as String, MenuTag as String )

Remarks

MenuName passes the Name and Tag properties of the selected menu control. Menu controls are listed in the properties window, where you can select them and set their Tag property.

Example code snippet


MenuSelect Event Example

MenuSelect Event

Sub ToolTips1_MenuSelect (MenuName As String, MenuTag As String)
  frmStatus.Caption = " " + MenuTag
End Sub


ControlTip Event Example

ControlTip Event

Sub ToolTips1_ControlTip (ControlName as String, ControlTag As String)
  frmStatus.Caption = " " + ControlTag
End Sub


Tag Property

Use the pipe character ("|") to separate the short hint (used in floating ToolTip windows) from the long hint passed in the ControlTip, FocusControl and MenuSelect events. Any text after a semi-colon is ignored.


OnToolTip Event

Control Reference

Contents

Description

Fired just before a ToolTip is displayed. Use this event to present the long hint on your status line while the ToolTip is displayed. If you are already responding to the ControlTip event, responding to the OnToolTip event is probably unnecessary.

Syntax

Sub CtlName_OnToolTip ( LongTip as String, ShortTip )

Remarks

LongTip and ShortTip contain a portion of the Tag property of the control. Use the pipe character ("|") to separate the ShortTip  (used in floating ToolTips) from the LongTip passed. Any text after a semi-colon is ignored by the ControlTip, MenuSelect and OnToolTip events.

Example code snippet


OnToolTip Event Example

OnToolTip Event

Sub ToolTips1_OnToolTip (LongTip As String, ShortTip as String)
  frmStatus.Caption = " " + LongTip
End Sub


Using Multiple Controls

Contents

Only one control is required to support ToolTips. It should be placed on the first form loaded by your application for proper initialization.

The MenuSelect event, which provides notification of menu selection, functions only for the Form on which the ToolTips control is placed. If your application has more than one Form with top level menus, place another ToolTips Control on that Form to provide support for the MenuSelect event within that Form. (Note: for MDI child forms, you only need one ToolTips Control on your parent MDI Form).


Quick Start

Contents

Control Reference

Follow these simple steps to add ToolTips to your application:

Add the  TOOLTIPS.VBX file to your project. Select Add File from Visual Basic's File menu.

Drag a ToolTips Control from the toolbox to your startup form.

Does your application have a status line? If not, you'll want to create one now. The SSFrame control from THREED.VBX (which comes with VB Pro) works well, though I recommend VideoSoft's Elastic control.

Double click on the ToolTips Control you added to your form.

Add a line of code in the MenuSelect event that sets the Caption of your status line to the value passed in the MenuTag argument. (This will support menu selection hints on your status line).

Add a line of code in the OnToolTip event that sets the Caption of your status line to the value passed in the LongTip argument.

Set the Tag property of the related controls in your project to the desired Tip String.

Unfortunately, you cannot set the Tag property for menu controls at design time, so you need to write some code (ugh!) in the Load event of your startup Form that sets the Tag property of your menu controls (e.g. mnuFile.Tag = "File Operations")

That's it!


Getting Help at Design Time
Getting Help during Design-Time

Contents

There are just a few simple steps to remember to access this help file during the design of your project:

The help file should be in your path. (The windows directory would probably be a good place for it)

For help on a property, click on the property in the property window and press F1.

For help on an event, double click on the ToolTips control or select it in the Object combo box. Then select the event in the Proc combo box and press F1. The Proc combo box must have the focus or ToolTips won't be notified of the help request.


FocusControl Event
ControlTip Event

Control Reference

Contents

Description

Occurs when a VB control receives the input focus by any means (tab, mouse click, etc.) Great for providing the user with suggestions during data entry. Saves you from writing a procedure for every control's GotFocus event.

Syntax

Sub CtlName_FocusControl ( ControlName as String, ControlTag as String )

Remarks

ControlTag contains a portion of the Tag property of the control. Use the pipe character ("|") to separate the short hint (used in floating hints) from the long hint passed in ControlTag. Any text after a semi-colon is ignored by the ControlTip, FocusControl, MenuSelect and OnToolTip events.

Example code snippet


FocusControl Event Example
ControlHint Event Example

ControlHint Event

Sub Hint1_ControlHint (ControlName as String, ControlTag As String)
  frmStatus.Caption = " " + ControlTag
End Sub


FetchTip Event

Control Reference

Contents

Description

Occurs whenever the ToolTips Control is about to pass a Tip via the ControlTip, FocusControl, MenuSelect, or OnToolTip events. Depending on the value of the TipSource property, allows the user to override or replace Tips. Use this event with the TipSource property if you need to use the Tag property for another purpose in some or all of your controls.

Syntax

Sub CtlName_FetchTip ( ControlName as String, ControlHWnd as String, Tip as String )

Remarks

ControlName and ControlHWnd allow you to identify the control. If the TipSource is the Tag Property  or Tag then FetchTip, then Tip will contain the contents of the Tag property. If TipSource is FetchTip Event, Tip will be a null string. Set or change the value of the Tip parameter as necessary. The Tip parameter can be formatted the same way as the Tag property (with a long and short hint). Note: you only need to respond to this event if you do NOT want to use the Tag property for hint storage in some or all of your controls.

Example code snippet


FetchTip Event Example

ControlHint Event

Sub Hint1_FetchTip (ControlName As String, ControlHWnd as Integer, Tip as String)
  Select Case ControlName
    Case "btnTools(0)"
      Tip = "Create a new file|New"
    Case "btnTools(1)"
      Tip = "Open an existing file|Open"
  End Select
End Sub


IgnorePrefix Property

Control Reference

Contents

Description

Contains a delimited list of three letter prefixes of controls which should be ignored by ToolTips, e.g. "frm;pic".

Remarks

This property comes in handy when you want ToolTips to use the Tag property on all but a specific group of controls. For example, the Tag property is often used in MDI child forms to identify which child an operation pertains to. To prevent ToolTips from popping up a ToolTip with the Tag of an MDI child, use the same three letter prefix on your MDI child forms (i.e. "frm" or "mdi") and then set the IgnorePrefix property to include those prefixes (for multiple prefixes, simply separate them with a semi-colon)..

Note: the FetchTip event will not allow you to override the Tip for a control set to be ignored in the Ignore Prefix property.

Data Type

String


TipSource Property

Control Reference

Contents

Description

Determines where ToolTips looks for Tip strings. There are three possible values: Tag Property (0), FetchTip Event (1), and Tag then FetchTip (2).

Remarks

When TipSource is set to Tag Property, ToolTips simply extracts Tips from the Tag property of all controls. For FetchTip Event, the Tag property is ignored and you must write code in the FetchTip event of the ToolTips Control to provide tip strings. The "Tag then FetchTip" setting allows you to draw on the Tag property and only override it when neccessary in the FetchTip event.

Use this property for fine control over Tip strings.

Data Type

Enumerated Value


What's New in v1.1
What's New in ToolTips v1.1a?

Contents

Control Reference

IgnorePrefix property lets you exclude whole groups of Controls with no coding.

TipSource property gives you increased flexibility over how ToolTips retrieves Tip strings. Do no coding, some coding, or significant coding depending on your requirements.

Create multi-line ToolTips by inserting a carriage return, Chr$(13), or "\N" in the Tip text.

FetchTip Event gives you complete control over the context-sensitve Tips the ToolTips control sends to your app via the ControlTip, FocusControl, MenuSelect and OnToolTip events.

ToolTips v1.1a has been successfully tested on Windows NT!

Supports multiple instances of the ToolTips control.

Numerous Bug Fixes


Numerous Bug Fixes
Bug Fixes in v1.1

System lock up when a ToolTips application is running side-by-side with a MS application using ToolTips.

Conflict with VSVBX.VBX elastic control's use of Tag property for autmoatic labels. Resolved by creating FetchTip event and TipSource and IgnorePrefix properties.

Flicker when ToolTip pop-up overlapped an Elastic control from VSVBX.VBX.

If you think you have discovered a bug, please don't hesitate to contact Jim Lamb at CIS 76400,2225. Registered users will be provided bug-fixes and version upgrades for a period of 12 months.