Dynamic text renderer

1312
5
Jump to solution
01-22-2021 04:00 PM
kingrollo
New Contributor II

Is it possible to create custom dynamic text fields through the SDK? Let's say (as a bad example) that I want to display the user's computer name on every printed layout. I would write some custom C# to extract the computer name, and ideally expose it through something like:

 

PC name: <dyn type="custom" property="computerName">

 

Which would then render as:

 

PC name: Donald's MacBook Pro

 

In case it wasn't clear, I'm just using this as a simple example - this isn't actually what I'm trying to do.

I can't figure out from the documentation whether this is possible, and where the rendering actually happens? Anyone have any ideas?

0 Kudos
1 Solution

Accepted Solutions
KirkKuykendall1
Occasional Contributor III

It doesn't look like Esri supports ways for devs to implement custom <dyn>s.

I'd try using the CustomProperties, maybe with a similar dyn-like language, to populate TextProperties.Text when a suitable event fires.

Careful with LayoutViewEvent - if TextProperties.Text is changed when it fires, an infinite loop can ensue.

As I recall, ActivePaneChangingEvent doesn't have this issue.

View solution in original post

0 Kudos
5 Replies
KirkKuykendall1
Occasional Contributor III
0 Kudos
kingrollo
New Contributor II

Thanks for responding, but that example just illustrates changing text in a non-dynamic element. It's not clear how the value renders in a dynamic text element.

One theoretical approach would be to hook into an event called something like RenderDynamicTextElementEvent, but I can't see anything like that in the docs. Another might be to somehow tell the SDK to render the value in place of the dynamic text, but I can't see how to do that either.

0 Kudos
KirkKuykendall1
Occasional Contributor III

It doesn't look like Esri supports ways for devs to implement custom <dyn>s.

I'd try using the CustomProperties, maybe with a similar dyn-like language, to populate TextProperties.Text when a suitable event fires.

Careful with LayoutViewEvent - if TextProperties.Text is changed when it fires, an infinite loop can ensue.

As I recall, ActivePaneChangingEvent doesn't have this issue.

0 Kudos
kingrollo
New Contributor II

Thanks! ActiveWindowChangingEvent (not Pane) seemed a good solution, although I haven't managed to get what I really want working at the moment. The events just seem too unpredictable - ElementsUpdatedEvent seemed promising, but it's really difficult to tell what's actually changed and very easy to fall into infinite loops.

I'm putting this on the back burner for now, but will accept your suggested solution above and will update if there are future developments.

0 Kudos
KirkKuykendall1
Occasional Contributor III
0 Kudos