[Solved] Draw layer name color

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Locked
clag
Posts: 79
Joined: Thu Apr 23, 2015 8:12 pm

[Solved] Draw layer name color

Post by clag »

Hello to all,

in draw I want set the color of the layer-name or the background color of the tab
like it is happens when the layer is set on not visible, then the the name color turns from black to blue

My wish is to lock, unlock the active layer with a macro and also set the color of the layer name to red if the layer is locked.
I am able to lock the layer but I don't find/ see in XRAY/MRI a way to set the color.

Is someone out there, who can tell me how I can set the color or background color of the layer name?

thank you ahead
Last edited by MrProgrammer on Wed Nov 05, 2025 10:01 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved]; Lock ancient topic
Apache OpenOffice 4.1.16 on Win 10
User avatar
Zizi64
Volunteer
Posts: 11511
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Draw layer name color

Post by Zizi64 »

I don't find/ see in XRAY/MRI a way to set the color.
I suppose it means: there is not any way, there is not public property or method for this. (Except: You modify the source code of the Apache OpenOffice or the LibreOffice, because AOO/LO are open source office suites.)
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
clag
Posts: 79
Joined: Thu Apr 23, 2015 8:12 pm

Re: Draw layer name color

Post by clag »

Hello Zizi64,

thanks for the fast reply, my own knowledge in basic is not so deep
and you suppose or are you sure ?

for my using of MRI XRAY, I will quote a stanza from 3 DOORS DOWN

"Somewhere in this darkness
There's a light that I can't find
Maybe it's too far away...
Or maybe I'm just blind..."

so I still can hope !?

greets
Apache OpenOffice 4.1.16 on Win 10
User avatar
Zizi64
Volunteer
Posts: 11511
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Draw layer name color

Post by Zizi64 »

and you suppose or are you sure ?
Please upload your StarBasic code with the XRAY calling. (Or an example .odg file with the embedded macro code.) Then we will see, how you used and examined that Layer Object.
Last edited by Zizi64 on Mon Jun 27, 2016 3:05 pm, edited 1 time in total.
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
clag
Posts: 79
Joined: Thu Apr 23, 2015 8:12 pm

Re: Draw layer name color

Post by clag »

Hallo Zizi64 and all others too,

here is my draw test file, to lock/ unlock, hide / show the layer works well,
it would be great to find a way to format additional the layers name in red if the layer is locked.
DrawLayerToggleVisible_2.odg
(15.18 KiB) Downloaded 316 times
thanks ahead
Apache OpenOffice 4.1.16 on Win 10
User avatar
Zizi64
Volunteer
Posts: 11511
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Draw layer name color

Post by Zizi64 »

Just a tip:

If it is not possible to colorize the tabs, then you can use a different marking method.
Use the Title property for storage a variable. Set same string (manually or by a macro) for "Title" property as the "Name" of the layer, and then use this code:

Code: Select all

oLayer.IsLocked = Not oLayer.IsLocked
If oLayer.IsLocked then 
		oLayer.Name = oLayer.Title +" [#]"
else
 		oLayer.Name = oLayer.Title +" [~]"
end if
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
clag
Posts: 79
Joined: Thu Apr 23, 2015 8:12 pm

Re: Draw layer name color

Post by clag »

Hallo Zizi64,

thanks, your idea is not so bad ;), so I adapt it
I change little the way, how to manipulate the layer name from Layer to #Layer# and back

Code: Select all

	If oLayer.IsLocked then
		oLayer.Name = "#" & oLayer.Name & "#"
	ElseIf Left(oLayer.Name,1) = "#" and Right(oLayer.Name,1) = "#" Then 
		oLayer.Name = Mid(oLayer.Name,2, Len(oLayer.Name)-2)
	End If
but if anyone know or find a way to set the color for the layer name please let me know it too

again thanks to all
Apache OpenOffice 4.1.16 on Win 10
Locked