Jeff Hooker wrote: > > I'm experimenting with the setReadOnly and setProperty commands and how they > interact with CSS and I have some questions. >
Before writing a macro-command, please test setReadOnly and setProperty interactively using menu item "Tools|Execute Command" (shortcut Esc X) > First, I've created a setReadOnly macro like so: > > <commandname="setReadOnlyValue"> > <macro> > <sequence> > <commandname="setReadOnly"parameter="[implicitElement]true"></command> > <commandname="rebuild"parameter="[implicitElement]"></command> > </sequence> > </macro> > </command> > [a] There is no "rebuild" command. It is command "refresh" with option "rebuild". See http://www.xmlmind.com/xmleditor/_distrib/doc/commands/refresh.html [b] Command "refresh" is not needed because "setReadOnly" automatically does the job. Please use Esc X "setReadOnly [implicitElement]toggle" to check this by yourself. http://www.xmlmind.com/xmleditor/_distrib/doc/commands/setReadOnly.html > and I access it via a button bar button. It works; I can toggle an element > between read-only and read-write by using this command and another that sets > the value to "false". I can't however, make the CSS tie in with any > reliablity. I've added this to the CSS sheet in use: > @namespace prop http://www.xmlmind.com/xmleditor/namespace/property; > > *:property(prop|readOnly, "true") { > background-color: #E0F0F0;} > *:property(prop|readOnly, "false") { > background-color: normal;} > These rules are already contained in the built-in CSS. No need to specify them. Built-in CSS attached to this email. > and it seems to have no effect...most of the time. It will occasionally work, > and then not work again while I swap "rebuild" for "refresh" back and forth > and try to figure out why it worked in the first place. I'm stumped. I'm > making very, very small changes, testing after every change, but can't seem > to find the secret sauce. Three times now I've got it working, created a > backup copy of my work, then tried to break the working copy. I break it, > can't fix it, roll back to the backup copy, which now refuses to work. It's a > little perplexing. > When I use Esc X "setReadOnly ...", it always works as expected. > So that's part 1: what am I doing wrong with the CSS/Command combo? > > Part 2 involves the setProperty command, which I can't really test until I > have the CSS working, since I have no way of knowing if the command is > working unless I can reflect it in the content's presentation. I've > interpreted the setProperty command in the Commands pdf like so: > > <commandname="setInvisibleValue"> > <macro> > <sequence> > <commandname="setProperty"parameter="[implicitElement]visible no"/> > <commandname="refresh"parameter="[implicitElement]"></command> Using command "refresh" is not needed. Instead use the "rebuild" option of "setProperty". See http://www.xmlmind.com/xmleditor/_distrib/doc/commands/setProperty.html > </sequence> > </macro> > </command> > > should this create a property on the current element called "visible" and set > it's value to "no"? I'm not sure if I need to create the property before > assigning a value to it, or if the creation and assignment are one. > "setProperty [implicitElement]visible no" creates property "visible" if it does not exist and at the same time sets it to "no". And if it already exists, it changes its value to "no". You should not have any problem with all this. All these commands are straightforward and easy to use. However, in order to minimize your problems, please follow these recommendations: [1] Use latest version of XXE. [2] Open a console to see possible error messages (i.e. Exception stack traces). See http://www.xmlmind.com/xmleditor/faq.html#display_exception_in_console [3] Carefully read the documentation. [4] Always use Esc X "command" to get acquainted with a command before using it in a macro. For example, if you want to check whether setProperty actually works: [a] Esc X "setProperty [implicitElement]visible no" [b] Esc X "setProperty [implicitElement]visible" and look at the status bar. You'll see "Executed command returned "no"". -------------- next part -------------- A non-text attachment was scrubbed... Name: builtin.css Type: text/css Size: 2312 bytes Desc: not available Url : http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20081211/c2020877/attachment.css

