INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Grids

How can I add ToolTipText to grid columns and headers? by ChrisRChamberlain
Posted: 24 Jan 03 (Edited 3 Feb 11)

Grid columns and headers do not have a .ToolTipText property, so, for instance, if you have a grid with checkboxes without text, it's difficult for a user to know what clicking on the checkbox does.

Equally using text with a checkbox can be a large waste of space.

ToolTipText will only show for a control in a column when the control gets focus, so passing the mouse up and down a column without any help in the form of ToolTipText can also be confusing to a user.

You can add ToolTipText to grid columns and headers in VFP 7.0 and later by using the following code.

Create a new form method called .mToolTipText().

In the .mToolTipText() method of the form put :-

LPARAMETERS tnLeft, tnTop, tcText

IF !EMPTY(tcText)
    WITH THIS
            IF VARTYPE(.lblToolTipText)    =    [U]
                .AddObject([lblToolTipText],[label])

                WITH .lblToolTipText
                    .AutoSize =    .T.
                    .BackColor = RGB(255,255,215)
                    .BorderStyle = 1
                    .FontName = [MS Sans Serif]
                ENDWITH
            ENDIF
    
            WITH .lblToolTipText
                .Caption = tcText
                .Left = tnLeft
                .Top = tnTop + 15
                .Visible = .T.
        ENDWITH
    ENDWITH
ENDIF


In the .MouseEnter() events of the columns and headers put :-

lcToolTipText = [Whatever you need here]
THISFORM.mToolTipText(nXCoord,nYCoord,lcToolTipText)


If you prefer to use the .ToolTipText property available in VFP 8.0/9.0 instead of the variable lcToolTipText, in the .MouseEnter() events of the columns and headers put:-

THISFORM.mToolTipText(nXCoord,nYCoord,THIS.ToolTipText)


In the .MouseLeave() events of the columns and headers put :-

WITH THISFORM
    IF VARTYPE(.lblToolTipText) = [O]
        .lblToolTipText.Visible = .F.
    ENDIF     
ENDW


Have fun.

Chris pc2
motrac.co.uk
PDFcommandertm.com

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close