Book a Demo

Author Topic: Decoration Shape Script  (Read 4035 times)

Eddie

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Decoration Shape Script
« on: March 31, 2009, 12:04:05 pm »
Hi Everyone.

I'm trying to create a shape script for a component that when made composite adds the .emf image to the top right hand corner.  

Can conditional formating be added to the decoration shape?

Here is the script I have thus far:

//Basic Shape
decoration top_right
{
      if(hasproperty("iscomposite","true"))
      {
      orientation="NE";
      image("Expand",10,10,90,90);
      return;
      }
}

shape main
{
      setpen(236,115,49,2);
      setfillcolor(252,217,176);
      roundrect(0,0,100,100,10,10);
      
      addsubshape("namecompartment",100,100);
      
      shape namecompartment
      {
      h_align= "center";
      v_align= "center";
      printwrapped("#name#");
      }
}

If I remove the if statement it works fine, however I'd really like to only display the .emf image when the element is made composite.

Any help would be much appreciated!

Many thanks in advance.

Eddie

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Decoration Shape Script
« Reply #1 on: March 31, 2009, 01:12:52 pm »
Attribute settings must appear at the beginning of a shape, so move orientation="NE"; outside the if{}:

Code: [Select]
//Basic Shape
decoration top_right
{
     orientation="NE";
     if(hasproperty("iscomposite","true"))
     {
         image("Expand",10,10,90,90);
         return;
     }
}
The Sparx Team
[email protected]

Eddie

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Decoration Shape Script
« Reply #2 on: March 31, 2009, 01:48:47 pm »
Thanks for your help KP!