Linking to Content

VERSION 3 Published

Created on:Oct 23, 2007 10:14 AM by CurlEducation - Last Modified:  Oct 28, 2007 5:50 PM by CurlEducation

It's common to link to other information sources from a Curl applet. Once a user selects the link, the selected page can be displayed in the current browser window, a new empty window, or a predefined window. The displayed information can be Curl content that results from launching another Curl applet, or content defined in any other format recognized by the browser, such as HTML.

Linking to Web Pages

Adding a hyperlink to a document is done using the link text procedure with the following keyword arguments.

Argument Value Description
href Url The URI of a resource to be loaded
target browser-name An identifier of the window where the resource should load.
Values include "_self" (default), "_blank", "_parent", and "_top".


The simplest case only specifies the href, in which case the destination of the link will display in the current browser window.


In the next example, we are adding the target="_blank" property. This will open the link in a new browser window. Other properties control the tooltip, cursor style, and color.


This implementation is similar to HTML, where you would have the following code:


<a id="my-link" href="http://www.curl.com" target="_blank">Click me</a>


Linking to Curl Content

A link to a Curl applet can include an anchor, or destination, specification introduced by a # character. In this case, when the user selects the link, the Curl applet will launch and it will be directed to a specific location in the file, so the selected applet is loaded in a browser and scrolled to a particular point in the applet.

The applet and the destination location are specified by:


 {url "link-applet.curl#introduction"}


The link-applet.curl file must designate that location as a destination, using the destination text format. In our case, we are adding the following line to the file:


 {destination name = "introduction", {bold color = "blue", Introduction to Curl}}


In our example, the code in the file would resemble the following:


{paragraph 
    font-size = 14pt,
    
    {destination name = "company", {bold  color = "blue", Curl Background}}
    
    Founded in 1998, Curl is headquartered in Cambridge, Massachusetts 
    and is a wholly owned subsidiary of Sumisho Computer Systems. Curl has 
    over 300 customers and 40 partners worldwide. 
    Curl develops and maintains the Curl Rich Internet Application (RIA) platform. 
    The foundational technologies underlying Curl emerged out of research conducted 
    at the Massachusetts Institute of Technology, and the company's first product was released in 2002. 
    
    Using Curl, developers can implement a new class of complex, business-critical, 
    Web-based applications that cannot easily be developed with other smart client technologies.
    
    Curl allows organizations with legacy client-server applications to 
    move to Web-based delivery, increasing reach and reducing cost.

    {destination name = "introduction", {bold  color = "blue", Introduction to Curl}}

    With the Curl Rich Internet Application Platform, organizations can easily migrate 
    critical client-server applications to the web without sacrificing highly-interactive complex functionality.
    Traditional Web-based Development

    Many companies have been left behind by the Web revolution and are still relying on legacy 
    client-server applications to run critical parts of their businesses. 
 }

Note that we can use the destination text procedure multiple times in the file, with each location specifying a different destination name.

Adding Links as Actions

The previous examples use the link text procedure, whose associated text is rendered in an underlined style similar to standard Web conventions for links. You can also create a button that when selected automatically goes to a specified Url. This next example shows how to do this using the browse-url procedure. (Note that the creation of a CommandButton is discussed in a subsequent Curl Cue.)


Tip: Note that link and browse-url each have two arguments: href and target. A link renders as text that is underlined for the user to click on, while browse-url is used as a function that can be called in any graphical object's event handler.

/wiki/samples/images/help.jpg For more information regarding links, please refer to the following section in the Curl Documentation:Curl Developer's Guide > Text Formatting > Special Text Formats > link and destination

Average User Rating
(0 ratings)




May 31, 2008 1:52 AM Click to view ramanakallil's profile ramanakallil says:

I am not able to see images in most of the pages