Please enable JavaScript to view this site.

DAQFactory User's Guide

Navigation: 7 Pages and Components > 7.4 Component Properties and Events

7.4.3 Presets

Scroll Prev Top Next More

 

In most applications you create you will likely want a consistent look to your pages.  To help with this DAQFactory includes Presets.  Presets are a brush, color, multicolor or similar attribute that is given a name.  You will then use that name in any component properties you wish to apply the preset and it will override the settings in the component and use the preset values.  You can then change the preset's properties and all components that use that preset will update.  

 

So, for example, if you want all your panels to have a light gray background you could create a brush preset called PanelBackground and give it the desired gray color.  Then, in your panel components you would specify your BackBrushPreset property as PanelBackground.  If you then change the color associated with the PanelBackground preset, all your panels will update.

 

There are currently five different types of presets: Brush, Color, TextFormat, MultiBrush and MultiColor.  The first three are pretty self explanatory and apply wherever those three properties are used in components.  If you specify a valid preset, the preset will be used instead of whatever brush, color or text format you specified for the component.

 

MultiBrush and MultiColor also apply wherever MultiBrush  and MultiColor are used.  When creating the Preset for these types, you will usually leave the Expression blank.  That will allow the expression in the component property to be used, either the one in the MultiBrush/Color or the overall MultiExpression property.  If you do specify an expression in the Preset, it will take precedence and will be used for all components.

 

Presets appear in a separate section of the Workspace.  The different types of presets have their own folder under PRESETS:.  To add a new preset, right click on the desired preset type and select Add Preset.  Once you have added presets, you can right click on it for various options such as renaming, duplicating, deleting or grouping.  Grouping of Presets works just like grouping of pages, and sequences.  Grouping is only for organization within the Workspace and does not affect how you access the presets elsewhere.

Script Access to Presets

 

You can also edit presets from script.  They will follow the pattern: Preset.Brush.MyBrush, so basically the word Preset, followed by the singular form of the preset type (i.e. brush not brushes) then the name of the preset.  Then you can access the normal properties of the preset type.  For example, to change the color our PanelBackground brush preset to red we can just do:

 

preset.brush.PanelBackground = rgb(255,0,0)