How to handle events in custom controls
Article Metadata
Code Example
Tested with
Compatibility
Article
Contents |
Overview
The original article is in Russian. You can find it here.
This example demonstrates how to use container controls, how to handle events and how to use custom controls in the dialogs.
Source code of this project: File:Cc.zip.
CSuperControl
It is a container control. It consists of two objects: CSmileControl and CSliderGroup. Method SizeChanged() calculates size and position of these embedded parts. Depending on the sizes, the embedded parts are displayed from top to bottom or from left to right. This control supports events handling - events are passed to the embedded control CSliderGroup. This control also displays the background of the current theme.
CSmileControl
This non-focusing control doesn't supports events handling. It's just displays the smile, considering coefficients of the deformation (iDeltaX, iDeltaY).
CSliderGroup
It is a container control. It consists of two sliders for defining two values. This control supports events handling. There are two possible result of event: focus changed or value of the slider changed.
CSimpleSlider
This simple control is used for displaying value ( dX or dY ) and for changing this value.



25 Sep
2009
This article contains the link to the source codes of demo project that shows how to orginize custom controls and how to catch events from custom controls. If you want to orginize own GUI then this article helps you a lot. The demo project contains detailed comments and supports such important aspect as current theme of device. The next step is support of S60 5th and sensor screens.