Quickly update styles in designer

  • 27 August 2020
  • 1 reply
  • 0 views

Userlevel 3
Badge +5
Have you ever had to change a bunch of styles on a view to the same thing? Here's a quick way.

Select a control in the designer, press F12 to open Dev Tools and paste this
 
$sn(SourceCode.Forms.Designers.View.controlPropertiesXML,`//Control[@ID='${SourceCode.Forms.Designers.View.selectedObject.attr("id")}']/Styles`)
 
It will return something like this. Find the property you want and work out it's parent nodes.

<Styles>
    <Style IsDefault="True">
        <BackgroundColor>#00427c</BackgroundColor>
        <Font>
            <Size>10pt</Size>
            <Color>#ffffff</Color>
            <Style>normal</Style>
            <Weight>bold</Weight>
        </Font>
    </Style>
</Styles>
 
For the Background Color the parent nodes are /Style/BackgroundColor

To change the Background Color

$sn(SourceCode.Forms.Designers.View.controlPropertiesXML,`//Control[@ID='${SourceCode.Forms.Designers.View.selectedObject.attr("id")}']/Styles/Style/BackgroundColor`).innerHTML="#00427c"
 
Hit Enter and the control is updated. You won't see the changes unless you open the style dialog but if you save, the updated styles are saved. Now, click another control in the designer, up arrow in Dev Tools and hit Enter to update it too.

I haven't worked out how to refresh the control after the change but at least you can save the changes. :) Of course this is highly likely to destroy your view in a firey blaze of useless XML, so have a Cancel Checkout ready.
 
Maybe hit the Kudos if this helps.

1 reply

Hi NigelStratton,


 


Thank you for sharing this information with the community!


 


Kent

Reply