4 Replies Latest reply on Jan 16, 2010 8:52 AM by AndreasRoe

    Rectangle to Image (or Button)?

    AndreasRoe Level 1

      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 );    ???

        • 1. Re: Rectangle to Image (or Button)?
          sudar1983_14 Level 2

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

           

          Sudar.

          • 2. Re: Rectangle to Image (or Button)?
            AndreasRoe Level 1

            Hello Sudar,

             

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

             

            regards

            Andreas

            • 3. Re: Rectangle to Image (or Button)?
              Michael L Hale Level 5

              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)
              
              • 4. Re: Rectangle to Image (or Button)?
                AndreasRoe Level 1

                Hello Sudar,

                 

                No, ...  see attachment...

                 

                regards

                Andreas