Working with Frames and Framesets
In HTML, frames divide the browser window into several smaller windows that can simultaneously display independent pages. A frameset page defines the layout of these frames. In the HTML package, a frameset page can divide itself, either horizontally or vertically, into two separate frames. The relative sizing of these frames is set by the frame objects (HtmlT_Frame) that are put into the frameset object. Because a frameset page is a page, it can be viewed in a frame, and this allows you to "nest" several layers of frames and framesets. Frames can be nested as deep as desired; there is no predefined limit for the maximum depth in either HTML or the HTML package.
A typical use for frames is to have one frame be used for navigation, continually displaying a page of links, and another frame that displays the pages that are linked to by the page in the first frame. This is the situation in the final example in the HTML package sample source.
The procedure for creating frames and framesets is illustrated in the first and last examples in the sample source for the HTML package. The overall procedure is:
- Create the pages you want to appear in the frame with one of the
Html_Page_<>_Create()functions. - Create the frame that the pages will appear in by calling
Html_Frame_Page_Create(). - Create the pages that will appear in the second frame.
- Create the second frame.
- Create the frameset that will contain the frames and define their layout, with
Html_Frame_Frameset_Create(). - Put the frames in the frameset with
Html_Frameset_Frame_Add(). - Create a frameset page to contain the frameset, with
Html_Page_Frameset_Create().
Nesting frames and framesets is done by repeating the above procedure, using the page resulting from step 7) instead of creating a new page.
You can determine whether a frame is a page or a frameset with Html_Frame_Type_Get().
An example of this method is in the sample source for the HTML package. It is the first function in the code, called HTML_Package_Sample_Frames(). See Sample Program.