Libraries‎ > ‎Library‎ > ‎User input‎ > ‎

Observer button

BehaviourComposer: ignore everything before this.

Begin micro-behaviour:

Begin description:

Create a button with associated NetLogo 'observer' micro-behaviours.

End description

Observer Button

Begin NetLogo code:

substitute-text-area-for upper-left-corner-x 5  
substitute-text-area-for upper-left-corner-y 225
substitute-text-area-for lower-right-corner-x 107
substitute-text-area-for lower-right-corner-y 255
substitute-text-area-for button-label Run Behaviours
substitute-text-area-for keyboard-shortcut A
substitute-text-area-for repeat-forever false
  'upper-left-corner-x' 'upper-left-corner-y' ; upper left corner 
  'lower-right-corner-x' 'lower-right-corner-y' ; lower right corner
  'button-label' ; label (cannot contain single quotes)
  'list-of-micro-behaviours "Observer behaviours run by button" []' ; action
  'keyboard-shortcut' ; keyboard shortcut
  'repeat-forever' ; if true then this button will repeat its action forever

End NetLogo code


All the parameters can be changed by editing the text areas. If you don't want a keyboard shortcut then remove the last line of code. 

How this works

This creates a NetLogo button that runs micro-behaviours as the NetLogo observer.

Related micro-behaviours

Button differs from this behaviour in that it specifies which agents should run the behaviours while Observer button requires that its micro-behaviours be runnable in NetLogo's observer context.


Observer button was implemented by Ken Kahn on 21 February 2014.

BehaviourComposer: ignore everything after this.