| Type | Title | Author |
|---|---|---|
| Forum topic | WebEx Connect Integration Availability | kreester |
| Notebook entry | Day One Dream Factory | chuckbrady |
| Notebook entry | how to animate a sprite | butcher |
&ot
DreamFactory is both an IDE and a runtime engine for rich internet applications.
Let's look at some of the basic facts about DreamFactory
Salesforce.com has a robust and well-supported service architecture - the AppExchange API. The following pages will walk you through everything you need to know to build a DreamFactory application that leverages the Salesforce API.
DreamFactory consists of a software engine and various project files. The engine is either an ActiveX control, a Netscape Plug-in or a stand-alone executable.
The stand-alone version of the DreamFactory and the browser plug-ins are available from:
http://www.dreamfactory.org/download/
Download and run the DreamFactory Professional installation program. The stand-alone IDE will be installed, along with a desktop shortcut and a Start > Programs > DreamFactory menu item.
After installation, the DreamFactory installation folder will contain help files, default scripts, plug-ins, a download folder, and some other text files. The DreamFactory document type uses the extension .dfac and the registered MIME type application/dreamfactory.
Browser based authors will not see the menu bar pictured at the top of the screen below. Instead, the system menus are available as a pop-up from the Message Box, Debugger, or Script Editing Windows in the Menu button to the right of the information bar. Other than that, the standalone and browser-based IDE are identical.
The Utility Palette contains all the key buttons that contol what Palettes you see on your screen. The Utility Palette at right provides access to many useful functions with a tool bar. Expand the window by clicking in the zoom box to see more controls.
Let's look at the available controls on the Utility Palette:
| Icon | Function |
![]() |
Click this button to open an existing DreamFactory project. |
![]() |
Click this button to close an existing DreamFactory project. |
![]() |
Click this button to save your existing DreamFactory project. |
![]() |
Click this button to zip up a copy of your DreamFactory project and deploy it on the Internet. |
![]() |
Click this button to close all projects and quit DreamFactory. |
![]() |
Click this button to run the current project. Click this button twice to resume editing of the project. |
![]() |
Click this button to launch the degugger on your current project. |
![]() |
Click this button to open the Message Box and run new scripts. |
![]() |
Click this button to show/hide the Tools Palette. |
![]() |
Click this button to show/hide the Project Manager Palette. |
![]() |
Click this button to show/hide the Alignment Palette. |
![]() |
Click this button to check for updates to the libraries, palletes, and dialogs in DreamFactory. |
The Tools Palette launches every time you open a project.

Click the main Tools icon at the top of the Tools Palette (upper left) to cycle through the various node types available in DreamFactory. You can choose from
|
• Draw • Window • List • Tabl • Menu • Gauge |
• Button • Border • Rich Text • Slider • Chart • Misc |
Note: Click the Maximize button to expand the Tools Palette to show all available node types.
Figure 1 above shows the Draw nodes that are available in DreamFactory. Let's look at how to get started on a project and some of the key functions you can use on the Tools Palette.
The Alignment Palette allows you to align or nudge currently selected objects. Use the Tools Palette Reshaper Tool to select nodes to align. Ctrl-click to select multiple nodes.
Right-click on any DreamFactory node on your main screen and you will see a pop-up menu with a list of available options, with a Properties option at the bottom of the menu. The first menu items will always be:
| Menu Item | Function |
| Help | Click this button to open the help system for that node |
| Name | Click this button to give the node a name |
| Script | Click this button to view or edit the node script |
| Resize | Click this button to activate the handles on the node and to drag or resize the node. Press Ctrl + click to select or deselet multiple nodes. Use the Alignment Palette to move nodes around. |
| Target | Click this button to direct the Message Box to call commands and functions on the selected nodes. |
| Comment | Click this button to create a comment for this particular node. |
The next set of available menu options are: Cut, Copy, Paste, Delete, and Duplicate. These are self explanatory, but be aware that these operations apply to the node and all of its children.
At the bottom of most pop-up menus you should see the Properties Dialog, for example, "Slider Properties." You can also access this by double-clicking most nodes.
The Properties Dialog lets you explore the various capabilities of a node. Figure 3 below shows the property dialog for aSlider.

