---
name: "Am_From_Object"
section: "3"
platform: "linux"
package: "open-amulet-dev"
version: "4.3.1-7.1"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/Am_From_Object"
---

# Am\_From\_Object(3)

constraints useful for positioning Amulet widgets

## NAME

Am\_From\_Object, Am\_Bottom\_Of\_Sibling, Am\_From\_Sibling, Am\_Rest\_Of\_Height\_Above, Am\_Right\_Of\_Sibling, Am\_From\_Owner, Am\_Same\_As, Am\_From\_Part - constraints useful for positioning Amulet widgets

## SYNOPSIS

**#include \<amulet.h\>**

**extern Am\_Formula Am\_From\_Object (Am\_Object *object*, Am\_Slot\_Key *key*);**

**extern Am\_Formula Am\_From\_Object (Am\_Object *object*, Am\_Slot\_Key *key*, int *offset*, float *multiplier* = 1.0);**

**extern Am\_Formula Am\_From\_Owner (Am\_Slot\_Key *key*);**

**extern Am\_Formula Am\_From\_Owner (Am\_Slot\_Key *key*, int *offset*, float *multiplier* = 1.0);**

**extern Am\_Formula Am\_From\_Part (Am\_Slot\_Key *part*, Am\_Slot\_Key *key*);**

**extern Am\_Formula Am\_From\_Part (Am\_Slot\_Key *part*, Am\_Slot\_Key *key*, int *offset*, float *multiplier* = 1.0);**

**extern Am\_Formula Am\_Same\_As (Am\_Slot\_Key *key*);**

**extern Am\_Formula Am\_Same\_As (Am\_Slot\_Key *key*, int *offset*, float *multiplier* = 1.0);**

**extern Am\_Formula Am\_From\_Sibling (Am\_Slot\_Key *sibling*, Am\_Slot\_Key *key*);**

**extern Am\_Formula Am\_From\_Sibling (Am\_Slot\_Key *sibling*, Am\_Slot\_Key *key*, int *offset*, float *multiplier* = 1.0);**

**extern Am\_Formula Am\_Bottom\_Of\_Sibling (Am\_Slot\_Key *sibling*, int *offset* = 0, float *multiplier* = 1.0);**

**extern Am\_Formula Am\_Right\_Of\_Sibling (Am\_Slot\_Key *sibling*, int *offset* = 0, float *multiplier* = 1.0);**

**extern Am\_Formula Am\_Rest\_Of\_Height\_Above (Am\_Slot\_Key *sibling*, int *offset* = 0);**

## DESCRIPTION

These are predefined **Am\_Formula**s that can be set in slots of an **Am\_Object**.  Each gets its value from some other slot.  If *offset* or *multiplier* are provided, then the value must be numeric.  If both are provided, then *multiplier* is applied first.

**Am\_From\_Object** gets its value from the slot with key *key* of *object*.

**Am\_From\_Owner** gets its value from slot with key *key* of the owner of this object.  If there is no offset or multiplier, then it is equivalent to

```
    return self.Get_Owner().Get(key);
```

**Am\_From\_Part** gets its value from the specified slot (*key*) in the specified part (*part*) of this object.  If there is no offset or multiplier, then it is equivalent to

```
    return self.Get_Object(part).Get(key);
```

**Am\_From\_Sibling** gets its value from the specified slot (*key*) in the specified sibling (*sibling*) of this object.  If there is no offset or multiplier, then it is equivalent to

```
    return self.Get_Sibling(sibling).Get(key);
```

**Am\_Same\_As** gets its value from the specified slot (*key*) in the same object.

**Am\_Bottom\_Of\_Sibling** gets its value from the bottom of the specified sibling. **Am\_Right\_Of\_Sibling** gets its value from the right side of the specified sibling. **Am\_Rest\_Of\_Height\_Above** returns the difference between top to offset above the sibling.

## EXAMPLES

The following code adds a text input widget whose top is 93 pixels up from the bottom of the owner, and whose width is 44 pixels less than the width of the owner:

```
  Am_Object file_dialog = Am_Window.Create("file_dialog")
    .Set(Am_FILL_STYLE, Am_Motif_Gray)
    .Set(Am_WIDTH, 456)
    .Set(Am_HEIGHT, 333)
    .Add_Part(txtSelection,
	      Am_Text_Input_Widget.Create("txtSelection")
	      .Set(Am_LEFT, 22)
	      .Set(Am_TOP, Am_From_Owner(Am_HEIGHT, -93))
	      .Set(Am_WIDTH, Am_From_Owner(Am_WIDTH, -44))
	      .Set(Am_HEIGHT, 26)
	      .Get_Object(Am_COMMAND)
	      .Set(Am_LABEL, "Selection")
	      .Get_Owner()
	      .Set(Am_FILL_STYLE, Am_Amulet_Purple)
	      )
```

## SEE ALSO

"OpenAmulet Reference Manual"
