Announcement

Collapse
No announcement yet.

EFS Library behaivor (addLibrary function)

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

  • EFS Library behaivor (addLibrary function)

    Hello,

    I have several commonly used functions in an EFS library. I am having an issue with Buttons not referencing
    the correct button handler when the function from the library is called.

    EXAMPLE:

    My Main script:
    PHP Code:
    var drone addLibrary"LiveTradingDrone.efsLib" );

    function 
    main() {

       
    drone.showButtons();



    LiveTradingDrone.efslib contains:

    PHP Code:
    var tdrone null;

    function 
    droneStartHandle () {

        var 
    cdate getMonth(0) + "/" getDay(0) + "/" getYear(0) + " @ " getHour(0) + ":" getMinute(0);
        
    debugPrintln("Drone start handle called @ " cdate);
        
    tdrone "on";
    }




    function 
    droneStopHandle () {

        var 
    cdate getMonth(0) + "/" getDay(0) + "/" getYear(0) + " @ " getHour(0) + ":" getMinute(0);
        
    debugPrintln("Drone STOP handle called @ " cdate);
        
    tdrone null;
    }



    function 
    showButtons() {

        if (
    tdrone != "on") {

            
    drawTextAbsolute050"Start Drone Trading@URL=EFS:droneStartHandle"Color.yellowColor.blueText.BOLD Text.ONTOP Text.FRAME Text.RELATIVETOLEFT Text.RELATIVETOTOP Text.BUTTON"Verdana"10"button");

        } else {

            
    drawTextAbsolute2350"CEASE drone@URL=EFS:droneStopHandle"Color.yellowColor.blueText.BOLD Text.ONTOP Text.FRAME Text.RELATIVETOLEFT Text.RELATIVETOTOP Text.BUTTON"Verdana"10"button");

        }



    My problem is, even though buttons are plotted when showButtons() is called from the main function, when i actually click on the button
    the handler (droneStartHandle) is not being executed. Is there another way I should be referencing EFS handles when using a library?

    tia

  • #2
    Hello Techlord,

    The EFS callback url for drawn objects is currently only designed to look for the specified function name within the same file. The reason nothing executes when you click on the button is because the functions droneStartHandle and droneStopHandle do not exist in your EFS. Just add the following functions to your EFS and it will work.

    PHP Code:
    function droneStartHandle() {
        
    drone.droneStartHandle();
        return;
    }

    function 
    droneStopHandle() {
        
    drone.droneStopHandle();
        return;


    Also, you will want to add a call to showButtons() in each of the droneXX functions in your EFS Library so that the correct button gets drawn after a mouse click. Otherwise, the new button won't be drawn until another trade occurs.
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Jason,

      I thought about calling them that way but the problem is that it effectively prevents the library from being modular. I would have to create those function stubs in every script that wishes to utilize the library.

      One thing that i did try was to do the button handler this way:
      (Contents of LiveTradingDrone.efslib)

      PHP Code:

      drawTextAbsolute
      050"Start Drone Trading@URL=EFS:drone.droneStartHandle"Color.yellow, ... 
      But this didnt work either. Any thoughts?

      Comment


      • #4
        Hello Techlord,

        Unfortunately there isn't a solution to what you are trying to do with your EFS Library. The EFS callback feature of the drawText function was designed long before EFS2 and EFS Libraries, so it currently has no way of calling a function from a Library file. I would suggest that you submit a request to add this ability to a future release to our development team at [email protected].
        Jason K.
        Project Manager
        eSignal - an Interactive Data company

        EFS KnowledgeBase
        JavaScript for EFS Video Series
        EFS Beginner Tutorial Series
        EFS Glossary
        Custom EFS Development Policy

        New User Orientation

        Comment


        • #5
          I'd also love to be able to do this as I've run into the same issue. But rather than using:

          EFS:drone.droneStartHandle

          I'd prefer to be able to do it using:

          EFS:this.droneStartHandle

          so that you could potentially have separate callbacks for separate objects.

          John

          Comment

          Working...
          X