The tooltip
allows you to show a floating "tooltip" on any
view. To use it you make it a child of a view. The parent view has
to be clickable for the tooltip to work. Setting clickable to false
will disable the tooltip.
Example 62. Tooltip
<canvas
height
="60
" layout
="axis:y; spacing: 10
">
<text
>Mouse over the button to see the tip
</text
>
<button
text
="Button, button
">
<tooltip
>Click or mouse out to hide tip
</tooltip
>
</button
>
</canvas
>
You can subclass tooltip
and override
the update
method to create dynamic tooltips
Example 63. Dynamic Tooltip
<canvas
height
="180
">
<class
name
="timetip
" extends
="tooltip
" with
="formatter
">
<attribute
name
="formats
" value
="{us: '%2$d/%3$d/%1$d %4$02d:%02d:%02d', eu: '%1$4d-%2$02d-%3$02d %4$02d:%02d:%02d'}
"/>
<method
name
="update
">
var now = new Date;
this.setAttribute('text',
this.formatToString(
this.formats[locale.text],
now.getFullYear(),
now.getMonth(),
now.getDay(),
now.getHours(),
now.getMinutes(),
now.getSeconds()));
</method
>
</class
>
<stylesheet
>
boxmodel { padding: 10 }
tooltip { content: "Traditional tooltip" }
</stylesheet
>
<view
layout
="axis:y; spacing: 25
" with
="boxmodel
">
<view
layout
="axis: x; spacing: 20
">
<button
id
="locale
" onclick
="this.setAttribute('text', this.text == 'us' ? 'eu' : 'us')
">us
</button
>
<text
multiline
="true
" width
="250
">
Click on the eu/us button to change locale. Hover over the blue box to see a locale-dependent tooltip
</text
>
</view
>
<view
layout
="axis: x; spacing: 20
">
<view
width
="75
" height
="75
" bgcolor
="blue
" clickable
="true
">
<timetip
/>
<text
fgcolor
="white
" valign
="middle
" align
="center
">Dynamic
</text
>
</view
>
<view
width
="75
" height
="75
" bgcolor
="lime
" clickable
="true
">
<tooltip
/>
<text
fgcolor
="white
" valign
="middle
" align
="center
">Static
</text
>
</view
>
</view
>
</view
>
</canvas
>
The appearance of the tooltip is determined by the canvas.tooltipview element
Name (CSS property) | Type (tag) | Type (js) | Default | Category |
---|---|---|---|---|
text
|
text | String | read/write | |
content | The text that will be displayed by the tooltip. If the text
is null or empty, no tooltip will be displayed.
You can use the CSS property content to set the
text of a tooltip from a stylesheet
|
|||
tipalign
|
right | left | String | left | read/write |
Whether the tooltip is horizontally aligned by it's left edge (default) or right edge relative to the mouse position. | ||||
tipvalign
|
above | below | default | String | default | read/write |
Whether the tooltip shows up above or below the mouse position. Default will position heuristically to keep the tooltip visible on the canvas. | ||||
yoffset
|
expression | any | 25 | read/write |
The vertical offset of tooltip from the mouse position. |
classroot, cloneManager, data, datapath, defaultplacement, id, ignoreplacement, immediateparent, inited, initstage, name, nodeLevel, options, parent, placement, styleclass, subnodes, transition
Methods
animate, applyConstraintMethod, applyData, childOf, completeInstantiation, construct, createChildren, dataBindAttribute, destroy, determinePlacement, getOption, getUID, init, lookupSourceLocator, releaseConstraint, releaseConstraintMethod, searchImmediateSubnodes, searchSubnodes, setOption, setSelected, updateData
Events
Copyright © 2002-2010 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.