I've been trying to change the background color of a text box on a form using BASIC code. Specifically, I wish to write a macro which will be assigned to the "Got Focus" event that will change the background color, and a separate one that will change it back when focus is lost. Unlike the MS product, recording a macro while I do it manually doesn't get the job done ... it only seems to recognize opening / closing the required dialogue boxes. Further, it doesn't give me any clue how to access controls on the form.
Anyone have an idea?
I'm running OpenOffice 2.0 on Linux (Xandros / Demian) OS
Thanks
accessing text box properties from BASIC
-
- Posts: 25
- Joined: Thu Dec 06, 2007 1:17 pm
Re: accessing text box properties from BASIC
This is 2.3.1 code but have a go anyway. Put these in a form module and set the receiving focus and losing focus events (in the control properties of the listbox) to these macros. Its a bit crude, no doubt but I've got them to work.
Code: Select all
Sub ChangeColour(event as Object)
Dim Form As Object, lstMonths As Object
Form=Event.Source.Model.Parent REM CODE BOUND TO FORM BUTTON
lstMonths = Form.getByName("lstMonths")
lstMonths.BackgroundColor = "50000"
End Sub
Sub ChangeColourBack(event as Object)
Dim Form As Object, lstMonths As Object
Form=Event.Source.Model.Parent REM CODE BOUND TO FORM BUTTON
lstMonths = Form.getByName("lstMonths")
tempColor = lstMonths.BackgroundColor
lstMonths.BackgroundColor = "255"
End Sub