Page 1 of 1

Show action buttons only when valid

Posted: Sat Aug 31, 2013 7:52 am
by yann1806
Hi guys,

I'm wondering if there is a way to make toolbar buttons active only when the action they represent is valid based on the XSD?

For example in Author mode, the completion menu that comes with an "Enter" keypress shows only the tags that are valid to be inserted at the current location. If my action is just inserting a tag, is there a simple way to make its toolbar button active/inactive the same way, i.e. based on the existing XSD only, without writing extra Xpath conditions?

Thanks!

Yann

Re: Show action buttons only when valid

Posted: Mon Sep 02, 2013 10:01 am
by alex_jitianu
Hello Yann,

As you already discovered each action has some XPath conditions that control whether it's active or not in a given context. Right now the only solution for your use case is writing XPath expressions to identify each context where the action is active.

In the next version of Oxygen (15.1) which will be released in 1 or 2 months, you will be able to use in these XPath expressions a new function: oxy_allows-child-element(). This function basically checks the schema constraints so an action will only be active if an element is allowed in that context.

Best regards,
Alex

Re: Show action buttons only when valid

Posted: Mon Sep 02, 2013 11:03 am
by yann1806
Thanks for the clear response Alex, appreciated.

Yann
alex_jitianu wrote:Hello Yann,

As you already discovered each action has some XPath conditions that control whether it's active or not in a given context. Right now the only solution for your use case is writing XPath expressions to identify each context where the action is active.

In the next version of Oxygen (15.1) which will be released in 1 or 2 months, you will be able to use in these XPath expressions a new function: oxy_allows-child-element(). This function basically checks the schema constraints so an action will only be active if an element is allowed in that context.

Best regards,
Alex

Re: Show action buttons only when valid

Posted: Wed Oct 23, 2013 11:59 am
by Radu
Hi,

As Alex said we added in Oxygen 15.1 that extension XPath function:

http://www.oxygenxml.com/doc/ug-oxygen/ ... ement.html

Regards,
Radu