Here is an example, taken mostly from
Help==>Scripting Index==>Data Table==>Make Row State Handler
If you run this code, and then click on one of the bars in he displayed graph, you will see that he row state handler is executed immediatly
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
f = Function( {a}, Print( a ) );
rs = dt << make row state handler( f );
Graph Builder(
Size( 533, 448 ),
Show Control Panel( 0 ),
Variables( X( :sex ), Y( :height ) ),
Elements( Bar( X, Y, Legend( 4 ) ) )
);
Jim