Whenever a user clicks on an image, mousetrap gets the order to call
statusmsg( variablename)
So: it will execute statusmsg( variablename)
, check for the current content of variablename
and display it in the status bar.
As you noticed and tried to:
You have to force the variable to be evaluated somehow before using it in the expression.
The issue:
storing the result in another variable (msg) leaves you with the same issue - just another variable name.
What you want to do:
For every image pre-evaluate the image name and trigger e.g.
statusmsg("samurai_jack.jpg")
In 90% of the cases, this pre-evaluation can be done via Eval(Eval Expr()).
For the remaining ones, use Eval(Substitute())
Expression Handling in JMP: Tipps and Trapdoors
Eval (Eval Expr( h=graphbox(
<<Add Image(
image( img ),
bounds( top( 90 ), Left( 10 ), Bottom( 10 ), Right( 90 ) )
),
mouse trap(
statusmsg( Expr(jpeg) )
)
)));