[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP DECwindows Motif
for HP OpenVMS Alpha
Release Notes


Previous Contents Index

B.4.12 Xmpiano Example Program

V1.2

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:

  • Add Voice
    Connects another display to a new staff. After selecting this command, you are prompted for the display to connect. Any music written in the new staff plays to this display. Note that pressing the right mouse button on the new staff shows the name of the display in the menu title. In addition, the menu commands in the menu bar relate to the staff that is being displayed.
  • Remove Voice
    Removes the staff as well as the connection to the corresponding display. There is no undo for this command---all music written in this staff is deleted.
  • Clear Voice
    Erases all notes on the staff. This does not affect the display connection.
  • Play Voice
    Plays the voice of the staff in which the right mouse was pressed. If the voice is the same as the local host, the keys on the keyboard that correspond to the notes appear as though they are being pressed as the notes are played. It is possible to make the keyboard play along with all voices at the same time; however, the code must be compiled with the -DCHORDS option. Note that this can slow down the application significantly on many servers.
  • Play All
    Plays all voices at the same time on each of the specified displays.
  • Save Voice
    Saves the corresponding voice to a file. A FileSelectionDialog is displayed to prompt for the name of the file in which to save the voice. The display connection information is not saved.
  • Load Voice
    Loads (appends) a previously saved voice to the corresponding staff.
  • Quit
    Exits the example program.

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

B.4.13 Motif Sample Programs

V1.2

Table B-6 lists sample programs showing various Motif Toolkit functionality.

Table B-6 Motif Sample Programs
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:

  1. The xmfonts program defaults to displaying the fonts whose name length are less than 10 characters. On some systems, the font path contains only long XLFD font names. It may be necessary either to set the resource XMFONTS*maxLen to a larger number (80), or to specify a numColumns resource of 1.
  2. If you run the program xmter with a window manager other than Motif Window Manager, that window manager has to remove all the window decorations (for example, borders). The program xmter directs Motif Window Manager to remove the window decorations.
  3. The xmform program displays a string made of Motif widgets embedded in a Form. Use the following commands:


    $ xmform :== $DECW$EXAMPLES:xmform
    $ xmform string
    
    The variable string is optional. If string is supplied, the available letters for string are F,I,M,O,T. The string of letters that you use must be in uppercase and enclosed in quotation marks. If string is omitted, xmform returns "MOTIF".
  4. The xmgetres program is an example of how to use XmGetSecondaryResourceData. Use the following commands to invoke xmgetres:


    $ xmgetres :== $DECW$EXAMPLES:xmgetres
    $ xmgetres WidgetClass
    
    The variable WidgetClass is optional. If WidgetClass is omitted, it defaults to a class named "Widget". You can also use the class "All", which displays the resources for all the Xt and the Motif widgets. See the OSF/Motif Programmer's Reference manual for a list of available widget classes.

B.4.14 Xmtravel Example Program

V1.2

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.4.15 Resource Files for Example Programs

V1.2

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.

B.4.16 UID Files for Example Programs

V1.2

The UID files used by the example programs must be located in either the current directory or your DECW$USER_DEFAULTS directory. If they are not found, the application fails to start. The UID files can be copied from the DECW$EXAMPLES directory.

B.5 OSF/Motif List of Known Problems

Included in the DECwindows Motif software is an OSF file that contains the OSF/Motif known problems. During the installation this file is copied from the kit to SYS$HELP:DECW$MOTIF_OSF_BUGLIST_V12.TXT.


Index Contents