Ask Your Question
1

Writer: Change backgroundcolor via form control > option button

asked 2017-05-19 09:59:56 +0100

bone gravatar image

updated 2017-05-19 10:50:13 +0100

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

edit retag flag offensive close merge delete

Comments

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.

librebel gravatar imagelibrebel ( 2017-05-19 10:24:14 +0100 )edit

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.

bone gravatar imagebone ( 2017-05-19 10:53:36 +0100 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2017-05-19 11:51:26 +0100

librebel gravatar image

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.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-05-19 09:59:56 +0100

Seen: 152 times

Last updated: May 19 '17