Hi Hussein, I've got setProperty working according to your recommendations.
> [1] Use latest version of XXE. Using. > [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 Console open. > [3] Carefully read the documentation. Documentation carefully read. > [4] Always use Esc X "command" to get acquainted with a command before > using it in a macro. Exc X used, command functionality confirmed. > 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"". "setProperty [implicitElement]visible no" run in command dialog, running "setProperty [implicitElement]visible" results in "Executed command returned "no"" in the status bar. All good. So, now I've created a command in my config file like so: <commandname="pmc.hideallnext"> <macrorepeatable="true"undoable="true"> <sequence> <commandname="selectNode"parameter="ancestorOrSelf[implicitElement]"/> <commandname="xpathSearch"parameter="%0"/> <commandname="setProperty"parameter="[rebuildView]visible no"></command> </sequence> </macro> </command> ? <commandname="pmc.showallnext"> <macrorepeatable="true"undoable="true"> <sequence> <commandname="selectNode"parameter="ancestorOrSelf[implicitElement]"/> <commandname="xpathSearch"parameter="%0"/> <commandname="setProperty"parameter="[rebuildView]visible yes"></command> </sequence> </macro> </command> ? The first command applies the hide value, the second command removes it. It works: I've run the command on my test file and then used Exc X "setProperty [implicitElement]visible" to confirm that the properties are set as expected. ? So, now I've created an entry in my CSS like so: ? *:property(prop|readOnly, "true"), *:property(prop|visible, "no"){background-color: red;content: "foo";} I developed my macro commands using the setReadOnly command, and I've confirmed that when I use my commands to flip the readOnly on?an element the expected happens: it's content is replaced with "foo" and it gets a red background. It does not, however, work with setProperty. To sum up 1. The "visible" property is being set successfully on the element. 2. The CSS is overlooking the definition for the visible property, even though it acknowledges the setting for the readOnly property. What am I doing wrong? Is this perhaps an issue with the namespace of the new property? Thanks, Jeff. ----- Original Message ---- > From: Hussein Shafie <hussein at xmlmind.com> > To: Jeff Hooker <jeff at itwriting.ca> > Cc: "xmleditor-support at xmlmind.com" <xmleditor-support at xmlmind.com> > Sent: Thursday, December 11, 2008 1:45:16 AM > Subject: Re: [XXE] Setting setReadOnly, setProperty, and CSS > > 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: > > > > > > > > > > > > > > > > > > > >? > > [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: > >? > > > > > > > > > > Using command "refresh" is not needed. Instead use the "rebuild" option > of "setProperty". See > http://www.xmlmind.com/xmleditor/_distrib/doc/commands/setProperty.html > > > > > > > > > > >? > > 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"".

