Announcement

Collapse
No announcement yet.

to put a reversible button on the chart

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

  • to put a reversible button on the chart

    Hello,
    I tried to use a button into a chart to show a line (by a OnButtonDblClk command). I have done it to show this line, but I can't hide this line after that. I explain, I can't get back to the code to authorize this function once again.
    I saw the example of code : rectanglebo.efs but this code is not obvious to me.

    What is the sense of these lines :
    - nA = getGlobalValue("nA"+getInvokerID());

    and
    - drawTextRelative(5, 20, sLabel+"@URL=EFS:click", null, null,
    (precisely, in this line, I don't undertand "@URL=EFS:click" - is there online documentation about this ?)

    and
    - function click() {
    (I looked for a call of this function and found nothing)

    To my code, the best would be a symetrical button :
    when the line is hidden, this button would allow to show it (with a specific label, like "SHOW THE LINE"), and when the line is visible, the same button would allow to hide it (with a second specific label like "HIDE THE LINE").

    Thank you in advance for your help or guidance.

  • #2
    Here's what you need to do.

    You need to create a logical variable to handle the button needs.

    Then, you need to create a button control feature to accomplish the line drawing you need.

    This is an example of using an EFS global variable to control the actions of a button.

    Hope it helps.

    PHP Code:
    //  Global Variables in EFS Script
    var ButtonLogical false;


    function 
    main() {

          if (!
    ButtonLogical ) {
            
    drawTextPixel(4,28" DRAW LINE "+"@URL=EFS:DLbutton" Color.whiteColor.RGB(0xE00x000x00), Text.FRAME Text.ONTOP Text.RELATIVETOLEFT Text.RELATIVETOBOTTOMnull11"DLTB");
          } else {
            
    drawTextPixel(4,28" HIDE LINE "+"@URL=EFS:DLbutton" Color.blackColor.RGB(0x000xE00x00), Text.FRAME Text.ONTOP Text.RELATIVETOLEFT Text.RELATIVETOBOTTOMnull11"DLTB");
          }

    HandleDrawLine();

    }  
    // End of main()

    function DLButton() {
      if (
    ButtonLogical) { ButtonLogical false; } else { ButtonLogical true; }

    }

    function 
    HandleDrawLine() {
      if (
    ButtonLogical) {
      
    //  Draw Line
              
    drawLineRelative(-1,close(),0,close(), PS_SOLID2Color.magenta"DL_TL");

      } else {
      
    //  Hide Line
           
    removeLine("DL_TL");

      }



    Last edited by Doji3333; 03-08-2009, 04:17 PM.
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Something is wrong with my last post. I've tried editing it, but it looks correct when I edit it. When I view it, it has all the "image" crap that is not in my original post..

      Here is the main function as it SHOULD appear (without that image crud added into it..

      function main() {

      if (!ButtonLogical ) {
      drawTextPixel(4,28, " DRAW LINE "+"@URL=EFSLbutton" , Color.white, Color.RGB(0xE0, 0x00, 0x00), Text.FRAME | Text.ONTOP | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, null, 11, "DLTB");
      } else {
      drawTextPixel(4,28, " HIDE LINE "+"@URL=EFSLbutton" , Color.black, Color.RGB(0x00, 0xE0, 0x00), Text.FRAME | Text.ONTOP | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, null, 11, "DLTB");
      }

      HandleDrawLine();

      } // End of main()
      Brad Matheny
      eSignal Solution Provider since 2000

      Comment


      • #4
        Now Smiley faces??? LOL

        Ok, It must be the interpreter of this forum.. That should read DLButton, not SmileyFaceLButton.

        Sorry.
        Brad Matheny
        eSignal Solution Provider since 2000

        Comment


        • #5
          Brad
          You need to check the Disable Smilies in this post option when you compose the message
          Alex


          Originally posted by Doji3333
          Now Smiley faces??? LOL

          Ok, It must be the interpreter of this forum.. That should read DLButton, not SmileyFaceLButton.

          Sorry.

          Comment


          • #6
            Thanks a lot, it works well! and with several buttons.
            Mermoz

            Comment

            Working...
            X