Announcement

Collapse
No announcement yet.

@URL=EFS parameters

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

  • @URL=EFS parameters

    hi all,

    is it possible to use arguments/parameters when calling a function from drawtextrelative? I have tried
    drawTextPixel(5,20, showtxt+"@URL=EFS:showhide(a,b)",...)

    but it did not work.

    Thanks in advance

  • #2
    Not that I'm aware of...

    Not that I'm aware of...

    The solution is to use global variables in your code... For example..

    Let's say you wanted to have your BUTTON pass variables "A" and "B". If these variables could be updated is Global Variables. then you would simply have your button code pass to a second function the variables necessary to complete the request..

    PHP Code:
    var 0;
    var 
    0;

    function 
    main() {

         
    drawTextRelative(0low(0), " Button " "@URL=EFS:ButtonClick"Color.blackColor.RGB(0xE00xFF0xE0), Text.FRAME Text.ONTOP Text.CENTER"Arial"8"ButtonONOFF");

    }

    function 
    ButtonClick(nButtonPressed) {
      
    DoSomething(A,B);
    }

    function 
    DoSomethingInput1Input2) {
      ...

    This way, you can control A and B within your code and then pass these values whenever the specific button is clicked.

    Brad
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      You can try this efs, I wrote it to demonstrate the left click, left double click and right button clicks. All it does is call different functions which change variables which are used as titles and position of the buttons. You may have to hide the snapshot window (right click it) to see the first button when you run the efs.
      PHP Code:
      var flg Text.RELATIVETOLEFT|Text.RELATIVETOTOPText.FRAME Text.ONTOP;
      var 
      xx 480;
      var 
      yy 0;
      var 
      nButtonTitle "Click me!!";
      var 
      backcolor Color.red;
      var 
      forcolor Color.white

      function preMain(){
          
      setPriceStudy(true); 
        
      setStudyTitle("Button Test"); 
      }
      // end preMain
      function main() {
        var 
      BarState getBarState();
        var 
      nIndex getCurrentBarIndex();    //debugPrintln("nIndex = " +nIndex); 

          //----------------------------------------------------------------------------------------     
          
      if (nIndex < -60){return;} // minimizes load time
          
      if (BarState == BARSTATE_NEWBAR) {     
              
      barcount +=1;//debugPrintln("barcount = " +barcount);
              
      getButtons(); 
          }
          return;
      }

      function 
      getButtons(){
          
      drawTextPixelxxyynButtonTitle +" @URL=EFS:catchme"forcolorbackcolorflg,"Comic Sans MS"20, -5);
      }

      function 
      catchmenButtonPressed ){//should force to manual also
          
      if ( getButtonPressednButtonPressed ) == ) {
              
      debugPrintln("BUTTON_LEFT            - Left Button Clicked");
              
      xx 480;
              
      yy 40;
              
      nButtonTitle "Click me with the right button!!";
              
      backcolor Color.red;
              
      forcolor Color.white;
          }
          if ( 
      getButtonPressednButtonPressed ) == ) {
              
      debugPrintln("BUTTON_RIGHT        - Right Button Clicked");
              
      xx 600;
              
      yy 100;
              
      nButtonTitle "Left Double-Click me!!";
              
      backcolor Color.white;
              
      forcolor Color.black;
          }
          if ( 
      getButtonPressednButtonPressed ) == ) {
              
      debugPrintln("BUTTON_LEFTDBLCLK        - Left Button Double-Clicked");
              
      xx 170;
              
      yy 50;
              
      nButtonTitle "Click me with the left button!!";
              
      backcolor Color.yellow;
              
      forcolor Color.blue;
          }
          if ( 
      getButtonPressednButtonPressed ) == ) {
              
      debugPrintln("BUTTON_UNKNOWN            - Some Other Button Click");
              
      xx 200;
              
      yy 50;
              
      nButtonTitle "Click me with the right button!!";
              
      backcolor Color.yellow;
              
      forcolor Color.blue;
          }
          
      getButtons(); 
          return;
      }

      //BUTTON_RIGHT        - Right Button Clicked
      //BUTTON_LEFT            - Left Button Clicked
      //BUTTON_LEFTDBLCLK        - Left Button Double-Clicked
      //== function determines if a button was pressed and which on was pressed

      function getButtonPressed(nButtonPressed) {
        if(
      nButtonPressed == BUTTON_LEFT) {return(1);}
        if(
      nButtonPressed == BUTTON_RIGHT) {return(2);}
        if(
      nButtonPressed == BUTTON_LEFTDBLCLK) {return(3);}
          else {return(
      0);}

      I hope this helps

      Comment

      Working...
      X