There are some important DreamFactory system windows that are used to help author and build your projects:

The Debugger is accessible at any time. The Debugger can set breakpoints and step through scripts as they execute. The Debugger also tracks the values of local, global, and regional variables. It will display the hierarchical overview of your project in Outline Form. When the Debugger is active, all script execution stops, but you can still edit scripts and use the Message Box. Simply click the Run button to continue execution, or Step to watch the current script run. Scan your mouse over the various buttons on the Debugger Window and they will document themselves.
The Message Box allows instant execution and exploration of the DreamFactory language.
Right-click any node and select the Target pop-up menu command. The Message Box will then send typed messages to that node, so you can call handlers from the hierarchy, reference variables, etc.
The Message Box is a good place to create or change node properties manually or test the scripting language. Press Ctrl + scan with the mouse to identify visible nodes by name.
The Help System documents all system and plug-in commands. The system commands arranged in logical groups with common prefixes. The Help Window is always available and is context sensitive. It is intended as a general DreamFactory reference.
The Background Desktop is the main window that stores the project and all its nodes. This window is where all project editing takes place. Be aware that objects in the Background Desktop are all part of your project, even if they look like windows, menus, or other system windows. The Debugger, Message Box, and Script Editing Windows float on top of the Background Desktop.
The Script Editing windows provide powerful editing features and allow you to work on multiple DreamFactory scripts at once. When you are editing a script, press Ctrl + scan with the mouse to see any language element documented and explained in the information bar at the top of the window.
Click Ctrl + F to open up the Find Dialog (Command-F on the Mac) to search and replace the current script, the current hierarchy, or all scripts in the current project.
Click to the left of the script in the dotted rectangle to set or clear break points; when the script runs this point it will trigger the Debugger Window.
The Menu button to the right of the information bar in the Message Box provides access to DreamFactory system menus.
All DreamFactory functionality is provided by what we call plug-ins. Some plug-ins are standardand are available at all times.
The standard plug-ins are:
|
• Chart • Button • Draw • Icon • Menu • Picture • Sprite • Table • Window |
• Border • Desktop • Gauge • List • Movie • Sound • Slider • Text • XML |
Plug-ins can also be non-graphic, such as the Outlook plug-in that provides desktop integration with Microsoft Outlook. New plug-ins can be developed when needed. They become first-class entities that expose their own commands and functions. Plug-ins are version controlled and downloaded as necessary to support DreamFactory projects.
Each node has an associated plug-in and script. Most of the commands and functions exposed by a plug-in control the visual appearance of a node. Often a script will use these commands or functions to manage the appearance and behavior of a node. While the details of each node can be controlled by the associated plug-in commands and functions, there are also system commands and functions used for controlling the characteristics of all nodes in general. For example, the system command nodevisibleset("mynode", false) will hide any node regardless of the associated plug-in.
In this tutorial you will create the simplest DreamFactory application. It will consist of a dialog with a button. When you press the button, a "Hello World!" popup dialog will appear.

You can see that all the button has been relabelled OK.
The final part of this tutorial will show you how to add code to a button. Let's continue with our example.
mycontent function to look like:
code mycontent(hor, ver)
dialogshow("Hello Title", "Hello World!")
endcode

Note: There is no need to save the overall project in the IDE because it is continuously saved. There is also a limited undo. i.e., be careful about your changes. Changes are not easy to undo.
In the case of a button, mycontent() will be called when the button is pressed. Each node has a mycontent() function - initially empty - that is called when that node is activated. Here are some examples of actions that will trigger a node's mycontent() handler:
| Handler | Action |
| List | A list item was seleted |
| Text | A mouse was clicked/released in the text field |
| Table | A cell was selected |
| Menu | A menu item was selected |
Sometimes, things go wrong. In this tutorial, you'll learn about the debugger built into the DreamFactory IDE and how it can help you with errors.

