The LiteClue Widget
Copyright 1995 Computer Generation, Inc. You may reproduce this document
without charge provided the copyright and disclaimer notices appear. The
software described in this document is copyrighted under separate terms.
See the source code available at
ftp://ftp.compgen.com/pub/widgets/LiteClue.tar.Z
The software is provided "as is", without warranty of any kind, express
or implied, including but not limited to the warranties of
merchantability, fitness for a particular purpose and noninfringement.
In no event shall Computer Generation, inc. nor the author(s) be liable for
any claim, damages or other liability, whether in an action of contract,
tort or otherwise, arising from, out of or in connection with the
software or the use or other dealings in the software.
The author welcomes comments and suggestions. Thanks to contributers:: J Satchell, Eric Marttila, Addy Klos.
If you wish to be on an Emailing list regarding this or other
CGI widgets, please send a request to the above address.
You will be notified when this or other widgets are upgraded
or when new widgets become available.
Updated: 30 October 1998
LiteClue is a widget
which pops a one line help
message when the user passes the pointer over another "watched" widget. This is
known by various names in the industry such as hints, clues, tips,
bubble help and balloon help.
Clues are particularly helpful for push buttons that contain graphic
pixmaps rather than text. They obviate the need to place text within graphics
in the button which creates internationalization problems.
A clue may be attached to virtually any widget that has a window (no gadgets).
LiteClue works with Motif but does not require it.
None of this affects the behaviour of the watched widget itself.
LiteClue monitors enter and leave events of the watched widget's
window passively.
LiteClue relies on EnterNotify and LeaveNotify events for the the widgets
it is watching. This will normally prevent clues from poping up
when the watched widgets are insensitive. See the function
XcgLiteClueDispatchEvent for a way to bypass this limitation.
LiteClue inherits behaviour and ewsources from OverrideShell.
The class pointer is xcgLiteClueWidgetClass.
The class name is xcgLiteClue.
Version 1.2
Version 1.3
Version 1.4
Version 1.4
The source distribution kit contains the following files:
LiteClue has been compiled successfully on NCR MPRAS,
Digital OSF/Unix, ULTRIX (XR4), Linux, VMS and probably many others.
To build the test program:
For VMS, see the file BUILD.COM.
LiteClue is designed for X11R4 or higher. It checks
XtSpecificationRelease at compile time. When compiled for X11R5 or
higher, it uses font sets which gives it good internationalization
support (see Section 10 below). However, you can also force it to
use font structs instead by setting a compile time variable (see make
file).
When using font sets, you may get the message:
which means that your locale does not support the font's character sets.
On many machine, the default C locale does not allow 8-bit characters
or the iso88591 character set required by the default fonts.
Fix this by setting your LANG environment variable. For example, on HP-UX
in the US you set:
LiteClue adds the following resources to those it inherits. The resource class
is obtained by replacing the N by a C in the resource name (eg:
XtNfontSet is the name XtNfontSet is the class. The access types are
C (resource may be set at create time), S (may be se using XtSetValues), or
G (may be read using XtGetValues).
The background color resource XtNbackground of the clue popup is
inherited from OverrideShell.
LiteClue adds no new callbacks over those it inherits.
LiteClue has no translations.
LiteClue contains the following functions that control the widget behaviour.
Since LiteClue is a shell widget , you make an instance of the shell
as in this example:
If you want to change the font used by LiteClue, you could add
the fontSet resource at create time as in:
You need only create a single instance of the widget for the application.
To attach help to a widget (usually a push button) use
the function XcgLiteClueAddWidget (Section 8.1) as in:
The LiteClue widget is designed to allow the display of internationalized
text. This has been tested on a limited basis with Japanese.
In order to make use of internationalization, you must have support
in your operating system for the desired locale and must have the
needed fonts. In some cases, you may use the X provided locale
support instead. At initialization, you should have code that
looks something like:
If you need the X locale package, add the following:
Finally, you must set the environment symbol LANG to the appropriate locale.
For Japanese, one possibility is "LANG=ja_JP.eucJP".
1. Copyright
Gary Aviv
Computer Generation, Inc.,
gary@compgen.com
404-705-28112. Introduction
3. Version Information
4. Distribution Kit
xmkmf
make
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset
LANG=C.iso88591
5. Resources
The font used to display the clue. For Xt Release 4 or less, the resource
name XtNfont and the type is FontStruct.
The color used to render the clue text
The delay from the time the pointer enters the watched widget until
the help is popped up in milliseconds.
The period (in milliseconds) after
a help popdown occurs in which the normal waitPeriod is suspended.
If the pointer should re-enter a watched widget during this period
help pops up immediately rather than waiting waitPeriod milliseconds.
6. Callbacks
7. Translations
8. LiteClue API
8.1 XcgLiteClueAddWidget -- Add a widget to be watched.
8.2 XcgLiteClueDeleteWidget -- Delete a widget that is watched.
8.3 XcgLiteClueSetSensitive - Enable/disable clues for watched widget.
False - make insensitivity
8.4 XcgLiteClueGetSensitive - Get sensitivity setting for watched widget.
False - watched widget is not sensitive
8.5 XcgLiteClueDispatchEvent -- Dispatch event from main X event loop
MyXtAppMainLoop(XtAppContext app)
{
XEvent event;
for (;;) {
XtAppNextEvent(app, &event);
XcgLiteClueDispatchEvent(w, event) ;
XtDispatchEvent(&event);
}
}
9. Sample Use
Widget liteClue, toplevel ;
...
toplevel = XtVaAppInitialize(&AppContext,
...
liteClue = XtVaCreatePopupShell( "LiteClue_shell",
xcgLiteClueWidgetClass, toplevel, ..., NULL);
#define RES_CONVERT( res_name, res_value) \
XtVaTypedArg, (res_name), XmRString, (res_value), strlen(res_value) + 1
liteClue = XtVaCreatePopupShell( "LiteClue_shell",
xcgLiteClueWidgetClass, toplevel,
RES_CONVERT(XtNfontSet, \
"-adobe-new century schoolbook-bold-r-normal-*-18-*"),
NULL);
button_widg = XtVaCreateManagedWidget("Button1", xmPushButtonWidgetClass,
...
XcgLiteClueAddWidget(liteClue, button_widg, "Help Message", 0, 0);
In order to enable clues for insensitive widgets you will need to replace
the standard call to XtAppMainLoop with the code as illustrated in the
function XcgLiteClueDispatchEvent.
10. Internationalization
if (setlocale(LC_ALL,"") == NULL)
fprintf(stderr, "LiteCluetest: Can't set locale\n");
if (!XSupportsLocale())
{
fprintf(stderr, "LiteCluetest: X does not support locale\n");
setlocale(LC_ALL,NULL) ;
}
if (XSetLocaleModifiers("") == NULL)
fprintf(stderr, "LiteCluetest: Can't XSetLocaleModifiers\n");
#define X_LOCALE
#include <X11/Xlocale.h>
LiteClue makes use of the XR5 Font Set technology. All
font resources are converted to Font Sets. For example, for Japanese
you will need three fonts for each font set:
*XcgLiteClue.fontSet: \
-sony-fixed-medium-r-normal--0-110-100-100-c-0-jisx0201.1976-0,\
-adobe-new century schoolbook-medium-r-normal-*-14-*,\
-jis-fixed-medium-r-normal--16-110-100-100-c-160-jisx0208.1983-0