[Solved] Setting a Dialog Text Field Background Color

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Tom Sequitur
Posts: 14
Joined: Wed Feb 03, 2016 1:50 am

[Solved] Setting a Dialog Text Field Background Color

Post by Tom Sequitur »

According to the Basic Guide the a text object has the background color property:

"Model.BackgroundColor (long)" on page 225

Using MRI though, I don't see the BackgroundColor property. But I do see selected text and so I checked to make sure MRI was pointing to my text object by selecting "bite me" in the field and running MRI at runtime. MRI displays "bite me" under the properties tab.

I try to address the BackgroundColor tab at runtime and get property or method not found.

My code:

Code: Select all


otxtCitationTitle.Text = "" ' This is working
otxtCitationTitle.BackgroundColor = RGB(255, 0, 0) ' This is not
Last edited by Tom Sequitur on Wed Feb 10, 2016 7:42 pm, edited 1 time in total.
Tom Sequitur
OpenOffice 4.1.1 on LinuxMint 17.2
B Marcelly
Volunteer
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: Setting a Dialog Text Field Background Color

Post by B Marcelly »

Tom Sequitur wrote:According to the Basic Guide the a text object has the background color property:
"Model.BackgroundColor (long)" on page 225
Get the model of the control, from its view.
Bernard

OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
Tom Sequitur
Posts: 14
Joined: Wed Feb 03, 2016 1:50 am

Re: Setting a Dialog Text Field Background Color

Post by Tom Sequitur »

B Marcelly wrote:
Tom Sequitur wrote:According to the Basic Guide the a text object has the background color property:
"Model.BackgroundColor (long)" on page 225
Get the model of the control, from its view.
Ah, I conflated the instantiated object with the model of the object. I thought they were one in the same, but not so. Thanks.

My code works like now:

Code: Select all

otxtCitationTitle.Model.BackgroundColor = RGB(255, 0, 0)
Thanks a million! :bravo:
Tom Sequitur
OpenOffice 4.1.1 on LinuxMint 17.2
Post Reply