PDA

View Full Version : Custom Toolbar with Tooltips?



MrRhodes2004
10-10-2006, 09:50 AM
Hey All,

Below is code that I have that creates toolbar buttons; it works fine. Now, I would like to be able to add more functionality to the button. I would like a tooltip to pop up - like a mouse over command, similar to this website - that would explain what the botton does or what will happen when clicked. I thought it would be easy...



'add general column documents
With .Controls.Add(Type:=msoControlPopup)
.BeginGroup = False
.Caption = "Concrete"
.OnAction = ""
With .Controls.Add(Type:=msoControlPopup)
.BeginGroup = False
.Caption = "Column"
.OnAction = ""
With .Controls.Add(Type:=msoControlButton)
.BeginGroup = False
.Caption = "TxDOT AASHTO-17 Column Design"
.OnAction = "'HZI Tools.xla'!OpenTxColumn"


.ToolTipText = "I want to be able to have a tooltip show for this button that explains what the document is about."


End With
End With
End With

Any help would be appreciated.

Thanks

MKR

Bob Phillips
10-10-2006, 10:10 AM
I think that TooltipText only applies to toolbar buttons, noit menu items. You use caption to describe those.

Desert Piranha
10-10-2006, 10:43 AM
Hey All,

Below is code that I have that creates toolbar buttons; it works fine. Now, I would like to be able to add more functionality to the button. I would like a tooltip to pop up - like a mouse over command, similar to this website - that would explain what the botton does or what will happen when clicked. I thought it would be easy...



'add general column documents
With .Controls.Add(Type:=msoControlPopup)
.BeginGroup = False
.Caption = "Concrete"
.OnAction = ""
With .Controls.Add(Type:=msoControlPopup)
.BeginGroup = False
.Caption = "Column"
.OnAction = ""
With .Controls.Add(Type:=msoControlButton)
.BeginGroup = False
.Caption = "TxDOT AASHTO-17 Column Design"
.OnAction = "'HZI Tools.xla'!OpenTxColumn"


.ToolTipText = "I want to be able to have a tooltip show for this button that explains what the document is about."


End With
End With
End With

Any help would be appreciated.

Thanks

MKRHi MrRhodes,

I don't know why yours isn't working but, this is one of the buttons from my custom toolbar.
On mouseover it shows -->UnHide Columns<-- Maybe it can give you a clue.


With .Controls.Add(Type:=msoControlButton, temporary:=True)
.BeginGroup = True 'Makes seperator line.
.Caption = "Col" 'Caption on Button.
'.Style = msoButtonIcon 'Icon only.
.Style = msoButtonIconAndCaption 'Icon & Caption.
'.Style = msoButtonCaption 'Caption only.
.FaceId = 229
.TooltipText = "UnHide Columns" 'Text on mouseover.
.OnAction = "UnHideColumns" 'Calls Macro.
End With

MrRhodes2004
10-10-2006, 11:06 AM
Okay, someone please explain this....

TooltipText works when the button is not under a popup (or layered) but it does work if is a top botton.

Here it works:

With .Controls.Add(Type:=msoControlButton)
.Style = msoButtonIconAndCaption
.FaceID = 49
.BeginGroup = False
.Caption = "** HELP **"
.OnAction = "'HZI Tools.xla'!openhelpfile"
End With
With .Controls.Add(Type:=msoControlButton)
.Style = msoButtonIconAndCaption
.FaceID = 125
.BeginGroup = False
.Caption = "10.10.6"
.OnAction = "'HZI Tools.xla'!StopClicking"
.TooltipText = "This is just a test"
End With



Here it DOES NOT work:
With .Controls.Add(Type:=msoControlPopup)
.BeginGroup = True
.Caption = "Structural Documents"
.OnAction = ""

'Add general bridge documents
With .Controls.Add(Type:=msoControlPopup)
.BeginGroup = False
.Caption = "Bridge"
.OnAction = ""
With .Controls.Add(Type:=msoControlPopup)
.BeginGroup = False
.Caption = "Distribution Factors"
.OnAction = ""
With .Controls.Add(Type:=msoControlButton)
.BeginGroup = False
.Caption = "TxDOT LRFD LLDF"
.OnAction = "'HZI Tools.xla'!OpenTxLLFD"
End With
With .Controls.Add(Type:=msoControlButton)
.BeginGroup = False
.Caption = "Multiple LLDF"
.OnAction = "'HZI Tools.xla'!OpenHZiLLFD"
End With
End With
End With

'add general column documents
With .Controls.Add(Type:=msoControlPopup)
.BeginGroup = False
.Caption = "Concrete"
.OnAction = ""
With .Controls.Add(Type:=msoControlPopup)
.BeginGroup = False
.Caption = "Column"
.OnAction = ""
With .Controls.Add(Type:=msoControlButton)
.Style = msoButtonIconAndCaption
.BeginGroup = False
.Caption = "TxDOT AASHTO-17 Column Design"
.OnAction = "'HZI Tools.xla'!OpenTxColumn"
.TooltipText = "this is just a test - that does not work!!"
End With
End With
End With


End With

Any ideas why it works in one place and not the other?
If it helps and you would like the full code, let me know...