Code and Picture Examples for Lecture 13: Amulet's Input Models

SP_Ship_Mover =
   Am_Move_Grow_Interactor.Create("SP_Ship_Mover")
.Set (Am_START_WHEN, "LEFT_DOWN")
.Set (Am_START_WHERE_TEST, Am_Inter_In_Part);
ship_group.Add_Part(SP_Ship_Mover);
Am_Object feedback_circle = moving_circle.Create()
  .Set (Am_LINE_STYLE, Am_Dashed_Line)

.Set (Am_VISIBLE, false);

my_win.Add_Part (feedback_circle);

// The definition of the interactor

Am_Object objs_grower = Am_Move_Grow_Interactor.Create ()

.Set (Am_START_WHERE_TEST, Am_Inter_In_Part)

.Set (Am_GROWING, true) // grow instead of move

.Set (Am_FEEDBACK_OBJECT, feedback_circle);

objs_group.Add_Part (objs_grower);

Simple Example

Am_Object rect = Am_Rectangle.Create()

.Set(Am_LEFT, 40)

.Set(Am_TOP, 50)

.Set(Am_FILL_STYLE, Am_Red)

.Add_Part(Am_Move_Grow_Interactor.Create());

Standard Behavior

Choice Interactor

Am_Define_Style_Formula (line_from_selected) {

if ((bool)self.Get(Am_INTERIM_SELECTED))

return Am_Red;

else if ((bool)self.Get(Am_SELECTED))

return Am_Black;

else return Am_Blue;

}

Am_Object my_prototype = Am_Line.Create()

.Set(Am_LINE_STYLE, line_from_selected);

my_group = Am_Group.Create()

.Add_Part(Am_Choice_Interactor.Create()

.Set(Am_START_WHERE_TEST, Am_Inter_In_Part);

Debugging: Tracing

<><><><><> LEFT_DOWN x=180 y=289 time=3114329169

Enter GO for <grow_inter_in_handle_185>, state=0...

Checking start event against wanted = LEFT_DOWN * SUCCESS

Checking start where.. ~~SUCCESS=<Am_Rectangle_650>

Move_Grow starting over <Am_Rectangle_650> translated coordinates 169,268

Calculated attach point for non-line is Am_ATTACH_S

++Object <grow_inter_in_handle_185> setting Am_VISIBLE of <Sel_Rect_Feedback_197> to true

++Object <grow_inter_in_handle_185> setting obj=<Sel_Rect_Feedback_197> setting obj=<Sel_Rect_Feedback_197> LEFT=90 TOP=142 WIDTH=182 HEIGHT=148

<><><><><> LEFT_UP x=179 y=326 time=3114329838 drawonable=Amulet Test Selection Widget(0x4015b848)

Enter GO for <grow_inter_in_handle_185>, state=1...

Checking abort event against wanted = CONTROL_g * FAILED

Checking running where.. ~~SUCCESS=<window>

Checking stop event against wanted = ANY_MOUSE_UP * SUCCESS

Move_Grow stopping over <Am_Rectangle_650>

++Object <grow_inter_in_handle_185> setting Am_VISIBLE of <Sel_Rect_Feedback_197> to false

++Object <grow_inter_in_handle_185> setting obj=<Am_Rectangle_650> setting obj=<Am_Rectangle_650> LEFT=79 TOP=121 WIDTH=182 HEIGHT=185

Advanced Feature: Priorities

Doing something with results: Command Objects

Operation

Handling Undo

Scripting


Back to 05-830 main page