Book a Demo

Author Topic: Shape script for multiline textbox  (Read 3515 times)

Colin Richardson

  • EA User
  • **
  • Posts: 52
  • Karma: +0/-0
    • View Profile
Shape script for multiline textbox
« on: April 10, 2012, 01:23:27 pm »
Hi,

I'm trying to write a script to display something with horizontal and vertical scroll bars.  I'm having trouble positioning the glyphs in the NE, 2 in SE, and SW corners.

Here's my script - any ideas?

======================

shape main
{
      layoutType="border";
      setfillcolor(250, 250, 250);
      rectangle(0,0,100,100);
      println("#name#");
      addsubshape("scrollRight","SE");
      addsubshape("scrollUp","NE");
      addsubshape("scrollLeft","SW");
      addsubshape("scrollDown","SE");
      
      
      
      decoration scrollUp
      {
            scalable="false";
            preferredwidth=15;
            preferredheight=21;
            image("ScrollUp.PNG", 0,1,15,17);      
      }
      decoration scrollDown
      {
            scalable="false";
            rightAnchorOffset=(10,10);
            //bottomAnchorOffset=(0,0);
            preferredwidth=15;
            preferredheight=16;
            image("ScrollDown.PNG", 0,1,15,17);      
      }
      decoration scrollLeft
      {
            scalable="false";
            bottomAnchorOffset=(-10,-10);
            preferredwidth=16;
            preferredheight=15;
            image("ScrollLeft.PNG", 0,1,16,16);      
      }
      decoration scrollRight
      {
            scalable="false";
            preferredwidth=15;
            preferredheight=16;
            image("ScrollRight.PNG", 0,1,16,16);      
            
      }
}

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Shape script for multiline textbox
« Reply #1 on: April 11, 2012, 10:20:52 am »
Try something like this (I have put Rectangle() commands in instead of the Image() commands for testing purposes):

shape main
{
      layoutType="border";
      setfillcolor(250, 250, 250);
      rectangle(0,0,100,100);
      println("#name#");
      addsubshape("rightscrollbar","E");
      addsubshape("bottomscrollbar","S");

      shape rightscrollbar
      {
            layoutType="border";
            preferredWidth=16;
            rectangle(0,0,100,100);
            addsubshape("scrollup","N");
            addsubshape("scrolldown","S");
            
            shape scrollUp
            {
                  preferredheight=16;
                  rectangle(0,0,100,100);
                  //image("ScrollUp.PNG",0,0,100,100);      
            }
            shape scrollDown
            {
                  preferredheight=16;
                  rectangle(0,0,100,100);
                  //image("ScrollDown.PNG",0,0,100,100);      
            }
      }

      shape bottomscrollbar
      {
            layoutType="border";
            preferredheight=16;
            rectangle(0,0,100,100);
            addsubshape("scrollleft","W");
            addsubshape("scrollright","E");
            
            shape scrollLeft
            {
                  preferredwidth=16;
                  rectangle(0,0,100,100);
                  //image("ScrollLeft.PNG",0,0,100,100);      
            }
            shape scrollRight
            {
                  preferredwidth=16;
                  rectangle(0,0,100,100);
                  //image("ScrollRight.PNG",0,0,100,100);      
            }
      }
}
The Sparx Team
[email protected]

Colin Richardson

  • EA User
  • **
  • Posts: 52
  • Karma: +0/-0
    • View Profile
Re: Shape script for multiline textbox
« Reply #2 on: April 11, 2012, 12:26:17 pm »
Oh, how nice is that.

Legendary - many thanks :D