I've made a custom control that behaves like Bold Italic and Underline. The only thing I need is to make the UI change wenever focussed.
I have the following setup in the "_toolbartemplate.xml":
- <image jsml-class="item_{toolbar}_{skin}_{color}_smallcaps" jsml-base="image_{skin}_{color}" command="Smallcaps" tooltip="@INSERTSMALLCAPS" imagename="Office2013/SmallCaps" vertical_align="middle" horizontal_align="center">
-
- <attach name="update_statusui">
- <![CDATA[
- var editor = self.find_editor();
- var nodes = editor.ExtractRangeNodes(false);
- var pointnode = editor.GetPointNode();
- if (pointnode == null)
- return;
- if (nodes.length == 0 && pointnode.GetParent().GetName().toString().toLowerCase() != "#text") {
- var root = pointnode.GetParent();
- }
- else {
- var root = pointnode;
- }
- if (!root.Contains(nodes[0]))
- root = root.GetParent();
-
- if (!! root && root.GetName().toString().toLowerCase() == "smallcaps") {
- self.set_checked(true);
- }
- else if (!! nodes[0] && nodes[0].GetName().toString().toLowerCase() == "smallcaps") {
- self.set_checked(true);
- }
- else {
- self.set_checked(false);
- }
- ]]>
- </attach>
- </image>
The only problem is that the "update_statusui" method doesn't seem to be called on focus but only on select.
Is there another methodname for this or do I have to do this myself on focus?
With kind regards,
Marvin Brouwer.