For Mouse box , the approach via
<<setClickEnable( 1 ),
<<setClick()
"fires" too often.
Adding a dead time feels extremely laggy.
Does the Mouse ox also "fire" when the button is released? Is there a special setting?
On the other hand: is there some function like IS CTRL() which returns the current status of the mouse buttons?
w = New Window( "Mouse Messages", // modified from scripting index setClick
Border Box( Left( 20 ), Right( 20 ), top( 20 ), bottom( 20 ),
MouseBox( /* <<<<<<<< handler for mouse events */
window:tb = Text Box( "click me!", <<setFontSize( 48 ), <<setwrap( 999 ) ), /* <<<<<< child box does not receive the mouse events */
<<setClickEnable( 1 ),
<<setClick( /* button-down, move, button-release handler */
// the Ticked event happens frequently, and makes it hard to see the Pressed event, so ignore it...
Function( {this, clickpt, event}, /*Is Alt Key(),Is Control Key(),Is Shift Key() should be captured on "Pressed" */
If( event != "Ticked",
window:tb << settext( event || Char( clickpt ) );
)
)
)
)
);
);
You might want to ignore Moved as well as Ticked.
MouseBox<<setClick example in the scripting index is one of the Three JSL Easter Eggs
w = New Window( "Mouse Messages", // modified from scripting index setClick
Border Box( Left( 20 ), Right( 20 ), top( 20 ), bottom( 20 ),
MouseBox( /* <<<<<<<< handler for mouse events */
window:tb = Text Box( "click me!", <<setFontSize( 48 ), <<setwrap( 999 ) ), /* <<<<<< child box does not receive the mouse events */
<<setClickEnable( 1 ),
<<setClick( /* button-down, move, button-release handler */
// the Ticked event happens frequently, and makes it hard to see the Pressed event, so ignore it...
Function( {this, clickpt, event}, /*Is Alt Key(),Is Control Key(),Is Shift Key() should be captured on "Pressed" */
If( event != "Ticked",
window:tb << settext( event || Char( clickpt ) );
)
)
)
)
);
);
You might want to ignore Moved as well as Ticked.
MouseBox<<setClick example in the scripting index is one of the Three JSL Easter Eggs
Thanks. wonderful
very well documented in the scripting index - how could I miss it ...
And is there an action associated with hovering over the mouseBox - like with Hoverlabels?
I tried to add a JSL command to the Tooltip - but unfortunately the argument of << setTooltip is pre-evaluated.
Edited:
Putting the command inside Expr() stops JMP from evaluating the command while creating the window.
Unfortunately, it also doesn't get evaluated later.
new window("",Mouse Box (Text Box("Caption when mouseover?"),<<setTooltip(Caption ("Hello"); "click to revert" )))
My next try: use << setKeyEnabled(1) and use a key on the keyboard to trigger the action.
But the Mouse Box needs a <<set focus - so doesn't seem to be the right choice for a MouseOver.
Just the cursor change, I think. Great idea though.