📄 ch32.htm
字号:
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<UL>
<LI><A HREF="#Heading1">- 32 -</A>
<UL>
<LI><A HREF="#Heading2">ObjectBuilder</A>
<UL>
<LI><A HREF="#Heading3">What Is ObjectBuilder?</A>
<LI><A HREF="#Heading4">The OI Class Library</A>
<LI><A HREF="#Heading5">Installing ObjectBuilder</A>
<LI><A HREF="#Heading6">Starting ObjectBuilder</A>
<LI><A HREF="#Heading7">ObjectBuilders Main Window</A>
<UL>
<LI><A HREF="#Heading8">The File Menu</A>
<LI><A HREF="#Heading9">The Edit Menu</A>
<LI><A HREF="#Heading10">The View Menu</A>
<LI><A HREF="#Heading11">The Palette Menu</A>
<LI><A HREF="#Heading12">The Help Menu</A>
<LI><A HREF="#Heading13">The Builder Mode Option</A>
<LI><A HREF="#Heading14">The Menu Focus Option</A>
<LI><A HREF="#Heading15">The Model Option</A>
<LI><A HREF="#Heading16">The Message Area</A>
</UL>
<LI><A HREF="#Heading17">Manipulating Objects</A>
<UL>
<LI><A HREF="#Heading18">Parenting an Object</A>
<LI><A HREF="#Heading19">Creating an Object</A>
<LI><A HREF="#Heading20">Deleting an Object</A>
</UL>
<LI><A HREF="#Heading21">NOTE</A>
<UL>
<LI><A HREF="#Heading22">Moving an Object</A>
</UL>
<LI><A HREF="#Heading23">NOTE</A>
<UL>
<LI><A HREF="#Heading24">Resizing an Object</A>
<LI><A HREF="#Heading25">Copying an Object</A>
<LI><A HREF="#Heading26">Converting Objects</A>
</UL>
<LI><A HREF="#Heading27">How to Create an Application</A>
<UL>
<LI><A HREF="#Heading28">The Attribute Editor</A>
</UL>
<LI><A HREF="#Heading29">NOTE</A>
<UL>
<LI><A HREF="#Heading30">Generating Application Files</A>
<LI><A HREF="#Heading31">Writing Callbacks</A>
<LI><A HREF="#Heading32">Compiling and Testing the Application</A>
</UL>
<LI><A HREF="#Heading33">Summary</A>
</UL>
</UL>
</UL>
<P>
<HR SIZE="4">
<H2 ALIGN="CENTER"><A NAME="Heading1<FONT COLOR="#000077">- 32 -</FONT></H2>
<H2 ALIGN="CENTER"><A NAME="Heading2<FONT COLOR="#000077">ObjectBuilder</FONT></H2>
<P><I>by Rick McMullin</I></P>
<P>IN THIS CHAPTER</P>
<UL>
<LI>What Is ObjectBuilder?
<P>
<LI>The OI Class Library
<P>
<LI>Installing ObjectBuilder
<P>
<LI>Starting ObjectBuilder
<P>
<LI>ObjectBuilder's Main Window
<P>
<LI>Manipulating Objects
<P>
<LI>How to Create an Application
</UL>
<P><BR>
Over the past few years there has been a growing emphasis on application development
using visual programming. Visual programming is the name given to a way of creating
applications that allows the programmer to draw the user interface for the application
on the screen. Once the user interface has been defined, the tool being used generates
the code for all the user interface aspects of the application. Some of the best-known
such tools are Microsoft's Visual Basic and Visual C++, which are visual programming
environments for Microsoft Windows.</P>
<P>This chapter introduces a visual programming tool called ObjectBuilder and also
introduces the Object Interface (OI) library that it uses. In this chapter you learn
the following:
<UL>
<LI>What ObjectBuilder is
<P>
<LI>What the OI class library is
<P>
<LI>How to install ObjectBuilder
<P>
<LI>Starting ObjectBuilder
<P>
<LI>Using ObjectBuilder's menus
</UL>
<P>This chapter also discusses manipulating ObjectBuilder objects and creating applications
in ObjectBuilder.
<H3 ALIGN="CENTER"><A NAME="Heading3<FONT COLOR="#000077">What Is ObjectBuilder?</FONT></H3>
<P>ObjectBuilder is a visual programming tool that was developed by ParcPlace Systems.
It gives the programmer a simple way to create graphical user interfaces for X Window
applications. ObjectBuilder builds these interfaces from pre-defined objects that
are included in the Object Interface (OI) library. The OI library contains components
such as menus, buttons, windows, and dialog boxes.</P>
<P>The OI library is a collection of user interface classes. Each element of the
OI library is an instance of one of the classes contained in the library.
<H3 ALIGN="CENTER"><A NAME="Heading4<FONT COLOR="#000077">The OI Class Library</FONT></H3>
<P>The OI class library contains many different kinds of user interface objects.
These objects are organized into a class hierarchy in which the classes that are
lower on the hierarchy inherit the behavior of the classes that are higher in the
hierarchy. Table 32.1 lists most of the concrete classes that are in the OI class
library. This table gives you an idea of what the OI class library and the ObjectBuilder
application provide for you. <BR>
<CENTER>
<P><FONT SIZE="4"><B>Table 32.1.</B> OI class library concrete classes. </FONT>
<TABLE BORDER="0">
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><I>Class Name </I></TD>
<TD ALIGN="LEFT"><I>Description </I></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_app_window</TT> </TD>
<TD ALIGN="LEFT">The main window for an application. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_box</TT> </TD>
<TD ALIGN="LEFT">A box that can contain other objects. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_gauge</TT> </TD>
<TD ALIGN="LEFT">A horizontal progress indicator. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_static_text</TT> </TD>
<TD ALIGN="LEFT">A text object that does not change. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_menu_cell</TT> </TD>
<TD ALIGN="LEFT">An element of a menu. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_scroll_menu</TT> </TD>
<TD ALIGN="LEFT">A box with scrollbars that contains menu items. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_menu_box</TT> </TD>
<TD ALIGN="LEFT">A box that is used to contain menu items. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_dialog_box</TT> </TD>
<TD ALIGN="LEFT">A box that contains controls that are used to interact with the user. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_panned_box</TT> </TD>
<TD ALIGN="LEFT">A box that has separate, adjustable viewing panes. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_scroll_box</TT> </TD>
<TD ALIGN="LEFT">A box that has scrollbars attached to it. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_scroll_bar</TT> </TD>
<TD ALIGN="LEFT">A bar that can be moved up and down or left and right. It is usually attached to
a box to make the contents of the box scrollable. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_slider</TT> </TD>
<TD ALIGN="LEFT">A control that can be adjusted by moving it to the right or left. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_entry_field</TT> </TD>
<TD ALIGN="LEFT">A field that is used to collect user input. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_multi_text</TT> </TD>
<TD ALIGN="LEFT">A multiline text editor. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>OI_button_menu</TT> </TD>
<TD ALIGN="LEFT">A button that displays a menu when it is activated. </TD>
</TR>
</TABLE>
</CENTER>
<P>There are many other user interface classes that are provided by the OI class
library. Most of the classes that exist but are not listed in this table are specializations
or subclasses of these classes and therefore have similar functions.
<CENTER>
<H3><A NAME="Heading5<FONT COLOR="#000077">Installing ObjectBuilder</FONT></H3>
</CENTER>
<P>Although ObjectBuilder is on your Linux CD-ROM, the default install scripts do
not install it onto your system. The ObjectBuilder distribution can be found in the
<TT>devel</TT> directory on your Linux CD-ROM. To install ObjectBuilder on your system,
follow the steps for installing software distributions that are outlined in Chapter
3, "Installing Linux."
<CENTER>
<H3><A NAME="Heading6<FONT COLOR="#000077">Starting ObjectBuilder</FONT></H3>
</CENTER>
<P>To create an application using ObjectBuilder, you must first invoke ObjectBuilder.
To do this, enter the following command into an Xterm window:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">uib <options>
</FONT></PRE>
<P>One of the options that can be specified when starting ObjectBuilder is which
interaction model you want to use. Interaction models are the names given to the
different styles of user interface objects that ObjectBuilder supports. The default
is Motif, but if you want to use OPEN LOOK you would type the following command to
invoke ObjectBuilder:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">uib -openlook
</FONT></PRE>
<P>Depending on which interaction model you choose, the mouse buttons act differently.
Table 32.2 defines the mouse buttons under each interaction model. <BR>
<CENTER>
<P><FONT SIZE="4"><B>Table 32.2.</B> Mouse button definitions. </FONT>
<TABLE BORDER="1">
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><I>Button </I></TD>
<TD ALIGN="LEFT"><I>Name </I></TD>
<TD ALIGN="LEFT"><I>Purpose </I></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP">left </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Select </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Motif--selects objects and menus, operates scrollbars, and activates pull-down menus
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"> <P>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP"> <P>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">OPEN LOOK--selects objects and menus and operates </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"> <P>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP"> <P>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">scrollbars </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -