Custom controls

From Team Developer SqlWindows Wiki
Revision as of 11:48, 29 October 2013 by DaveRabelink (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Custom Control


Pointer2.png Trackbar Pointer.png


A trackbar is a window that contains a slider (sometimes called a thumb) in a channel, and optional tick marks.When the user moves the slider, using either the mouse or the direction keys, the trackbar sends notification messages to indicate the change.

Trackbars are useful when you want the user to select a discrete value or a set of consecutive values in a range. For example, you might use a trackbar to allow the user to set the repeat rate of the keyboard by moving the slider to a given tick mark. The following illustration shows a typical trackbar.


There are several samples which implements a trackbar.
Down.png SALExtension (look for Trackbar.apl)

The SalExtension Trackbar implements all features. Info on usage can be found here:

Web.png About Trackbar Controls

Pointer2.png MonthCalendar and DateTimePicker Pointer.png

(SysMonthCal32 and SysDateTimePick32)

A month calendar control implements a calendar-like user interface. This provides the user with a very intuitive and recognizable method of entering or selecting a date. The control also provides the application with the means to obtain and set the date information in the control using existing data types.


A date and time picker (DTP) control provides a simple and intuitive interface through which to exchange date and time information with a user. For example, with a DTP control you can ask the user to enter a date and then easily retrieve the selection.


There is a very nice sample by Christian Astor which shows these controls:

Info on usage can be found here:

Web.png About Month Calendar Controls
Web.png About Date and Time Picker Controls

Pointer2.png Tooltips Pointer.png


Team Developer offers tooltip support using qckttip library and starting from TD 5.1 and higher, SalSetTooltip.
But there are some tooltip features WinAPI has available which are not part of the native TD implementations.

For more tooltip options you can use the WinAPI_Tooltips module.
It supports these features:

  • Rectangle and balloon tooltips
  • Set text color and background color
  • Set font (size, font name and enhancement)
  • Floating tooltips (put them anywhere on screen)
  • Programmatically show and hide tooltips without user action
  • Set the size of the tooltip margins
  • Opaque tooltips (transparency)
  • Notification/Callback: get a notification on display of a tooltip so dynamically a new text can be set
  • Set tooltip title with or without icons
  • (optional) subclass tooltip messages to trap in TD (using Subclasser)

(for instance with this you can react on tooltip clicks, mouse moves or paint custom stuff on the tooltip).


The module is available in ANSI and UNICODE, so it works in all TD versions.

Build the source WinAPI_Tooltips.apt to WinAPI_Tooltips.apd (dynalib) and include it in your projects.
Just call the available exported functions to get tooltips within your application.
(A sample source is included to show how to call the module)

You can download the module here:
(current version : v1.02)

Pointer2.png Asynchronous throbber animations Pointer.png


(From Wikipedia) A throbber is a graphic found in a graphical user interface of a computer program (especially a web browser)
that animates to show the user that the program is performing an action (such as downloading a web page).

Web.png Wikipedia: Throbber

Common examples are rotating clocks and moving stripes on bars.

Here some examples:

Throbber bar.gif
Throbber clock.gif

So if you want to inform the user of your application that it is performing some tasks, it would be nice
to show such an animation.
But Team Developer applications are single threaded. This means that when your application is performing
a task (eg database access or a lengthy calculation) the application is unable to display a continuous animation.

Fortunately there is a simple way to show asynchronous animations which are displayed within a separate thread.
This means that when your application is performing a lengthy task, the animation keeps being played.
This can be achieved using the Windows animation control:

Web.png About Animation Control (MSDN)

When defined as Custom Control in your application, you can play AVI animations in your GUI.
Using the API, an animation can be played n-times or continuously.
For any information on the animation control, use the MSDN link above.

So you need to code this:

  • Open and play an animation just before any action in your app
  • execute the action
  • Stop and close the animation after the action has ended

There are some examples in the Sample Vault which shows how to use the SysAnimate control.
For this article a specific sample has been made.
There are two versions, one is ANSI (<TD5.x) and one is UNICODE (>TD5.x).

The sample can be downloaded here:


How to create nice throbber animations

The animations used in the sample are AVI's. The animation control can only play AVI's (see info on MSDN).
But most animations found are animated GIF's.
So, you will have to convert the animated GIF to an AVI animation.

A nice place to create custom animated GIF is here:


There you can select a template animation and tweak it. Set custom colors or transparency.
When ready, generate the animation and download it.
The animation will be an animated GIF. Just like the examples shown above.
Then use a 3rd party tool (eg PaintShop) to save the GIF as AVI.