This is one of those things.
>> Download Demo Application
For some months now, I've wanted to look at possibilities of dynamic usage of CSS in the Notes Client. It is somewhat possible, but you have to close/reopen the document you're working on (+mess with SaveOptions), and you need a subform/stylesheet per state.
Unless someone finds out how to set the id of an element dynamically, this example, with one state per field will probably require too many design-elements to be put into a real-life system.
What I have to do for this demo, as previously stated, is to have one CSS-file/subform per field (since each field-focus is a different state) in the form. This because I only want to highlight the field when it has focus. To do this without a dynamic parent class or id, seems impossible.
Inline CSS for Notes WYSIWYG tables doesn't work. Putting a Pass-Through-HTML element around Notes WYSIWYG elemements doesn't work. With WYSIWYG, I mean Create->Field/Table/Button/etc.
It seems Notes first renders one, then the other. E.g. first render P-T-HTML, then WYSIWYG. This makes it impossible to wrap WYSIWYG elements with other elements with dynamic id's and classes.
My example:
The name-field has focus -> load css for field1 (computed subform containing resource=Environment( "fieldName" ).
Every CSS-file has this structure:
#nameOfField{
/* where #nameOfField is a TD that contains the input element */
background-color: #ffd;
/*
Strange that Notes has different shorthand order than the W3C spec.
Notes, border: color style width;
W3C, border: width style color;
*/
border: #555 solid 1px;
}
What I want:
field1 gets focus. Set environment variable. Containing element of a part of the form has computed "class=\"" + @Environment("name") + "\"".
In form:
<div class=<computed value>>
##WYSIWYG BLOCK##
</div>
In CSS:
.field1 #field1 {/* CSS for td containing field1, when it has focus */}
.field2 #field2 {/* CSS for td containing field2, when it has focus */}
With a dynamically named parent element, I should be able to put all CSS into one file.
If any of you find out more elegant ways of doing this particular functionality, please let me know.
Good CSS-in-Notes resource I stumbled upon (german):
Description of possibilities/limitations of CSS in the Notes-Client
Partially translated by Google (I don't speak german)
2 comments:
I did a similar technique except I put a highlighted border around the field and it's all done with LotusScript and @Formula language. I think CSS would be a better solution as then it would be configurable and not dependent upon the hard coded colors, etc. that the developer puts into the application. You can see my version of this at:
http://www.keithstric.com/A55BAC/keithstric.nsf/d6plinks/KSTD-72JRMJ
and here:
http://www.keithstric.com/A55BAC/keithstric.nsf/d6plinks/KSTD-72NHV8
Keith
Your technique is a lot better, since all you need is one form (and maybe a script-library for code-reuse).
As stated in the post, you need one CSS-file and one subform per state. In the demo, each field has it's own state (on Entering) -> A lot of design-elements!
CSS would be a better solution -if- you could have computed ids or classnames, and runtime redraw of the changes in the "structure" (now I have to close and reopen the document).
Post a Comment