Reference

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_Formulas 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"

History