Xojo Background HTML Named Color Styles Generated from FileMaker
Sep 28, 2015 08:11 PM
Xojo WebStyles
Xojo Styles are VERY powerful. Specifically, we're using Xojo WebStyles for our Web Apps. You can define just about everything you need. Below you can see a Style that defines that the background for the color '6495EDFF' which is also known as 'Blue Cornflower' as an Official HTML Named Color.
Xojo Project File Format
Xojo has three file formats: 'Project', 'Binary', and 'XML'. The 'Project' type saves each object as little text files which makes it perfect if you use a version control system like GitHub. Since everything is a little text file, you can modify or even create new files, you just need to be incredibly precise. Normally you wouldn't touch these files as the Xojo IDE manages everything for you.
It's a bit like modifiying the FIleMaker clipboard using a plugin like 2EmpowerFM Clipboard Explorer. Our FMClips utility for FIleMaker takes advantage of this so we can have FileMaker write FileMaker scripts for us. It turns out we can do something similar in Xojo.
This is what a Xojo WebStyle looks like for 'Blue Cornflower'.
#tag WebStyle
WebStyle StyleBackgroundBlueCornflower
Inherits WebStyle
#tag WebStyleStateGroup
misc-background=solid 6495EDFF
#tag EndWebStyleStateGroup
#tag WebStyleStateGroup
#tag EndWebStyleStateGroup
#tag WebStyleStateGroup
#tag EndWebStyleStateGroup
#tag WebStyleStateGroup
#tag EndWebStyleStateGroup
End WebStyle StyleBackgroundBlueCornflower
#tag EndWebStyle
FileMaker Object Generator for Xojo
We wanted to have all the named colors in our Xojo project so folks that use the Xojo Web App can easily choose their own colors. So we wrote a FileMaker script to export one text file for each color record, totaling 145 text files using the fantastic BaseElments FileMaker Plugin from Goya. The 'BE_WriteTextToFile' script step will let you write text out to a file with ease. After the script ran, we just dragged those files into our Xojo Project:
Download the Xojo Binary Project
Download the project: XojoNamedColorsStyles.xojo_binary_project.zip
Once the Styles are in your Xojo Project you can easily assign that color to an object like a WebPage with the Style Property or with one line of Xojo code:
WebPage.Style = StyleBackgroundBlueCornflower
Using techniques like this help to make software for our clients much faster!