Tooltip Thread last updated on 2003-04-04 11:35:05

Posted by member 7223 on 2003-04-04 11:35:05

Want to add tooltip to labels or other modules (modules have to manage mousein/mouseout; of course)
Here's the way

*Timer Tip #l 1s !TipUpdate

TipLabelStartHidden
TipLabelAlwaysOnTop
TipLabelImageTopEdge 1
TipLabelImageLeftEdge 1
TipLabelImageRightEdge 1
TipLabelImageBottomEdge 1
TipLabelImage Tip.png
TipLabelFont Arial
TipLabelFontHeight 12
TipLabelFontShadow false
TipLabelFontColor 000000




; !TipInit
; IN:
; - %{\1} = "Text to display"
; - %{\2} = Width
; - %{\3} = Height
; OUT:
; - TipX, TipY, TipWidth, TipHeight modified


*Script Bang !TipInit
*Script Exec !TipLabelSetText "%{\1}"
*Script Exec !TipLabelResize %{\2} %{\3}
*Script Exec !VarSet TipX %{MouseX}
*Script Exec !VarSet TipY %{MouseY}
*Script Exec !VarSet TipWidth %{\2}
*Script Exec !VarSet TipHeight %{\3}
*Script Exec !Pause 100
*Script Exec !TimerStart Tip
*Script ~Bang



; !TipUpdate
; OUT:
; - TipX, TipY modified

*Script Bang !TipUpdate
*Script Exec !IfEval ("%{TipX}" > "$ResolutionX/2$") |VarAdd TipX -%{TipWidth}
*Script Exec !IfEval ("%{TipY}" > "$ResolutionY/2$") |VarAdd TipY -%{TipHeight}
*Script Exec !TipLabelMove %{TipX} %{TipY}
*Script Exec !IfEval ("%{TipX}" > "$ResolutionX/2$") |VarAdd TipX %{TipWidth}
*Script Exec !IfEval ("%{TipY}" > "$ResolutionY/2$") |VarAdd TipY %{TipHeight}
*Script Exec !IfEq TipX "%{MouseX}" '|TipLabelShow' else '|TipLabelHide'
*Script Exec !IfEq TipY "%{MouseY}" '|TipLabelShow' else '|TipLabelHide'
*Script Exec !VarSet TipX %{MouseX}
*Script Exec !VarSet TipY %{MouseY}
*Script ~Bang


You have to create an tip.png


Example:
TimeLabelOnMouseEnter !TipInit "[uptime('d day ii:nn')]" 64 14
TimeLabelOnMouseLeave !TimerStop Tip