Page 1 of 1

Text element ClickEvent - get line

Posted: Fri Oct 16, 2015 12:44 pm
by MasaMM
Hi,

I have a DataBand with a Text element on it. I assigned code to the ClickEvent of this Text. Now I need to know how to get the line of the actual Text the user clicks on.
For example after the report has been generated the DataBand has been printed 3 times - so has the Text element on my DataBand. I just need to know on which of those 3 printet texts raised the click event (by giving me the line number or even the actual data record for this line)

Re: Text element ClickEvent - get line

Posted: Fri Oct 16, 2015 1:19 pm
by HighAley
Hello

You could get text of the Text component with next code:

Code: Select all

(sender as StiText).Text.Value
If you need to get any additional data. You could store it in Tag property of the Text component.

Thank you.

Re: Text element ClickEvent - get line

Posted: Fri Oct 16, 2015 2:20 pm
by MasaMM
Aleksey Andreyanov wrote: If you need to get any additional data. You could store it in Tag property of the Text component.
Hello,

The Tag property seems to be the same for every instance of the Text element. So I can't have different Tag data for different instances of my Text.
In contrast to the "Text" property of the Text element which returns the Text of the rendered instance of the Text element rather than the expression.

(There's far too much "text" going on above :mrgreen: )

Re: Text element ClickEvent - get line

Posted: Mon Oct 19, 2015 6:08 am
by HighAley
Hello.

Each instance of Text component have it's own Tag property. You could see how to set Tag value in the Interactive Reports - Anchors demo report. Look at Text28 text component.

To get the value of Tag you could use next expression:

Code: Select all

(sender as StiText).TagValue
Thank you.

Re: Text element ClickEvent - get line

Posted: Mon Oct 19, 2015 6:51 am
by MasaMM
Thanks, that worked! :)

Re: Text element ClickEvent - get line

Posted: Mon Oct 19, 2015 11:13 am
by HighAley
Hello.

We are always glad to help you.
Let us know if you need any additional help.

Thank you.