Thread Rating:
  • 378 Vote(s) - 2.7 Average
  • 1
  • 2
  • 3
  • 4
  • 5
User Interface Basics1:Linking to Content
06-15-2011, 03:48 PM, (This post was last modified: 06-20-2011, 04:26 PM by kino.)
#1
User Interface Basics1:Linking to Content
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.


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

Code:
{curl 6.0, 7.0 applet}
{applet {compiler-directives careful? = true}}

Just {link href={url "http://www.curl.com"}, click me}
to go to the Curl Web site.

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.

Code:
{curl 6.0, 7.0 applet}
{applet {compiler-directives careful? = true}}

{paragraph
Try
{link
href = {url "http://www.curl.com/"},
target= "_blank",
cursor = cursor-help,
tooltip = {Tooltip "Welcome to Curl's Home Page!"},
{text color = "orange", this fancy link}
}
also. Check out its tooltip and cursor.
}


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

Code:
Click me


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:
Code:
{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:

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

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

Code:
{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.)
Code:
{curl 6.0, 7.0 applet}
{applet {compiler-directives careful? = true}}


{CommandButton
label = "Select Me",
{on Action do
{browse-url {url "link-applet.curl#introduction"}, target = "_blank"}
}
}

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.



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





Attached Files
.jpg   Linking to Content1.JPG (Size: 15.68 KB / Downloads: 487)
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Serving Content3:Dynamically Generating Curl Content kino 0 5,005 06-15-2011, 05:19 PM
Last Post: kino
  User Interface Basics7:Stretching Graphical Objects kino 0 4,609 06-15-2011, 04:12 PM
Last Post: kino
  User Interface Basics6:Object Layout kino 0 4,334 06-15-2011, 04:08 PM
Last Post: kino
  User Interface Basics5:Swapping UI Content kino 0 3,367 06-15-2011, 04:03 PM
Last Post: kino
  User Interface Basics4:Populating Control List Data kino 0 3,577 06-15-2011, 03:58 PM
Last Post: kino
  User Interface Basics3:Creating Dialogs kino 0 3,230 06-15-2011, 03:55 PM
Last Post: kino
  User Interface Basics2:Adding Pop-ups kino 0 3,586 06-15-2011, 03:52 PM
Last Post: kino
Forum Jump:


Users browsing this thread:
1 Guest(s)