Announcement

Collapse
No announcement yet.

Multiple Buttons

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple Buttons

    I have made an EFS that create multiple lines and I am looking for a way to delete the lines individually.

    So far, the lines are tagged with a prefix name and then a number i.e Line0, Line, 1 and so on.

    I need a way of passing the line number to a function that removes the line so when I button saying "Delete Line 1" it will remove it. I am aware of the removeLineTool but I need something more than this as I have many variables that depend on the line number and not the line itself.

    Many thanks

  • #2
    you could create a rotating button in your efs that allows you to select the line you want to alter, then have another set of buttons to clear/draw the lines as needed.

    The rotating button is rather simple to create. You simply create a control variable (0~?) to handle the unique lines. When you click on this button, simply increment the variable to the next number (mvar++ and then redraw the button. This will allow you to select unique lines.

    The next portion of the code will take some work... You have to create a clear/draw function for the lines and you have to know if the line is cleared or drawn. Thus, you need a BOOLEAN variable for each line.

    If you want, you can make the buttons "state active" meaning only showing buttons that are available based on the state (drawn or cleared) of the selected line.

    IMHO, you only need 2 total buttons. One to select the line you want to alter and the other to control the state of the line.
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      The best method I've thought of is using a 'slice' to cut off the end character of the line tag which is the identifying number.

      My next problem sounds simple but I can't find a method for it. I just need to find a way to identify which button has been pressed.

      Any ideas?

      Comment


      • #4
        How would the rotating button enable me to select an individual line?

        Comment


        • #5
          I tried to post a reply to this yesterday, but the site kept rejecting my post..

          Like I said earlier, it's easiest if you have one button to control which line you want to select, then a second button to control ON/OFF. Like this....

          PHP Code:
          var LineArray = new Array(truetruetruetruetrue);
            
          //  Example shown with 5 total lines
          var LineSelector 0;


          function 
          main() {


                
          drawTextPixel(4,10" Line ["+LineSelector +"] "+"@URL=EFS:LSbutton" Color.blackColor.RGB(0xE00xE00xE0), Text.FRAME Text.ONTOP Text.RELATIVETOLEFT Text.RELATIVETOBOTTOMnullnFontSize"LSB");

          if (
          LineArray[LineSelector]) {
                  
          drawTextPixel(4,55" OFF "+"@URL=EFS:LOOButton" Color.blackColor.RGB(0xE00xF00xE0), Text.FRAME Text.ONTOP Text.RELATIVETOLEFT Text.RELATIVETOBOTTOMnullnFontSize"LOO");
          } else {
                  
          drawTextPixel(4,55" ON "+"@URL=EFS:LOOButton" Color.blackColor.RGB(0xE00xF00xE0), Text.FRAME Text.ONTOP Text.RELATIVETOLEFT Text.RELATIVETOBOTTOMnullnFontSize"LOO");
          }


          }


          function 
          LSbutton() {
            
          LineSelector++;
            if (
          LineSelector LineArray.length) {
              
          LineSelector 0;
            }

                
          drawTextPixel(4,10" Line ["+LineSelector +"] "+"@URL=EFS:LSbutton" Color.blackColor.RGB(0xE00xE00xE0), Text.FRAME Text.ONTOP Text.RELATIVETOLEFT Text.RELATIVETOBOTTOMnullnFontSize"LSB");

          if (
          LineArray[LineSelector]) {
                  
          drawTextPixel(4,55" OFF "+"@URL=EFS:LOOButton" Color.blackColor.RGB(0xE00xF00xE0), Text.FRAME Text.ONTOP Text.RELATIVETOLEFT Text.RELATIVETOBOTTOMnullnFontSize"LOO");
          } else {
                  
          drawTextPixel(4,55" ON "+"@URL=EFS:LOOButton" Color.blackColor.RGB(0xE00xF00xE0), Text.FRAME Text.ONTOP Text.RELATIVETOLEFT Text.RELATIVETOBOTTOMnullnFontSize"LOO");
          }

          }

          function 
          LOOButton() {
            if (
          LineArray[LineSelector]) {
               
          LineArray[LineSelector] = false;
               
          removeLine("Line"+LineSelector);
            } else {
               
          LineArray[LineSelector] = true;
              
          drawLineRelative(-1,LineLevel,1,LineLevelPS_SOLID2Color.maroon"Line"+LineSelector);   
            }


          if (
          LineArray[LineSelector]) {
                  
          drawTextPixel(4,55" OFF "+"@URL=EFS:LOOButton" Color.blackColor.RGB(0xE00xF00xE0), Text.FRAME Text.ONTOP Text.RELATIVETOLEFT Text.RELATIVETOBOTTOMnullnFontSize"LOO");
          } else {
                  
          drawTextPixel(4,55" ON "+"@URL=EFS:LOOButton" Color.blackColor.RGB(0xE00xF00xE0), Text.FRAME Text.ONTOP Text.RELATIVETOLEFT Text.RELATIVETOBOTTOMnullnFontSize"LOO");
          }


          Last edited by Doji3333; 07-29-2009, 01:32 PM.
          Brad Matheny
          eSignal Solution Provider since 2000

          Comment

          Working...
          X