Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tooltips on a 'Disabled' MSHFlexGrid

Status
Not open for further replies.

KarlR69

Programmer
May 30, 2008
2
US
I have some code that displays a ToolTip when the user hovers over a row in a MSHFlexGrid. This code is in the "MouseMove" event and it works well.

However, for real-estate reasons, I only allow the user to move through the records using separate navigation buttons I created. I would like to set the "Enabled" property to "False", but if I do this, the grid no longer runs the "MouseMove" event.

Is there a way to keep this event firing, but disable users from selecting a row by clicking on it?

I would greatly appreciate any suggestions!
Thank you.
 
When a window is disabled, mouse events are directed to parent window which contains the disabled object.

I suggest that you place a blank label control beneath the FlexGrid in such a way that the FlexGrid just covers the label, i.e. size and position of both controls are same. After that, assign the tooltip to Label control, instead of the FlexGrid. Now, when you move the mouse, events are directed to the container window (perhaps the form) which displays the tooltip of label control at that position.

The following example sums it all.
___
[tt]
Private Sub Form_Load()
With Me.Controls.Add("VB.CommandButton", "C1")
.Visible = True
.Enabled = False
.Caption = "Button"
End With
With Me.Controls.Add("VB.Label", "L1")
.Visible = True
.ToolTipText = "Hello"
End With
End Sub[/tt]
 
Genius! That worked perfectly. I had to play some games with the Zorder of my layout, but I got it working with your solution.

Thank you very much for your creative solution!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top