Writer: Change backgroundcolor via form control > option button

Hello

I created a template in writer and I have several option buttons in this template. Below these buttons I have a textbox. I was wondering if it were possible to change the background color of this textbox depending on which option button is selected?

Thank you in advance for taking the time to try and help me.

Kind regards

Example

Hello @bone, yes this is certainly possible in more than one way, but i’m not sure which kind of textbox you have. Please upload a sample of your file, so we can get a better idea of what you want, and give a more specific answer.

Hello @librebel, thank you for the reply. I added and example as requested. What I want to accomplish is that the backgroundcolor of the textbox changes to the background color of the option button.

Yw @bone, If you connect the following macro to the “Execute Action” event of both the Option buttons, then the Textbox will get the same background color as the option button that is selected.

Sub Option_Clicked( oEvent )
	Dim oTextBox, oModel
	oModel = oEvent.Source.Model
	oTextBox = oModel.Parent.getByName( "Text Box 1" )
	oTextBox.BackgroundColor = oModel.BackgroundColor
	ThisComponent.CurrentController.getControl( oTextBox ).setFocus()
End Sub

This is your file back with the code added already in it.