Announcement

Collapse
No announcement yet.

Change button text

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

  • Change button text

    Hi,

    Appreciate help on the following.

    I have a button on a chart placed there using drawTextAbsolute.

    Is there an easy way to re-draw the button on the chart with a revised text caption or do I have to delete it using removeText and then re-create it with the revised caption?

    Many thanks

    Maurice

  • #2
    Maurice,

    The way to do this is to assign a tag name when first creating the button. Then when you want to redraw that same button, referencing that tag name again will replace the button with the new parameters.

    For instance...

    function main() {

    ...

    drawTextAbsolute( 0, 15, "%inRange: " + vPctInRange + "%", null, null, Text.BOLD | Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Arial", 12, "PctInRange" );
    ...

    if (vPctInRange > 80) {
    drawTextAbsolute( 0, 15, "%inRange: " + vPctInRange + "%", null, Color.green, Text.BOLD | Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Arial", 12, "PctInRange" )

    } else if (vPctInRange < 20) {
    drawTextAbsolute( 0, 15, "%inRange: " + vPctInRange + "%", null, Color.red, Text.BOLD | Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Arial", 12, "PctInRange" );
    }
    ...
    }
    Regards,
    Jay F.
    Product Manager
    _____________________________________
    Have a suggestion to improve our products?
    Click Support --> Request a Feature in eSignal 11

    Comment


    • #3
      Just discovered (as I'm sure others have as well) that buttons (i.e. Text.BUTTON) can't be color coded, so that wasn't the best example. Here's the working PctInRange code with color changing feature.
      Attached Files
      Regards,
      Jay F.
      Product Manager
      _____________________________________
      Have a suggestion to improve our products?
      Click Support --> Request a Feature in eSignal 11

      Comment


      • #4
        Jay F

        Many thanks for your help - it works now!

        Maurice

        Comment


        • #5
          Following on from that . . . . .

          Using the following:

          if (getCurrentBarIndex() == 0) {
          drawTextAbsolute(10,30," Reload @URL=EFS:ReloadButton",Color.black, null, Text.BUTTON | Text.RELATIVETOBOTTOM | Text.ONTOP, "Arial", 12, gReloadButton);

          I notice that the Text.RELATIVETOLEFT flag keeps the button static with respect to the left screen edge when the plots are scrolled left and right.

          Without this flag the button seems to scroll off the screen with the plots.

          Is there a way to easily keep the button static on the right hand margin regardless of scrolling the plot and regardless of maximising or reducing the window size?

          Thanks

          Maurice

          Comment


          • #6
            Maurice
            Not yet. Even though there is a Text.RELATIVETORIGHT it does not function in the same way as RELATIVETOLEFT -BOTTOM -TOP.
            Alex

            Comment

            Working...
            X