Wait - before you dismiss the dialog, note the following choices you have:
Now, before we forget, fix your scripting error by reinserting the comma and saving the script.
This tutorial will cover all you need to know about window/dialog manipulation. Instead of using a system function to pop up a dialog box, we're going to create our own window and pop it up and down ourselves. We're also going to add list and text nodes to our original window. Then we will make our window and all of its children resize smoothly.
There are a lot of steps to this tutorial, so we have broken it down into smaller stages.
The first part of this tutorial involves creating a second dialog window. For information on how to create a dialog window, see Tutorial 1 - Hello World.

Now let's make our new dialog pop up and down.
code mycontent(hor, ver)
nodevisibleset("mypopup", true)
nodebringtofront("mypopup")
endcode
This will make your new "My Popup" dialog appear, and it will bring it to the fore ensuring that it isn't obscured by any other windows.
code mycontent(hor, ver)
nodevisibleset("mypopup", false)
endcode
This, in turn, will hide your My Popup dialog.

When you click the Dismiss button in your My Popup dialog window, the pop-up window will close.

If you look closely at the node hierarchy in the Project Manager palette, you'll see that both window:mypopup and button:dismiss are blue in the node hierarchy.

This indicates that these nodes are not visible. Right-click on window:mypopup and select Show Node. This will make your popup dialog visible once again.
Now we're going to add three children to My Popup:

