You can set an alternate text using the method
setAlternateText(). The alternate text should provide a
fallback for browsers that do not display an image, and are also
important for accessibility. If no sensible fallback text can be
provided, an empty text is preferred over nonsense.
You may listen to events by attaching event listeners to signals such as
clicked(). Since mouse events pass the coordinates through a
WMouseEvent object, it is possible to react to clicks in
specific parts of the image.
Image also supports a more structural approach to listening for
events depending on the image location. One can define
interactive areas on the image using
also allows to define a custom tool tip (using
WAbstractArea::setToolTip()) or a different cursor
WAbstractArea::setCursor) for a certain
In contrast to the image, which displays typically a static image resource, Wt are also includes several options for dynamically painted graphics.
WImage is an inline widget. The widget corresponds to the HTML
<img> tag and doesn't provide styling. It can be styled
using inline or external CSS as appropriate.