Skip to main content
January 16, 2010
Question

Rectangle to Image (or Button)?

  • January 16, 2010
  • 1 reply
  • 686 views

Hello,


i hope you can help me

see attachment...

Regards,
Andreas

myRectINHALT.geometricBounds = [0, 0, 45, 45];                        
myRectINHALT.fillColor = "Black";
var i = myRectINHALT;  //  ??????????????????

//RAHMENdlg.iBtn = RAHMENdlg.add ('iconbutton' ,[0,0,200,200],  i);  ???
or
//var image = ScriptUI.newImage( i );    ???

This topic has been closed for replies.

1 reply

January 16, 2010

If you want to convert rectangle to image, use Export option.

Sudar.

January 16, 2010

Hello Sudar,

The rectangle should one see on a dialogue field in an image, not to export

regards

Andreas

Inspiring
January 16, 2010

Are you asking how to create an iconimage control in a dialog?

createDialog = function ( ) {
   var dlg = new Window( 'dialog', 'Iconbutton Example Script' );
   var i = ScriptUI.newImage( new File('/c/t.png'), undefined, undefined, new File('/c/k.png') );// also accepts jpg
   dlg.iBtn = dlg.add ('iconbutton' , undefined,  i);
   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
     w.iBtn.onClick = function(){
          alert('Iconbutton pressed');
     }
    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)