How to get a editBox value?

Jul 18, 2011 at 2:02 PM

Hello,

          I have read the word COMAddinRibbonExample and add two editBoxes to RibbonUI.xml ,but i can not find any way to get a editBox value?

         Could you tell me how to get editBox's value?

          <?xml version="1.0" encoding="utf-8" ?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" >
  <ribbon>
    <tabs>
      <tab id="myTab" label="C# RibbonAddin Example" >
        <group id="group1" label="Example">
          <button id="customButton1" label="Perference" imageMso="HappyFace" size="large" onAction="OnAction" />
          <button id="customButton2" label="About iFax" imageMso="HappyFace" size="large" onAction="OnAction" />
        </group>
     <group id="group2" label="Example2">
          <editBox id="editBox1" label="Number1:"/>
          <editBox id="editBox2" label="Number2:"/>
         <button id="customButton3" label="" imageMso="HappyFace" size="large" onAction="Sum" />
       
        </group>
     
     
      </tab>
    </tabs>
  </ribbon>
</customUI>

Coordinator
Jul 18, 2011 at 4:35 PM

A little (bit more) about Ribbons
http://msdn.microsoft.com/en-us/library/aa338202%28v=office.12%29.aspx

You see here as example:

<editBox id="EditBox1" getText="ThisDocument.MyTextMacro"
            label="My EditBox" onChange="ThisDocument.MyEditBoxMacro"/>

getText means a public function similar to OnAction in your addin looks as follows

public string GetText(IRibbonControl control)
{
    return control.Id;
}

Attribute Text maybe also supported to support text set without function call, i dont know.

 

sebastian