Friday, November 7, 2008

Curl with SQLite and style skins

Last night I was setting up a Curl 6.0 desktop application and in the course of editing my DCURL file realized that some of what I had to do for styling was not obvious.

For my own stuff, it is my habit to locate projects initially in a root folder for the Curl version, so the folder for this project was in my /Curl6 (later, what I keep can move into version control on a box of mine or on the web.)

Even then I have to remind myself that by Curl6, what I mean is Curl 6.0 (in this case 6.0.4+) because in the internal surge files you will see that curl6 is Curl 5.o and Curl 6.0 is curl7 ... but you only see that if you look into the Curl Surge install directories themselves.

So when I created the new project in the Curl IDE I chose to place a new folder in my /Curl6 and I was careful to select 6.0 as my version and to choose style sheets and to use the default.

So when my project opens in the Curl IDE, the start.dcurl file contains

{install-style-sheet
{manifest-url "file", "DEFAULT-STYLE-SHEET"}
}
Now you have to think. First, I have a folder in /Curl6 which I had renamed COM.CURL.GUI.STYLED from its original (which was tagged with versioning info) and it is the PCurl "deploy" version that came in the zip file from www.curl.com

But what I need is the default stylesheet from the styles package folder. I go copy that default-style.scurl into my new folder. Oh yes, I also go get the dss-defs.scurl file as well. Now I use the IDE's Project menu to add them to my project as file resources.

But I am not there yet. My new project's manifest does not yet have an entry for a resource which actually matches "DEFAULT-STYLE-SHEET"

What my new manifest must have is

{component file DEFAULT-STYLE-SHEET,
location = "default-style.scurl"
}
So in I click on my projetc's name in the project pane and edit the project's manifest to create that identifier. Think of it as a URI. Note that it is not quoted. It could have been any useful tag of my choosing, but they need to match so as to map URI to the resource as that location. This concept of resources is part of the great flecibility of developing and deploying Curl: you are not working directly with physical file includes as in a zipped java JAR file. And you are not having to use XML.

Now to think of what more is needed: I need to delegate to my CDK and to my STYLE packages.

Up on the Project menu there is an option to add delegates, so I add two of them by selecting the manifest.mcurl file found in the folder for the CDK for SQLite and the folder for styles and skins.

Those manifest entries are now

{delegate-to COM.CURL.CDK,
location = "../COM.CURL.CDK/manifest.mcurl"
}

{delegate-to COM.CURL.GUI.STYLED,
location = "../COM.CURL.GUI.STYLED/manifest.mcurl"
}
So what more could be needed? Ah, yes, import those packages into my new DCURL text file.

The first thing I did was to add || errors next

{import * from COM.CURL.CDK}
{import * from COM.CURL.GUI.STYLED} Oops! F5 key kicks up red error messages.

If I had clicked on the "delegate" icons that were added to my prject pane, I would have seen that those manifests contain such entries as
{component package COM.CURL.CDK.SQLITE,
location = "SQLITE/load.pcurl"
}
and

{component package COM.CURL.GUI.STYLED-CONTROLS,
location = "skinned-controls/load.pcurl"
}
so what I need to decalre as my imports in my start.dcurl are
{import * from COM.CURL.GUI.STYLED-CONTROLS}
{import * from COM.CURL.CDK.SQLITE}
Now a click on F5 to run my project and all is well.

Now to open Mike Gordon's Style Designer (itself a DCURL desktop app) and away I go ...

You might also want to look over the page at Curl on style sheets - if you click the button up right to "view as PDF" ypu can also save it as a PDF if that is your preference for handy docs.

Of course, docs are always online at developers.curl.com although my preference is to use bookmarks in the the Curl Documentation Viewer that comes with the IDE (and is itself a DCURL desktop application - and so can be opened more than once on your desktop.)

No comments: