Michael Santy wrote:
> 
> We've created custom dialogs to manage a lot of the more complex XML
> (mainly document level metadata) in our schema, and to simplify the
> editor have hidden those elements from the user.  In terms of usability,
> this strategy has worked great.  
> 
> However, we've recently noticed that a user can move the cursor inside
> of these hidden elements with the arrow keys.  This poses a number of
> problems for us.

The commands bound to Tab, Shift-Tab, Up and Down Arrow automatically 
skip hidden elements.

For performance and complexity reasons, this is not the case for the 
commands bound to Left Arrow, Down Arrow, Ctrl-Left-Arrow, etc, (but 
also Delete and BackSpace for some caret positions).

This is a limitation we do not intend to remove in the near future.



> Is there any way to prevent the cursor from being moved inside of a
> element with "display=none" or whose parents have this attribute set?
> Even better yet, is there a way for the cursor to skip to the text node
> of the next or previous displayed element?
> 

Yes, but you need to replace the MoveDotTo command by an enhanced 
version of your own. 
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmledit/command/MoveDotTo.html

The DocumentView class has a number of methods which can help you 
implementing an enhanced MoveDotTo command:

* java.awt.Rectangle modelToView(TextNode text, int offset)
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmledit/view/DocumentView.html#modelToView(com.xmlmind.xmledit.doc.TextNode,%20int)

* boolean ensureDotIsVisible()
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmledit/view/DocumentView.html#ensureDotIsVisible()

* etc.

However such programming task is not an easy one and I would not 
recommend to attempt doing it.

I would recommend to

[1] Do not to use hidden elements. Instead use collapsible elements, 
which initially are displayed collapsed.
See 
http://www.xmlmind.com/xmleditor/_distrib/doc/csssupport/collapsible_blocks.html

The difference with hidden elements is subtle: unlike hidden elements, 
collapsed elements are a signal sent to the user meaning: we are really 
here but we don't want to bother you.

[2] If this not possible, teach your users to live with the limitation.

Note that the caret does not really disappear: when it is contained in a 
hidden element, it is displayed as a blinking red triangle found at the 
top/left of the first visible ancestor of the node containing the caret.












Reply via email to