Fields that write back to tag on demand

Say I have a window with a few text fields, tied to memory tags.

I could set these fields bidirectional, so whatever I enter gets saved to those tags.

But what I want is a way to input text in the field and not have it get saved to the tags until I click a button (I also don’t want it refreshing with tag values either once the panel is active).

Is there a simple way to do this?

Thanks.

Don’t use bindings, use scripting.

When the window is opened, do a system.tag.read call to get the initial values.

When your button is pressed, use system.tag.write to write the values back.

That’s what I’m doing, and it’s cumbersome.

Was hoping there might be some hidden ability in fields to force a write back.

Or if I could just iterate all the components, grab the path of the tag they’re referencing, grab the value, and do writes that way.

Hi Eric,

You could add a custom property like “TagPath” to each field. Use an indirect tag binding to use the “TagPath” property for binding a tag to a field.

In your Python script you could use container.getComponents() to get all the components in the container (filter to get only the fields you want) and write to the appropriate tags using the TagPath and value properties of the fields.

For example:

root = event.source.parent
for comp in root.getComponents():
	try:
		system.tag.write(comp.TagPath,comp.intValue)
	except AttributeError:
		pass

Best,