2 Replies Latest reply: May 8, 2013 7:27 PM by KonradZuse RSS

    Detecting when a control has been rendered in the UI

      Is there a way to detect (and react to) when a UI component has been rendered on a UI? I have a situation where I'm displaying a chart that I have given the ability to zoom and pan to (by means of an extended "container pane" class). For the zoom/pan capability to work, I need to turn off auto-ranging for the chart axes (zooming and panning are performed by adjusting the axis bounds). However, it would be useful to invoke the auto-ranging functionality when the chart is initially rendered so that the chart is "fitted" to the data. Then, once that is done, I would then turn off auto-ranging to allow the user to zoom and pan as they wish. I can't seem to find a method that works where auto-ranging is "on" and the chart is fitted to the data and then turned "off" so that zooming/panning works. I suspect that only when the chart is rendered on the UI does the auto-ranging come into play, hence my initial question.
        • 1. Re: Detecting when a control has been rendered in the UI
          Try turning off Animation on the chart and counting pulses with an AnimationTimer.

          Though in your case it would seem simpler to add a change listener on the axis bound properties.
          • 2. Re: Detecting when a control has been rendered in the UI
            Couldn't you just set it to autorange initially like you said, then shut it off when you want to zoom/pan? Then you can do the call this

            public final BooleanProperty autoRangingProperty
            This is true when the axis determines its range from the data automatically
            See Also:
            isAutoRanging(), setAutoRanging(boolean)
            Figure out when you are or not then zoom/pan? or am I missing something here?

            Edited by: KonradZuse on May 8, 2013 5:26 PM