Book a Demo

Author Topic: Shape scripts - lock subshape image size  (Read 4975 times)

David

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Shape scripts - lock subshape image size
« on: February 06, 2007, 04:03:39 am »
I have created a shape script for a stereotyped guielement with two subshape images.
The first subshape image will select one of three images with differing background colour depending on what keywords parameter is entered (White - for Mandatory; Light Grey - for Optional; Dark Grey - for Read Only). (see additional note below) The second subshape image will select one of two images of a button (Edit; View) which will default to Edit but change to View if the keywords parameter is "Read Only".

What I would ideally like is to prevent the button image from being distorted when the user resized this stereotyped guielement. Is there a way to lock the height and width of one of the subshapes and still allow the other image(s) in the guielement to be resized (both in height and width)?

TIA

David

Additional Note:
I have had to use three images of a text entry feild (with different background colours) because it has a border to make is look sunken on screen (Client specific requirement). This is simply because I do not know how to script a sunken border to a rectangle. Ideally I would have liked to use a rectangle (with a sunken style border) so I can also include default alphanumeric data. If anyone knows how to do this please advise any tips/suggestions.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Shape scripts - lock subshape image size
« Reply #1 on: February 06, 2007, 01:11:54 pm »
Hi David,

If you use layouttype="border"; then the subshapes can specify preferredheight=20; or preferredwidth=20; (Replace 20 with your preferred size) to specify a fixed size.

David

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: Shape scripts - lock subshape image size
« Reply #2 on: February 07, 2007, 05:28:24 am »
Hi Simon,

I tried your suggestion, but couldn't get it to work (must be doing somthing wrong).

First I put all three in the subshape button

layouttype="border";
preferredheight=20;
preferredwidth=20;


Then I moved layouttype="border"; into shape main.

In both cases, when I resized the whole guielement the button changed size.

HTH

David

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Shape scripts - lock subshape image size
« Reply #3 on: February 07, 2007, 01:30:11 pm »
This script will have a fixed size red square at the top right of the shape.  However you can use the same methods to create padding from the borders, add fixed size images etc.

Code: [Select]
shape main
{
 layouttype="border";
 
 rectangle(0,0,100,100);
 
 addsubshape("top", "N");
 
 shape top
 {
   layouttype="border";
   preferredheight=20;
   addsubshape("icon", "E");
 }
 
 shape icon
 {
   preferredwidth=20;
   setfillcolor(255, 0, 0);
   rectangle(0,0,100,100);
 }
}

David

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: Shape scripts - lock subshape image size
« Reply #4 on: February 08, 2007, 01:00:58 am »
Thanks Simon, that works for me ;D.

I will have a go at using this type of script for locking the size of a button image and created raised/sunken borders.

Cheers

David