Page 1 of 1

[Solved] Draw layer name color

Posted: Mon Jun 27, 2016 6:50 am
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

Re: Draw layer name color

Posted: Mon Jun 27, 2016 7:45 am
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.)

Re: Draw layer name color

Posted: Mon Jun 27, 2016 8:11 am
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

Re: Draw layer name color

Posted: Mon Jun 27, 2016 8:36 am
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.

Re: Draw layer name color

Posted: Mon Jun 27, 2016 2:03 pm
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

Re: Draw layer name color

Posted: Mon Jun 27, 2016 3:30 pm
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

Re: Draw layer name color

Posted: Mon Jun 27, 2016 5:05 pm
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