If you look in the Project Manager palette, you'll see that you actually created two nodes: a border and a list. The border provides the scrolling, and the list will actually contain whatever items you populate it with.
Note: You can do this either through its Properties dialog or by right-clicking on the node and selecting Enter Text.
You're My Popup dialog should now look like this:
One of the other handlers (functions) that is very useful is nodemove(). When a node is moved or resized, nodemove() is called (makes sense, doesn't it?) The most common use of nodemove() is for a parent (a dialog or window) to reposition its children based on its size.
For this part of the tutorial, we're going to do something simple. We're going to keep the Dismiss button at the bottom right of the My Popup window no matter how we resize the window.
First, let's make My Popup resizeable.
If you resize now, you'll see that all of the children of My Popup, including the Dismiss button, stay exactly where they are, regardless of the size of the window.
What we want, though, is for the Dismiss button to remain anchored to the bottom right corner of the window.
code nodemove()
local mybounds, mybutton, button_bounds, width, height
// Find my child button
mybutton = nodefindchild(me, "dismiss")
// Get the bounds of the window and the button
mybounds = window.boundsget(me)
button_bounds = button.boundsget(mybutton)
width = button_bounds.width
height = button_bounds.height
// Anchor the button 20 pixels up and to the left
// of the lower right corner of the window
button_bounds.right = mybounds.width - 20
button_bounds.bottom = mybounds.height - 20
button_bounds.left = button_bounds.right - width
button_bounds.top = button_bounds.bottom - height
// Set the button's bounds accordingly
button.boundsset(mybutton, button_bounds)
endcode
In 2006, Amazon released Simple Storage Service (S3) as part of hits web-services suite. Amazon S3 provides unlimited storage through a simple web services interface. Data can easily be stored and retrieved at any time, from anywhere on the web.
DreamFactory has developed an S3 Integration Panel that allows developers to take advantage of the S3 web service allowing the developer to easily store and retrieve data with a backend that is scalable, reliable, fast and inexpensive.
The panel was designed to include 100% of the features offered by S3. As Amazon S3 was intentionally built with a minimal feature set, this will be reflected in the features provided by the adapter. (For instance, no rename or move functions). Such additional functionality, if so desired, should be included in the application layer.
Key S3 links
To set up an S3 account, follow these steps:
The S3 adapter is designed similarly to the Salesforce Integration Panel in that it is both a developer aid and a runtime abstraction layer that simplifies the integration process. One key difference is that the library is included in the UI so importing a corresponding library is not required.
All API calls are included in the main window:s3 node script.
Every object stored in Amazon S3 is contained within a bucket. Buckets partition the namespace of objects stored in Amazon S3 at the top level. For more information, see the Amazon Web Services site.
Let's try out the adapter by creating a new bucket via the UI.

Bucket names must be globaly unique and each account is allotted only 100 buckets. As such, it is unlikely that you will create buckets programmatically using the library.
Now that we know the basics and we have created our bucket, we want to actually create an application. In our example we are going to create a Poem Bank © - a place that stores poems. We want to create an application that will use our S3 panel to store, read, and delete poems. We want to create an application with a scrolling listbox, a scrolling textbox, and 3 buttons (Save, Read, Delete).
The first thing we want to do in this example is to create a new project ensure that we have all the necessary objects on our IDE Desktop.
Your dialog box should now look like this:

Now we want to rename all the nodes on our screen.







First things first, lets create some convience functions that will return the access key, secret key, and bucket name that we have just created. All S3 functions will require an access key and secret key.
code getAccessKey()
return "7XZWTVSXQ511FKNTFYG2"
endcode
code getSecretKey()
return "jEBx7dZl7CcEizCLGg7CIq0sVk06dUbqORda1WTm"
endcode
code getBucket()
return "uniqueBucket"
endcode
code mycontent(hor, ver)
global titleCount
local s3Node, textNode, listNode
local title, poemPath, poemData
s3Node = nodelongnameget("window:s3")
textNode = nodelongnameget("poemText")
listNode = nodelongnameget("poemList")
// Get a poem title from the user.
title = dialogtext("Poem Title", "Poem Title", "")
if title = empty
exitcode
endif
// Get the poem text file from the user.
poemData = dialogopenfile("Please select a poem.", "textfiles", false)
if poemData = ""
exitcode
else
poemData = xml.binaryread(poemData)
endif
s3Node.putObject(getAccessKey(), getSecretKey(), getBucket(), title, poemData, empty, empty,
empty, empty, empty, empty, empty)
//listNode.fillList()
endcode
code savePoem(titleKey)
local poem, s3Node
s3Node = nodelongnameget("window:s3")
poem = me.data
if poem = empty
exitcode
endif
s3Node.putObject(getAccessKey(), getSecretKey(), getBucket(), titleKey,
poem, empty, empty, empty, empty, empty, empty, empty)
endcode
If we hit the Save button now, our poem should be saved into the S3 account. Unfortunately, our list will not reflect this fact just yet, so let us now create an updateList function in the listbox.
code fillList()
local s3Node, list, poemNames
s3Node = nodelongnameget("window:s3")
// Clear listbox.
me.data = ""
// Make s3 call.
list = s3Node.listBucket(getAccessKey(), getSecretKey(), getBucket(),
empty, empty, empty)
// Populate listbox.
for i = 1 to list.length
list.insertitem(me, 0)
list.itemnameset(me, 1, list[i].Key)
endfor
endcode
Note: The return value of the listBucket() function is in XML. Since any XML envelope is automatically a structure addressable as an object or array in DreamFactory, we can simple refer to the xml elements using the dot-notation (list[i].Key).
Now that we have written the fillList() function, we should call on it everytime we update our s3 account.
code readPoem()
local s3Node, textNode
local poemData, poemKey
poemKey = me.list.selectname
s3Node = nodelongnameget("window:s3")
textNode = nodelongnameget("poemText")
// Read poem from S3 and put it in the text widget.
poemData = s3Node.getObject(getAccessKey(), getSecretKey(), getBucket(),
poemKey, empty, empty, empty, empty, empty)
textNode.data = poemData
endcode
code deletePoem()
local s3Node, textNode
local poemKey
poemKey = me.list.selectname
s3Node = nodelongnameget("window:s3")
s3Node.deleteObject(getAccessKey(), getSecretKey(), getBucket(), poemKey)
fillList()
endcode
Lastly, call these functions from the Read button and Delete button respectively.
code mycontent(hor, ver)
local listNode = nodelongnameget("poemList")
listNode.readPoem()
endcode
code mycontent(hor, ver)
local listNode = nodelongnameget("poemList")
listNode.deletePoem()
endcode