# Dynamic text in custom K2 Node

**URL:** <https://forums.unrealengine.com/t/dynamic-text-in-custom-k2-node/439466>\
**Category:** UI\
**Tags:** details-panel-ui, unreal-engine, slate, custom-nodes, Blueprint, question, CPP\
**Created:** [December 14, 2018, 1:08am UTC](https://forums.unrealengine.com/t/dynamic-text-in-custom-k2-node/439466 "2018-12-14T01:08:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![CraftyWeazel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CraftyWeazel](https://forums.unrealengine.com/u/CraftyWeazel)\
**Post date:** [December 14, 2018, 1:08am UTC](https://forums.unrealengine.com/t/dynamic-text-in-custom-k2-node/439466/1 "2018-12-14T01:08:10Z")

</div>

Hi there!

I’m creating a bunch of new blueprint nodes for a plugin I’m developping.  
Some of these nodes need to have a text box at the bottom, which I managed to do as you can see in this image:

 ![262278-ue4-dialognode-textissue.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/8/e/38e7676c41a64ce13ed3f7b39924b5c83a37583f.png)

Now, the idea is that these nodes have some details in the detail panel when you select them, like this text box you see in the picture. I would like to bind the text in the SRichTextBox of the node to this Text field in the details panel. Like, when the user commits a new text, it automatically updates the text in the box.

Do you think it’s possible? How would you do it?

**Thanks a lot for every answer!**

_From a - not so - Crafty Weazel_

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [December 14, 2018, 4:37am UTC](https://forums.unrealengine.com/t/dynamic-text-in-custom-k2-node/439466/2 "2018-12-14T04:37:28Z")

</div>

Did you tried to bind pointer of that property?

---

<div class="post-metadata">

**Author:** ![CraftyWeazel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CraftyWeazel](https://forums.unrealengine.com/u/CraftyWeazel)\
**Post date:** [December 14, 2018, 7:24am UTC](https://forums.unrealengine.com/t/dynamic-text-in-custom-k2-node/439466/3 "2018-12-14T07:24:03Z")

</div>

I only need to bind a pointer?  
I don’t think it’s possible, I can’t convert from UProperty to TAttribute or something. Maybe just a FText pointer?

---

<div class="post-metadata">

**Author:** ![Firefly74](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Firefly74](https://forums.unrealengine.com/u/Firefly74)\
**Post date:** [December 14, 2018, 9:45am UTC](https://forums.unrealengine.com/t/dynamic-text-in-custom-k2-node/439466/4 "2018-12-14T09:45:36Z")

</div>

i think nodes have the “PostEditChangeProperty” methods called in that situation too. Did you allready check that way ?

---

<div class="post-metadata">

**Author:** ![CraftyWeazel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CraftyWeazel](https://forums.unrealengine.com/u/CraftyWeazel)\
**Post date:** [December 15, 2018, 10:27am UTC](https://forums.unrealengine.com/t/dynamic-text-in-custom-k2-node/439466/5 "2018-12-15T10:27:29Z")

</div>

I’ve already overriden this method, indeed, but for another thing.  
How should I act on the Slate-side of my node from the PostEditChangeProperty in my K2Node?  
I think it’s only the Slate object which holds a pointer to the K2Node, and not the contrary.

---

<div class="post-metadata">

**Author:** ![Firefly74](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Firefly74](https://forums.unrealengine.com/u/Firefly74)\
**Post date:** [December 15, 2018, 11:16am UTC](https://forums.unrealengine.com/t/dynamic-text-in-custom-k2-node/439466/6 "2018-12-15T11:16:52Z")

</div>

If you put a breakpoint on the method and edit the box, is the method triggered ?  
For the slate thing, you could make a binding method for the text of slate object  
Ex: [https://answers.unrealengine.com/questions/359240/properly-binding-function-to-slate-text.html](https://answers.unrealengine.com/questions/359240/properly-binding-function-to-slate-text.html)

---

<div class="post-metadata">

**Author:** ![CraftyWeazel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CraftyWeazel](https://forums.unrealengine.com/u/CraftyWeazel)\
**Post date:** [December 15, 2018, 1:04pm UTC](https://forums.unrealengine.com/t/dynamic-text-in-custom-k2-node/439466/7 "2018-12-15T13:04:22Z")

</div>

Great, that worked pretty well 🙂 Thank you. I will make a proper answer with code references and mark it as answered.

---

<div class="post-metadata">

**Author:** ![CraftyWeazel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CraftyWeazel](https://forums.unrealengine.com/u/CraftyWeazel)\
**Post date:** [December 16, 2018, 12:24pm UTC](https://forums.unrealengine.com/t/dynamic-text-in-custom-k2-node/439466/8 "2018-12-16T12:24:58Z")

</div>

Thanks to Firefly74’s comments and the link he gave me, I was able to do it.

So here is my final code for those who wonder:

Inside my Slate widget, I declare the text value this way. It’s bound to a function in the slate widget which is called “GetTextFromNode()”:

```
TAttribute<FText> Value = TAttribute<FText>::Create(TAttribute<FText>::FGetter::CreateRaw(this, &SGraphDialogNode::GetTextFromNode));

```

This function is implemented as follows:

```
FText SGraphDialogNode::GetTextFromNode() const
{
	UBPNode_DialogBase* DialogNode = dynamic_cast<UBPNode_DialogBase*>(GraphNode);
	if (DialogNode)
	{
		return DialogNode->TryGetText();
	}
	return LOCTEXT("NoText", "");
}

```

And in the UBP\_DialogBase node, I am returning a FText depending on the node properties. I will do all text parsing there in order to make full use of RichText widget.
