<- previous    index    next ->

Lecture 5, Menu Design and Implementation

The "Menu Bar" and drop down menus are the most common today.

You could do your own menus, yet you will probably want to use
the large amount of code provided by a GUI tool kit.

The richest toolkit for menus is Motif. (Linux/Unix/macOS)
Close behind is proprietary Microsoft Windows C++ classes.
Next comes Java Swing/Swing2.
The weakest we will look at is OpenGL GLUT.

Defacto standardization makes some design issues obvious.
The "File" is on the left of the "Menu Bar".
The "Help" is on the right, or rightmost, of the "Menu Bar".

Using defacto standard names helps average users.
Using names that mean something to you are best for an application
you write for your own use.

Example programs to be covered are:

In X Windows using Motif
w4a.c





In OpenGL
w4gl.c

Not able to capture open menu.

robot2.c could use sub menus


In Java using Swing
W4frame.java



For the more complex example, Spline Tutorial, download and
compiler: (note package myjava; and import myjava.*; fix to suit)

Spline.java
SplineFrame.java

Then you need the *.txt files that are read at execution time:
SplineHelp.txt
SplineAbout.txt
SplineAlgorithm.txt
SplineEvaluate.txt
SplineIntegrate.txt




Clicking on menu bar 'Algorithm' (no 'File' items needed)



Clicking on menu bar 'Help' (Note that pull down menu can go outside
                             the main window in Java.)



Basically go through code.
Explain how menubar is created.
Explain how menus are created.
Explain how menu items are created
Explain how callbacks are coded to act when a menu item is selected.
Show where to put code that responds to a menu item select.
   Can be in-line code if short and simple.
   Use function call to handle long or complex actions.

    <- previous    index    next ->

Other links

Go to top