I have been trying to understand mouse events. The tool guide is almost worthless.
There is an example below. The guide says that you can use one of 5 or 6(mac) formats and you can define 4 mouse states. I could only get png and jpg to load. The guide doesn't tell how to access the other mouse state images.
So I added an event handler. It only works with over or out events. I can not seem to trigger up or down, and button is always undefined so click, double click don't work either.
Code: Select allcreateDialog = function ( ) {
var dlg = new Window( 'dialog', 'Image Mouse Event Example Script' );
// no info found on changing images
var i = ScriptUI.newImage( new File('/c/k.jpg'), new File('/c/n.jpg'), new File('/c/n.jpg'), new File('/c/t.png') );
dlg.image = dlg.add ('image' , undefined, i, {name:'temp'});// also accepts jpg
dlg.btnPnl = dlg.add( 'panel', undefined );
dlg.btnPnl.orientation = "row";
dlg.btnPnl.alignment = "right";
dlg.btnPnl.preferredSize [ 80, 80 ]
dlg.btnPnl.okBtn = dlg.btnPnl.add( 'button', undefined, 'Ok', { name:'ok' });
dlg.btnPnl.cancelBtn = dlg.btnPnl.add( 'button', undefined, 'Cancel', { name:'cancel' });
return dlg;
};
initializeDialog = function( w ) {
// Set up initial control states
//ScriptUI.events.createEvent('MouseEvent');
//w.image.addEventListener ('mouseover', btnMouseEventHandler, false);
// w.image.addEventListener ('mouseout', btnMouseEventHandler, false);
with ( w.btnPnl ) {
// The Ok and Cancel buttons close this dialog
okBtn.onClick = function ( ) { this.parent.parent.close( 1 ); };
cancelBtn.onClick = function ( ) { this.parent.parent.close( 2 ); };
}
}
runDialog = function( w ) {
return w.show( );
};
var win = createDialog();
initializeDialog(win);
runDialog(win)
function btnMouseEventHandler (event) {
try {
var m = event.type// 'mouseover or mouseout
//alert( event.reflect.properties );
//alert( m.type )
if ( m == 'mouseover' ) win.image.icon = new File('/c/t.jpg');
if ( m == 'mouseout' ) win.image.icon = new File('/c/k.jpg');
}
catch (e) {
}
}
UIMouse events
UIMouse events
Have you mentioned this to Tom Ruark?
Back during CS3, he had suggested to me that in CS4 they'd have much of the w3 set of functions available. Certainly we can put a bug in his ear about it on the next go-around.
I should probably contact you offline about that.
-Chris Russ
Back during CS3, he had suggested to me that in CS4 they'd have much of the w3 set of functions available. Certainly we can put a bug in his ear about it on the next go-around.
I should probably contact you offline about that.
-Chris Russ
UIMouse events
It turns out that I was being stupid about part of this post.
The reason the other mouse states were not showing up was because I didn't add eventlistners for them.
But I still have not found a way to use the image states defined in newImage().
I have not contacted Tom Ruark but I did post a similar post at the ESKT prelease forum.
The reason the other mouse states were not showing up was because I didn't add eventlistners for them.
But I still have not found a way to use the image states defined in newImage().
I have not contacted Tom Ruark but I did post a similar post at the ESKT prelease forum.