/www/documentation/opendylan/dguide/dguid_33.htm
HTML | 206 lines | 192 code | 12 blank | 2 comment | 0 complexity | ba9d36d23500eb893dd140ab4463b174 MD5 | raw file
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
- <HTML>
- <!-- Generated by Harlequin WebMaker 3.0.2 ( 8-May-1997) -->
- <HEAD>
- <LINK REL=TOP HREF="dguide_1.htm">
- <LINK REL=UP HREF="dguid_28.htm">
- <LINK REL=PREV HREF="dguid_32.htm">
- <LINK REL=NEXT HREF="dguid_34.htm">
- <TITLE>4.3 Gluing the final design together</TITLE>
- <META NAME=GENERATOR CONTENT="Harlequin WebMaker 3.0.2 ( 8-May-1997)">
- </HEAD>
- <BODY BGCOLOR="#FEFEF2" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
-
- <DIV>
- <A NAME=HEADING33></A>
-
- <DIV>
- <P><A HREF="dguid_34.htm"><IMG ALIGN=BOTTOM SRC=next.gif ALT=Next BORDER=0></A> <A HREF="dguid_32.htm"><IMG ALIGN=BOTTOM SRC=prev.gif ALT=Previous BORDER=0></A> <A HREF="dguid_28.htm"><IMG ALIGN=BOTTOM SRC=up.gif ALT=Up BORDER=0></A> <A HREF="dguide_1.htm"><IMG ALIGN=BOTTOM SRC=top.gif ALT=Top BORDER=0></A> <A HREF="dguide_2.htm"><IMG ALIGN=BOTTOM SRC=content.gif ALT=Contents BORDER=0></A> <A HREF="dgui_110.htm"><IMG ALIGN=BOTTOM SRC=index.gif ALT=Index BORDER=0></A></P>
- <P>4 Adding Menus To The Application</P>
-
- </DIV>
- <A NAME=HEADING33-0></A>
- <A NAME=UID-menus-889892></A>
- <H1>4.3 <A NAME=MARKER-2-210></A><A NAME=MARKER-9-211></A>Gluing the final design together</H1>
- <P>You can now add the definitions of the menu bar, menus, and menu buttons, to the definition of the <CODE><task-frame></CODE> class, to give the code shown below. At this stage, the only thing missing from the final application are real callback functions. Callbacks are dealt with in <A HREF="dguid_34.htm#MARKER-9-245">Chapter 5, "Adding Callbacks to the Application"</A>.</P>
- <P>Note that the final definition of <CODE><task-frame></CODE> includes the definition of a slot: <CODE>frame-task-list</CODE>. This takes an instance of the class <CODE><task-list></CODE> as a value, the default value being an empty <CODE><task-list></CODE>. Although it has not been referred to so far, this class will be used as the basic data structure in which task lists are stored, and a more complete description of these data structures is given in <A HREF="dguid_35.htm#MARKER-9-247">Section 5.1 on page 42</A>. It transpires that defining the <CODE>frame-task-list</CODE> slot is essential for some of the file handling routines that are described in <A HREF="dguid_38.htm#MARKER-9-258">Section 5.3.1 on page 48</A>.</P>
- <PRE>
- <A NAME=MARKER-10-212></A>define frame <task-frame> (<simple-frame>)
- slot frame-task-list :: <task-list> = make(<task-list>);
-
- // definition of menu bar
- pane task-menu-bar (frame)
- make(<menu-bar>,
- children: vector(frame.file-menu,
- frame.edit-menu,
- frame.task-menu,
- frame.help-menu));
- <P></P>
- // definition of menus
- pane file-menu (frame)
- make(<menu>, label: "File",
- children: vector(frame.open-menu-button,
- frame.save-menu-button,
- frame.save-as-menu-button,
- frame.exit-menu-button));
- <P></P>
- pane edit-menu (frame)
- make(<menu>, label: "Edit",
- children: vector(frame.cut-menu-button,
- frame.copy-menu-button,
- frame.paste-menu-button));
- <P></P>
- pane task-menu (frame)
- make(<menu>, label: "Task",
- children: vector(frame.add-menu-button,
- frame.remove-menu-button));
- <P></P>
- pane help-menu (frame)
- make(<menu>, label: "Help",
- children: vector(frame.about-menu-button));
- <P></P>
- // definition of menu buttons
-
- // Commands in the File menu
- pane open-menu-button (frame)
- make(<menu-button>, label: "Open...",
- activate-callback: not-yet-implemented,
- accelerator: make-keyboard-gesture(#"o", #"control"),
- documentation: "Opens an existing file.");
- pane save-menu-button (frame)
- make(<menu-button>, label: "Save",
- activate-callback: not-yet-implemented,
- accelerator: make-keyboard-gesture(#"s", #"control"),
- documentation: "Saves the current file to disk.");
- pane save-as-menu-button (frame)
- make(<menu-button>, label: "Save As...",
- activate-callback: save-as-file,
- documentation:
- "Saves the current file with a new name.");
- pane exit-menu-button (frame)
- make(<menu-button>, label: "Exit",
- activate-callback: not-yet-implemented,
- accelerator: make-keyboard-gesture(#"f4", #"alt"),
- documentation: "Exits the application.");
- <P></P>
- //Commands in the Edit menu
- pane cut-menu-button (frame)
- make(<menu-button>, label: "Cut",
- activate-callback: not-yet-implemented,
- accelerator: make-keyboard-gesture(#"x", #"control"),
- documentation: "Cut the selection to the clipboard.");
- pane copy-menu-button (frame)
- make(<menu-button>, label: "Copy",
- activate-callback: not-yet-implemented,
- accelerator: make-keyboard-gesture(#"c", #"control"),
- documentation: "Copy the selection to the clipboard.");
- pane paste-menu-button (frame)
- make(<menu-button>, label: "Paste",
- activate-callback: not-yet-implemented,
- accelerator: make-keyboard-gesture(#"v", #"control"),
- documentation:
- "Paste the selection in the clipboard at the current position.");
- //Commands in the Task menu
- pane add-menu-button (frame)
- make(<menu-button>, label: "Add...",
- activate-callback: not-yet-implemented,
- accelerator: make-keyboard-gesture
- (#"a", #"control", #"shift"),
- documentation: "Add a new task.");
- pane remove-menu-button (frame)
- make(<menu-button>, label: "Remove",
- activate-callback: not-yet-implemented,
- accelerator: make-keyboard-gesture
- (#"d", #"control", #"shift"),
- documentation:
- "Remove the selected task from the list.");
- <P></P>
- //Commands in the Help menu
- pane about-menu-button (frame)
- make(<menu-button>, label: "About",
- activate-callback: not-yet-implemented,
- accelerator: make-keyboard-gesture(#"f1"),
- documentation:
- "Display information about the application.");
- <P></P>
- // definition of buttons
- pane add-button (frame)
- make(<push-button>, label: "Add task",
- activate-callback: not-yet-implemented);
- pane remove-button (frame)
- make(<push-button>, label: "Remove task",
- activate-callback: not-yet-implemented);
- pane open-button (frame)
- make(<push-button>, label: "Open file",
- activate-callback: not-yet-implemented);
- pane save-button (frame)
- make(<push-button>, label: "Save file",
- activate-callback: not-yet-implemented);
- <P></P>
- // definition of radio box
- pane priority-box (frame)
- make (<radio-box>,
- items: $priority-items,
- orientation: #"horizontal",
- label-key: first,
- value-key: second,
- value: #"medium",
- activate-callback: not-yet-implemented);
- <P></P>
- // definition of tool bar
- pane task-tool-bar (frame)
- make(<tool-bar>,
- child: horizontally ()
- frame.open-button;
- frame.save-button;
- frame.add-button;
- frame.remove-button
- end);
- <P></P>
- // definition of status bar
- pane task-status-bar (frame)
- make(<status-bar>, label: "Task Manager");
- <P></P>
- // definition of list
- pane task-list (frame)
- make (<list-box>, items: #(), lines: 15,
- activate-callback: not-yet-implemented);
- <P></P>
- // main layout
- pane task-layout (frame)
- vertically ()
- frame.task-list;
- frame.priority-box;
- end;
- <P></P>
- // activation of frame elements
- layout (frame) frame.task-layout;
- tool-bar (frame) frame.task-tool-bar;
- status-bar (frame) frame.task-status-bar;
- menu-bar (frame) frame.task-menu-bar;
- <P></P>
- // frame title
- keyword title: = "Task List Manager";
- end frame <task-frame>;
- <P></P>
- </PRE>
- <P></P>
- <A NAME=LINK-menus-lastpage></A><A NAME=LINK-callbacks-firstpage></A><!-- FM pgf ignored -->
-
- </DIV>
-
- <DIV>
-
- <DIV>
-
- <!-- TOC -->
-
- </DIV>
-
- <HR>
- <ADDRESS>Building Applications Using DUIM - 26 May 1999</ADDRESS>
- <P><A HREF="dguid_34.htm"><IMG ALIGN=BOTTOM SRC=next.gif ALT=Next BORDER=0></A> <A HREF="dguid_32.htm"><IMG ALIGN=BOTTOM SRC=prev.gif ALT=Previous BORDER=0></A> <A HREF="dguid_28.htm"><IMG ALIGN=BOTTOM SRC=up.gif ALT=Up BORDER=0></A> <A HREF="dguide_1.htm"><IMG ALIGN=BOTTOM SRC=top.gif ALT=Top BORDER=0></A> <A HREF="dguide_2.htm"><IMG ALIGN=BOTTOM SRC=content.gif ALT=Contents BORDER=0></A> <A HREF="dgui_110.htm"><IMG ALIGN=BOTTOM SRC=index.gif ALT=Index BORDER=0></A></P>
-
- </DIV>
- </BODY>
- </HTML>