×
Namespaces

Variants
Actions
Revision as of 13:55, 25 July 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to show tooltips in Symbian applications

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: rathodavinash (27 Jun 2007)
Last edited: hamishwillee (25 Jul 2012)

A Tooltip is a small rectangular dialog that comes up as a help/description when you pause over a partucular control. It can either stay or dismiss in sometime.


Derive a container from CCoeControl, and in its ConstructL set the size of the rectangle of the tooltip along with the position where you want to show the tooltip.

iText->SetExtent(TPoint( 15, 15 ),iText->MinimumSize() );

iText here is a RichTextEditor.


void CTooltipContainer::Draw( const TRect& aRect ) const
{
///Make a Tooltip like rectangle
TRect iRect;
iRect = aRect;
iRect.Shrink(10,10);
CWindowGc& gc = SystemGc();
gc.SetPenColor(KRgbBlack);
gc.SetBrushColor( TLogicalRgb( TRgb(254,255,213) ) );
gc.Clear(iRect);
gc.DrawRect(iRect);
gc.SetClippingRect(iRect);
}

This tooltip can be shown depending upon a HandleKeyEventL/HandleCommandL or use a Timer to detect pause on a control and then show the tooltip.

A good tooltip example is the Active Standby screen of S60 2nd ED FP3 onwards devices, where the active standby apps display a tooltip of the app name.

The code above is simple and works as long as you always draw the tooltip topmost in the controller. You can create a floating tooltip by using a separate window, removing the coupling, see http://mikie.iki.fi/symbian/textbox.html .

This page was last modified on 25 July 2012, at 13:55.
35 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×