[an error occurred while processing this directive]
HP OpenVMS Systems Documentation |
HP DECwindows Motif for OpenVMS
|
Previous | Contents | Index |
This example is a simple UIL/Xm program with a label and a push button.
With this version, you can choose a Kanji, Hebrew, French, or English interface at run time.
The program uses the file LOCALSTRINGS.UID for all language-specific interfaces. To change languages, copy one of the LOCALSTRINGS_*.UID files to DECW$USER_DEFAULTS:LOCALSTRINGS.UID. Then, use the logical name LANG or the xnlLanguage resource to set the locale. Set the LOCALSTRINGS suffix and the locale name to one of the following:
Locale | Interface Type |
---|---|
Japan | Kanji |
Hebrew | Hebrew |
French | French |
English | Standard English |
To define the xnlLanguage resource, add the following line to your DECW$XDEFAULTS.DAT file:
*xnlLanguage:locale |
The following fonts are needed for the helloint example program:
Locale | Font Name |
---|---|
French | -adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1 |
English | -adobe-times-medium-r-normal--14-100-100-100-p-74-iso8859-1 |
Hebrew | -Misc-Fixed-Medium-R-Normal--13-120-75-75-C-80-ISO8859-8 |
Japan | -*-JISX0208.1983-1 |
-*-JISX0201.1976-0 |
If you do not have these fonts installed on your system, either change
the UIL files to reference other fonts or install the *.DECW$BDF fonts
provided in the DECW$EXAMPLES directory. See Managing DECwindows Motif for OpenVMS Systems for
instructions on how to install new fonts.
B.5 Hellomotif Example Program
This example is a simple UIL/Xm program with a label and a push button.
B.6 Motifanim Example Program
The motifanim program demonstrates the following OSF/Motif features:
This example lets you animate a set of pixmaps in an X window. The pixmaps are not fixed by motifanim but are read at startup from existing UID files.
The syntax of all the animation.uid files can add a new set of pixmaps to be animated using motifanim. Some tree examples of animation data files include:
dog.uil
plane.uil
The default animation is dog. To run the example with the other animations, use the following commands:
$ SET DEFAULT DECW$EXAMPLES $ motifanim := "$DECW$EXAMPLES:motifanim" $ motifanim -anim plane |
The files motiflogo.uil, motifanim.uil, and motifanim.c are the core
components of the program.
B.7 Motifgif and Pict Viewing Programs
V1.2
The following .gif files are provided:
V1.1
The motifgif and pict programs work together to display a .gif formatted picture. The motifgif program displays a .gif file within Motif constructs. The motifgif program looks for .gif files in the current directory.
The motifgif program has three significant components:
The following problems exist with motifgif:
The motifshell program is an example of an environment created using Motif. The purpose of the example is to show how Motif may be used as a standalone environment for dispatching other programs and utilities.
The motifshell program is written in C code. There are no UIL references.
Displaying a file listing or process status takes some time. These operations are accomplished by spawning a DCL command, capturing the output in a file, and then reading the file. The default font is proportionally spaced. Some listings are more readable if a fixed space font is used, such as Courier. Use the Font option to select a different font. |
The periodic example is a demonstration of the displayable widgets in
Motif. The program displays Motif widgets in a periodic chart format.
B.10 Textedit Example Program
The textedit program is a primitive text editor based on the Motif XmText widget that makes use of its XmNsource resource to allow multiple views of the same underlying text.
Table B-1 describes the View menu options.
Option | Description |
---|---|
Split Pane | Adds a new independently scrollable view of the text. |
Remove Pane | Removes a designated pane. |
One Pane | Removes all panes except the designated pane. |
The designated pane is determined in the following way:
The designated pane is also the one whose clipboard contents are pasted when Paste is selected from the Edit Menu.
The textedit sources are separated into independent layers. Textedit contains the source files listed in Table B-2.
File Name | Description |
---|---|
tfile.c | The code to read, write, and remove files. Hides any operating system or filesystem dependencies. |
app.c | Uses tfile.c to provide all the code to manipulate files and their related buffers. This is toolkit-dependent. |
tk.c |
Isolates dependencies on the Xm Toolkit.
The first half of the file provides utility routines and a toolkit-independent (but application-specific) interface that can be used by the toolkit-independent dialog layer of the application. The second half of the file defines all the callback routines. Many of these update state internal to this layer; others perform additional actions. Those actions unambiguously correspond to toolkit-specific action routines defined in the first half of the file. Otherwise, an upcall is made to the toolkit-independent dialog layer to decide what to do. |
dlg.c | Uses tk.c to manage dialog with the user. The code is toolkit-independent. |
textedit.c | Initializes the application and instantiates widget hierarchies. The code hides the use of UIL and Mrm from the rest of the application. |
Moving and removing files is not currently implemented. |
V1.2
Users familiar with emacs may want to add the following translations to their DECW$XDEFAULTS.DAT files:
*XmText.translations: Mod1<Btn3Down>: scroll-cursor-vertically()\n\ Mod1<Btn3Motion>: scroll-cursor-vertically()\n\ Ctrl<key>a: beginning-of-line()\n\ Ctrl<key>b: backward-character()\n\ Ctrl<key>d: delete-next-character()\n\ Ctrl<key>e: end-of-line()\n\ Ctrl<key>f: forward-character()\n\ Ctrl<key>g: beep()\n\ Ctrl<key>h: delete-previous-character()\n\ Ctrl<key>i: cut-primary()\n\ Ctrl<key>j: newline-and-indent()\n\ Ctrl<key>k: set-anchor() end-of-line() key-select() cut-clipboard()\n\ Ctrl<key>l: redraw-display()\n\ Ctrl<key>m: newline()\n\ Ctrl<key>n: next-line()\n\ Ctrl<key>o: newline-and-backup()\n\ Ctrl<key>p: previous-line()\n\ Ctrl<key>v: next-page()\n\ Ctrl<key>w: cut-clipboard()\n\ Ctrl<key>y: paste-clipboard()\n\ Ctrl<key>z: scroll-one-line-up()\n\ Mod1<key>b: backward-word()\n\ Mod1<key>d: delete-next-word()\n\ Mod1<key>f: forward-word()\n\ Mod1<key>h: delete-previous-word()\n\ Mod1<key>i: copy-primary()\n\ Mod1<key>k: delete-to-end-of-line()\n\ Mod1<key>v: previous-page()\n\ Mod1<key>w: copy-clipboard()\n\ Mod1<key>z: scroll-one-line-down()\n\ Mod1 Shift<key>greater: end-of-file()\n\ Mod1<key>less: beginning-of-file()\n\ Mod1<key>]: forward-paragraph()\n\ Mod1<key>[: backward-paragraph() |
The view program is similar to the DCL command TYPE/PAGE using Motif with internationalization support. It allows you to view files in several languages.
The command file DECW$EXAMPLES:FILEVIEW.COM is provided, which allows you to select a language. Valid languages are French, English, and German. To select a language, perform the following commands:
$ SET DEFAULT DECW$USER_DEFAULTS $ @DECW$EXAMPLES:FILEVIEW language |
This command file copies the .UID and .DAT files to the current directory. It sets the appropriate locale and executes the file viewing example program.
When the application is started, a primary top-level shell is created. From the primary top-level shell, you can create secondary shells.
Each top-level shell is a parent of a Main Window, the work area of which is a PanedWindow.
The menu bar has the following entries:
The file menu contains the following options:
The view menu contains the following options:
Opening a second file in a window causes the application to end
abruptly. The View options do not work correctly.
B.12 Xmpiano Example Program
The xmpiano program shows how to write a Motif Interface to Dumb Instruments (MIDI) application. Both a staff, for writing music, and keyboard are provided.
At the bottom of the window is a set of notes that may be used on the staff. Selecting one of these note buttons changes the active note accordingly. The selected note is also displayed as the new mouse cursor.
Though the note selection is limited, it is possible to play sharps as well as naturals. The program interface has not been written to play flats. The staff automatically resizes larger as notes are added past the right side of the staff. To see these notes, scroll the score window as needed.
To use this application, press the right mouse button on a staff that is visible. The following menu items are displayed:
This version does not allow editing of notes. To edit, clear the staff and start again, or read the data from a saved file.
To set the color of the notes, change the foreground color of the application. To do this, use the -fg option on the command line. For example:
$ xmpiano :== $DECW$EXAMPLES:xmpiano $ xmpiano -fg blue |
The xmtravel example is a front end to a travel agent client and flight database. The program is designed to illustrate various user-interface design concepts as well as be compliant with the OSF/Motif Style Guide.
The program is just an example, many of the functions are either not
implemented or use predefined settings.
B.14 Additional Sample Programs
Table B-3 lists sample programs showing various Motif Toolkit functionality.
File Name | Description |
---|---|
xmdialogs.c | dialog sampler |
xmfonts.c | font browser |
xmeditor.c | text editor |
xmlist.c | list example |
xmprotocol.c | window manager protocols example |
xmter.c | shape & animation example |
xmform.c | form attachment example |
xmforc.c | form attachment + rowcolumn example |
xmmap.c | drawingarea + scrolledwindow example |
xmgetres.c | resource fetching example |
xmapdef.c | app defined scrolled window example |
The following notes apply to these sample programs:
$ xmform :== $DECW$EXAMPLES:xmform $ xmform string |
$ xmgetres :== $DECW$EXAMPLES:xmgetres $ xmgetres WidgetClass |
Many of the example programs have associated resource files for defining various display attributes. To use these files, either copy them from the directory DECW$EXAMPLES to your DECW$USER_DEFAULTS directory, or add their contents to your DECW$XDEFAULTS.DAT file.
The list of example programs and the resource files associated with them is as follows:
Example Program | Resource File |
---|---|
DECW$CDPLAYER.EXE | DECW$CDPLAYER.DAT |
FILEVIEW.EXE | FILEVIEW.DAT |
PERIODIC.EXE | PERIODIC.DAT |
MOTIFANM.EXE | MOTIFANIM.DAT |
XMAPDEF.EXE | XMDEMOS.DAT |
XMDIALOGS.EXE | XMDEMOS.DAT |
XMEDITOR.EXE | XMDEMOS.DAT |
XMFONTS.EXE | XMDEMOS.DAT |
XMFORC.EXE | XMDEMOS.DAT |
XMFORM.EXE | XMDEMOS.DAT |
XMGETRES.EXE | XMDEMOS.DAT |
XMLIST.EXE | XMDEMOS.DAT |
XMMAP.EXE | XMDEMOS.DAT |
XMPROTOCOL.EXE | XMDEMOS.DAT |
XMTER.EXE | XMDEMOS.DAT |
XMTRAVEL.EXE | XMTRAVEL.DAT |
If a resource file is not found, the example programs run, but some of the display attributes may be incorrect.
Index | Contents |