Create a subgraph


You create a subgraph by drawing base objects in the working area. Here you also have access to
connection points and annotations.

Mark that the graph is a subgraph by opening 'File/Graph attributes' and set 'Subgraph' to 1.

Attribute           Description
DynType         Type of dynamic. The instances will inherit this as their default dynamic.
Action         Type of action. The instances will inherit this as their default action.
Color1         The first color that the instances will inherit as default.
Color2         The second color that the instances will inherit as default.
Color3         The third color that the instances will inherit as default.
Color4         The fourth color that the instances will inherit as default.
AnimSequence        Type of animation when DynType is Animation.
NoConObstacle       Indicates that connections should ignore instances of this subgraph.
      Connections of type 'routed' normally avoids subgraph objects,
      though if NoConObstacle is set, connections can cross the object.
Slider         Indicates that the subgraph is a slider.
Subgraph         Should be 1 for a subgraph.
AnimationCount      Used for animations. States the number of cycles the animation
        stays at this page.
JavaName         When exported as a java bean, the subgraph will be exported as
        java class with this name.
Cycle         Default value for cycle, slow or fast, that instances
        will inherit as default.
x0         In (x0, y0) and (x1, y1) you can state the max size of a subgraph
        in the case where the subgraph has pages with different extension.
y0         See x0. Also used by some subgraphs with DynType Slider,
        Sliderbackground and FillLevel.
x1         See x0.
y1         See x0. Also used by some subgraphs with DynType SliderBackground
        and FillLevel.
InputFocusMark      How objects are marked when they have input focus.
RecursiveDynamic    Used for dynamic HostObject where objects in the subgraph
        have individual dynamics.
Dynamic         Not implemented.
Save the subgraph with 'File/SaveAs...'. Copy the .pwsg file that is created to $pwrp_exe.
The subgraph should now be visible under the Local/Subgraphs folder in the subgraph palette.

Its advisable to draw subgraphs close to origin in the working area, because when creating
a subgraph, the position of the mouse click corresponds to origin. Connection points should be
positioned on grid points, if rectangular connections are used to connect the instances. You
then avoid notches in the connections lines.

External och internal subgraphs

When you for the first time in a graph create an instance of a certain subgraph, this is loaded
from the .pwsg-file. As default it is internal, which means that the subgraph is saved together
with the graph, and the .pwsg-file is not needed any more, i.e. you don't need to concern
yourself with copying it to operator and process nodes. This will work, until you need to
change the subgraph. As long as the subgraph is internal, the changes will not come along.
To get in the changes, the subgraph has to be external. When the graph then is saved, the
subgraph will not be saved together with the graph, and when reading the graph next time, the
subgraph is loaded from the .pwsg-file. When the changed version is loaded, you can again reset
to internal.

To rearrange a subgraph from internal to external and vice versa, you activate
'Loaded Subgraphs' under 'File' in the menu. Here you get a list of all loaded subgraph and
can set them as external or internal.

Slider

A slider is a specific type of subgraph. A slider is moved horizontally or vertically between
two endpoints, and the position is transferred, after conversion, to an analog value in the
database.

With background
The easiest way to configure a slider, is to put a SliderBackground object behind the slider.
Then, the only thing you have to do, is to connect the slider to an analog signal.

Without background
If you absolutely don't want to have any background to the slider, you have to state the
direction, and minimum and maximum position for the movement. A horizontal slider is configured
in the following way (vertical configuration inside parentesis).

Position the slider on the lowest y (x) coordinate for the slider movement. Remember the origin
is positioned in the upper left corner.
Measure the minimum and maximum values for the movement of the slider, relative to the upper
(left) side of the slider by placing the cursor there. The position of the cursor is present in
the lower right corner of the window. Enter these values in the attributes MaxPosition and
MinPosition from the object editor for the object. State also the direction, Up indicates a
vertical slider with increasing value upwards, Right a horizontal slider with increasing value
to the right etc.

Attribute           Description
Attribute           Signal in the database of type Float32 or Int32 that is changed when the slider
          is dragged.
Access           Privileges required to change the value of the signal.
Direction           Only has to be stated if there is no SliderBackground object.
          Direction of the slider. Up implies a vertical slider with increasing
          value upwards, Right a horizontal slider with increasing value to the right.
MaxValue           Value of the signal that corresponds to the max position of the slider.
MinValue           Value of the signal that corresponds to the min position of the slider.
MaxPosition         Only has to be stated if there is no SliderBackground object.
          x or y coordinate for the max position of the slider (see above).
MinPosition         Only has to be stated if there is no SliderBackground object.
          x or y coordinate for the min position of the slider (see above).