You can use the Page Editor to build HTML pages. There are many options for adding components, as well as text, images, links, and other HTML tags to a page, and for formatting and modifying the page. See "Editing Pages."
A number of components are provided with the default distribution of Visual JavaScript, and more can be added or imported. To help you understand and choose components, the built-in components are described briefly in "Overview of Built-in Components", and in more detail in Part 2, "Component Library Reference."
When you have added components to a page, you can customize them using the Inspector, or, in some cases, custom component editors. See "Editing Components." You can also use the Inspector to examine and change the properties of non-component objects such as projects and pages. See "Inspecting Other Objects."
Adding Pages and Files to a Project
There are several ways to add pages to a project. You can create blank pages or new pages based on templates and specify their contents by editing them, you can use the Database Application Wizard to generate database-access pages automatically, or you can reuse or modify existing pages by importing them into your project.
.class
files .Log
files,.jsb
files, and other file types.js
files
.gif
or .jpeg
) that can either be loaded from an absolute URL or added to and deployed with the project. To add an image file to a project, import it as you would an HTML page. For more information on importing files and pages, see the next section, "Importing Page and Image Files."
Importing Page and Image Files
To import an HTML page, image file, or code file into a project, do any of the following:
Figure 4.1 The Import Files to Project dialog box
C:\MyHost\MyProjects\ProjectA\MyPage.htm
C:\MyHost\MyProjects\globals\picture.jpg
To import this page with its image, you must import from the point where the directory structure branches:
C:\MyHost\MyProjects\
This part of the directory structure defines the scope of the import. When you define a scope, the part of the directory structure below the scope is recreated in the project directory, in order to keep the same relative positions of related files.
Follow these steps to import files from further up the directory structure:
The directory structure below the specified point is recreated under the project directory. Only those related files that are found within the specified scope are imported, and these are imported to their proper positions relative to the primary file.
.jsb
source files directly from the Project window. Do one of the following:
Editing Pages
In general, you edit pages by dragging components to them from the Component Palette, then setting the properties of the components in the Inspector. You can also insert HTML tags and blocks into a page by choosing options from the Insert menu, or you can drag components or blocks of HTML from other pages.
Tip You can place form elements in an existing form by dropping them onto the form, which is highlighted in blue when the mouse cursor is properly positioned. However, if you drop a form element onto a blank area of a page, a form is automatically created to contain it. §You can position components on a page by dragging them to new positions. Some components are resizable, as indicated by resize handles around the edges when you select them. To resize a component, click a resize handle and drag it in the desired direction. Some components can only be resized vertically, or horizontally, or in particular increments. The Page Editor automatically resizes in a way that is appropriate to the component. You can type directly into the Page Editor to add text, then edit and format the text using the toolbar and Format menu. See "Editing Text in the Page Editor." In addition, you can add text into components such as buttons and tables, in various ways. See "Editing Text in Components" and "Editing HTML Tables."
You can add images and links by dragging Image and Link components from the Palette, then editing their properties to specify the reference, or you can drag pages or images to the Page Editor from the Project window. See "Adding Images and Links to Pages."
You can also use another WYSIWYG editor such as Composer to edit your pages, or edit the HTML source directly in a text editor such as Wordpad. See "Using an HTML Editor to Edit Pages."
Editing Text in the Page Editor
You can type text directly into the Page Editor. You can enter text anywhere outside of components, or into the cells of an HTML table. Press Enter (Return) outside any component to create a new line on the page. Press Shift Return to insert a hard line-break in a block of text.
Text that you enter directly into the Page Editor corresponds to blocks of text in the HTML version of the page. You can select a block of text in either the Layout view or Structure view. In the Layout view, you can edit the text directly. When you select a block of text in the Structure view and inspect it, the Inspector displays a multiline text editor in which you can modify the text. (See "Using Custom Component Editors.")
You can select any block of text in either the Layout or Structure view of the Page Editor, and use the Cut, Copy, and Paste commands from the Edit menu, the right-click context menu, or standard Windows keyboard shortcuts (Control-x, Control-c, and Control-v).
You can apply formatting styles to selected text from the style toolbar or the Format menu. Formatting styles include standard HTML heading levels, color, font size and style, bulleted and numbered lists, indentation, right or left justification, and centering.
Editing Text in Components
Text inside components generally corresponds to a property. You can edit the property in the Inspector to enter or change the text.
NOTE: TheName
orID
property is the identifier for the component object and does not correspond to any visible text in the component. §
Width
or Height
property to a percentage value, such as 50%.
In the Structure view you can see the HTML tags contained in a table. Rows correspond to the <TR>
tag, and cells to the <TD>
tag. Notice that columns do not correspond directly to an HTML tag. The Page Editor provides this abstraction for convenience. You can select the HTML tags in the Structure view and edit their properties in the Inspector. You can, for example, set the height or width of an individual cell or row in this way.
Source
property so that it refers to the URL of the image file. You can specify an absolute URL (that is, an address starting with http://
), or you can import the image file into the project and simply specify the file name.
If you have imported an image file into the project, you can drag the image icon from the Project window onto a page in the Page Editor. The image appears on the page; that is, an Image component is automatically added to the page with a reference to the image file. (See "Importing Page and Image Files" for more information.)
When you add a Link component to a page from the Component Palette, you must edit the Destination URL
property so that it refers to the URL of the page to which you are linking. The URL can be absolute, or it can be relative to the location of the current page (the project directory).
You can drag a page from the Pages list in the Project window onto a page in the Page Editor to create a link to it. A Link component is created and added to the page in the Page Editor, with a reference to the page from the Project window.
Using an HTML Editor to Edit Pages
In addition to the Visual JavaScript Page Editor, you can use an external HTML editor to edit your pages. You can choose to edit pages in any HTML editor; Netscape Composer is the default editor. Provided that you have first installed the latest version of Netscape Communicator 4.0 as indicated in the README.txt
file, you can access Composer's formatting capabilities.
Important If you are using Composer, you must use Communicator 4.0 (Composer module) to edit pages or data loss may result. §To edit a page's source in an HTML layout editor, do one of the following: If you make changes to a page using an HTML editor and then open the page in the Visual JavaScript Page Editor window (or return the focus to a window where the page is already open), you are prompted to reload the page. You can also choose to edit the source code for an HTML page directly in a text editor of your choice. To edit the source code for a page, do one of the following: To select different HTML editors in which to edit your HTML files directly, choose Preferences from the Edit menu and select the Editors tab. Set the HTML Layout Editor preference to select a WYSISWYG editor. Set the HTML Source Editor preference to select a text editor.
HTML Tab
The HTML tab contains components made of standard HTML tags or blocks, that are unrelated to forms.
Database Tab
The Database tab contains JavaScript and Java components that let you connect to specified databases and make use of the LiveWire database functionality. (See "Connecting to the Database.")
Other Tab
The Other tab contains Java and JavaScript components that are not specifically related to database access.
Test Tab
The Test tab contains sample components intended for testing or learning about database access pages. (See "Connecting to the Database.")
Choosing Client or Server Components
Some of the components that are included with Visual JavaScript are written in simple HTML code, and others are written in Java or JavaScript. Many components have behavior built into the component, making your task as an application developer easier--you can simply assemble these parts into the program you need. Instead of providing all of the behavior from scratch, you only need to tell the pieces how to talk to each other.
However, when a component includes behavior implemented in Java or JavaScript, that code must run either on the server or on the client. If it runs on the client, the end user must have a Java- or JavaScript-enabled browser.
To give you a full array of choices for your delivery environment, some of the included components provide similar functions but differ in how the functions are implemented. The description of each component in the reference section of this manual includes information about the language used by the component, and also specifies whether it runs on the server or the client. Some components (the JavaScript Client Cursor, for example) have code that runs on both sides.
If you cannot guarantee that the delivery environment will always have a browser with the proper language enabled, choose server-side or HTML components to build your application. If you know that your clients will be using a particular browser, you can take advantage of the additional features that come with client-side Java and JavaScript components.
Editing Components
When you have chosen components and placed them on a page, you can customize their appearance further by editing their properties in the Inspector. For most properties that control the visual appearance, you can simply type in a value or choose from a list of possible values.
Selection components, such as the HTML Scrolling List, are associated with Option objects, which specify the selections in the list. See "Configuring Selection Components" for more information.
You can create a style by setting the visual properties of a component to default values, so that every time you add that component to a page, its visual features are the same. You do this by editing the component in the Component Palette, rather than an instance on a page. See "Creating Default Values for Components" for more information.
Some components that have a complex presentation come with custom editors that are tailored to their special editing needs. When a component has a custom editor, it appears automatically when you inspect the component. See "Using Custom Component Editors" for more information.
In addition to customizing the visual appearance of components, you can specify the behavior of your application by connecting components to one another in various ways, connecting user events to methods or code, and specifying JavaScript and SQL code as property values. For more information, see Chapter 5, "Adding Behavior to an Application."
You can also connect data-display components to data from a database, either directly or through a database cursor. For more information, see Chapter 6, "Developing Database Applications."
Configuring Selection Components
Selection list components that correspond to the <SELECT>
HTML tag include two JavaScript components, JavaScript Select Box and Database Select Box, and two versions of a simple HTML component: Drop-down List and Scrolling List.
For any select box, you must specify the list of options to be displayed. Each option has both a display string, which is shown in the selection list, and a value, which is submitted for the selected option when the containing form is submitted. (See "Connecting Forms" for more information on submitting forms.)
Text Options
property, with semicolons between each display string. For example, type the following in the Inspector:
Cat; Dog; FishThese strings are displayed in the list box. When the form containing the component is submitted, the value of the selected option is submitted with it. To specify the value of each option, set the value of the
Value Options
property to a list of values, separated by semicolons. For example:
1; 2; 3This sets the value of
Cat
to 1, of Dog
to 2, and of Fish
to 3. If the user selects Cat
and submits the form, a value of 1 is passed for the select element.
This server-side component is connected directly to a database, and the selection options are generated automatically from the downloaded data. Set the DBPool
property to establish a database connection. A query is automatically generated from the Table
and Filter Column
property values, and each row of the result set is displayed as a selection option.
This component is used by the Database Application Wizard to display master-detail relationships. See "Master-Detail Applications" for more information.
Name
property.
To specify the character code used by a page, set the value of the Content Type
property. To view a page that uses a character code other than the default, you must set an application preference. See "Palette and Application Preferences" for more information.
Select a data source in the Data Source folder of the Project window. The data source object is displayed in the Inspector. The read-only properties of the data source show information about the source database. You can edit the values of the Design Time User Name
and Design Time Password
properties. The system uses these values at login, unless you select Prompt for Password Every Time? in the Create Data Source dialog box. See "Identifying Data Sources" for more information.
You can expand a data source to see its tables (or data views), and expand a table to see its columns. Select a column to display it in the Inspector and see its data type.
You can select a specific HTML tag in the Structure view of the Page Editor and display it in the Inspector. The properties of HTML tags are listed and described in detail in HTML documentationLast Updated: 11/06/97 13:24:50