2 Replies Latest reply on Feb 26, 2008 8:13 AM by pvanderhoeven

    calling function in tilelist custom itemrenderer

    pvanderhoeven
      Hi,
      I have a tilelist with a custom item renderer (a canvas if it matters).
      When another event on the form occurs, I want to call a function on one of the items in the tilelist.

      How do I call a function in a custom itemrenderer of an item in a tilelist from the parent application?

      thanks!
      Paul
        • 1. Re: calling function in tilelist custom itemrenderer
          SujitG Level 2
          Use the event handling mechanism. You can make your custom item renderer to listen to a custom event. In the event handler call the function, which you want to call. Dispatch this custom event, when ever you want to invoke the function in your customer renderer.

          Hope this helps.
          • 2. Re: calling function in tilelist custom itemrenderer
            pvanderhoeven Level 1
            Hi SujitG, thanks for the reply.

            My understanding of event bubbling is that an event only bubbles up the parent's chain of ancestors in the display list. Siblings, such as two controls inside the same container, do not intercept each other's events.

            So, the item renderer could not intercept the event from the sibling control (in this case it's a videodisplay).

            But your answer is on the right track, if only part of the way there.

            The way I have solved it so far, is to have the videodisplay dispatch a custom event. I added an event listener to the canvas that contains the tilelist and the videodisplay. Since the canvas is a parent to the videodisplay, it has no trouble capturing the event that is bubbled up to it. The next step is to then have the event handler located in the parent canvas call the function in the item renderer.

            The answer that I am looking for is, How do I call a function in the itemrenderer of the tilelist from the parent container?

            I expect the answer will be something like: myTileList.ItemRenderer .somePublicFunction();

            Regards,
            Paul