update stausUI

Last post 01-14-2014, 5:41 AM by marvin. 0 replies.
Sort Posts: Previous Next
  •  01-14-2014, 5:41 AM 78756

    update stausUI

    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":
    1. <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">  
    2.   
    3.    <attach name="update_statusui">  
    4.      <![CDATA[ 
    5.       var editor = self.find_editor(); 
    6.       var nodes = editor.ExtractRangeNodes(false); 
    7.       var pointnode = editor.GetPointNode(); 
    8.       if (pointnode == null) 
    9.           return; 
    10.       if (nodes.length == 0 && pointnode.GetParent().GetName().toString().toLowerCase() != "#text") { 
    11.           var root = pointnode.GetParent(); 
    12.       } 
    13.       else { 
    14.           var root = pointnode; 
    15.       } 
    16.       if (!root.Contains(nodes[0])) 
    17.           root = root.GetParent(); 
    18.         
    19.       if (!! root && root.GetName().toString().toLowerCase() == "smallcaps") { 
    20.           self.set_checked(true); 
    21.       } 
    22.       else if (!! nodes[0] && nodes[0].GetName().toString().toLowerCase() == "smallcaps") { 
    23.           self.set_checked(true); 
    24.       } 
    25.       else { 
    26.           self.set_checked(false); 
    27.       } 
    28.         ]]>  
    29.    </attach>  
    30.  </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. 

View as RSS news feed in XML