Skip to Main Content
Volume 6A: Motif Programming Manual
book

Volume 6A: Motif Programming Manual

by David Brennan, Dan Heller, Paula Ferguson
September 1993
Intermediate to advanced content levelIntermediate to advanced
1014 pages
28h 26m
English
O'Reilly Media, Inc.
Content preview from Volume 6A: Motif Programming Manual
13.3.6 An Example
In this section, we pull together all of the functions we have described in the preceding sections. This example builds
on alpha_list.c, the program that adds items that are input by the user to a ScrolledList in alphabetical order. Using
another Text widget, the user can also search for items in the list. The searching method uses regular expression
pattern−matching functions intrinsic to UNIX systems. the source code shows the new application.
XtSetLanguageProc() is only available in X11R5; there is no corresponding function in X11R4.
XmStringCreateLocalized() is only available in Motif 1.2; XmStringCreateSimple() is the
corresponding function in Motif 1.1. XmFONTLIST_DEFAULT_TAG replaces XmSTRING_DEFAULT_CHARSET in
Motif 1.2.
/* search_list.c −− search for items in a List and select them */
#include <stdio.h>
#include <Xm/List.h>
#include <Xm/LabelG.h>
#include <Xm/Label.h>
#include <Xm/RowColumn.h>
#include <Xm/PanedW.h>
#include <Xm/TextF.h>
main(argc, argv)
int argc;
char *argv[];
{
Widget toplevel, rowcol, list_w, text_w;
XtAppContext app;
Arg args[5];
int n = 0;
XmString label;
void add_item(), search_item();
XtSetLanguageProc (NULL, NULL, NULL);
toplevel = XtVaAppInitialize (&app, "Demos", NULL, 0,
&argc, argv, NULL, NULL);
rowcol = XtVaCreateWidget ("rowcol",
xmPanedWindowWidgetClass, toplevel, NULL);
label = XmStringCreateLocalized ("List:");
XtVaCreateManagedWidget ("list_lable", xmLabelWidgetClass, rowcol,
XmNlabelString, label,
NULL);
XmStringFree (label); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Volume 7A: XView Programming Manual

Volume 7A: XView Programming Manual

Dan Heller

Publisher Resources

ISBN: 9780596000431