DHARMI Tutorial

Back to DHARMI Homepage

A Note on Drag and Drop

Drag and drop in DHARMI is not the same as it is for many GUIs. In order to grab something, click on it once. The cursor will change. Move the cursor to where it should go and click again to drop it. Do not hold down the cursor, as that will not grab an object.

Startup

Once DHARMI is activated, the habitat brings forth any molecules that existed when it was shut down. These molecules are immediatly ready for use. The habitat also summons the POF, or Primitive Object Frame. The POF contains atoms that are available for use.

Creating a moleucle

Creating a moleclue is easy. Double click on the molecule from the POF. This causes a moleucle to appear in edit mode. The molecule is empty here.

Modifying a molecue

Select edit mode from the View menu if the molecule is not in edit mode. The molecule area is divided into several areas. The first half is a panel containing the primitives that exist in the molecule. Double click on one to activate its properties panel. Ideally, these could be dragged over the panel, but this is not yet implemented. Click on one of these primitives and you will iniate a drag action. You can drag it to another molecule or to a recycling bin.

The second part of the molecule is a list containing the behaviors of that molecule. To modify a behavior, double click on the name of the behavior. To remove a behavior, highlight one and click the remove button.

The third part of the molecule is a command line. Currently, the only commands known are CLONE, QUIT, and RECYCLE. This list will not be expanded much in the java version, but will be quite something in the Guile or Perl implementations.

The last part of the molecule is an icon bar. The first icon on this bar represents the molecule itself. If you were to drag this icon onto another molecule, this molecule would be consumed by the other molecule. The next icon is a clone icon. Dragging this icon will cause an exact copy of this molecule to be dragged wherever. The next icon is a bin for adding atoms, behaviors and molecules to this molecule. Drop these in and they will appear on the first panel of this edit view. The last icon is a recycling bin. Dropping anything in there will cause it to be forever deleted. If the 'this' icon of this molecule is dropped here, it will vanish.

Behaviors

Modifying a behavior requires knowledge of java and a bit of specialized DHARMI knowledge. The behavior edit panel has two main areas. The left side shows what triggers the behavior has. The right side is what the behavior does.

Behaviors may be called from inside of other behaviors, or they may have triggers. Triggers are atoms present in this molecule. When the value of this atom changes, the molecule checks to see if it causes a behavior to activate. If it does, then the code on the right side activates.

The code on the right side is effectily a java method. The only thing different is that you can put ampersands around a word to make it an atom. For example:

@myatom@.getVal()         this returns the value of an atom as a double

@myatom@.getString()         this returns the value of an atom as a string

@myatom@.setValue( mything );         this sets the value of the atom to mything. this could be an integer or a string or even an object.

To activate the behavior, press the activate button. This compiles the behavior into the molecule and connects the @variables@ to their objects. If the compile fails, the behavior editor remains. Check the terminal output for any messages. If the compile is successfull, the behavior editor vanishes and the behaivor is in use.