< Back to Snippets

Add a new toolbar

Add two pages of comparison operator toolbar to the long-press of 9 in scientific mode.


<root>
  ...
  <layout ...>
    <foldaway ID="ToolbarFoldaway" ...>
      ...
      <panel ID="ScientificToolbars" ...>
        ...
        <!-- Add the comparison toolbar pages -->
        <array ID="compPg1" alignment="horizontal" style="ToolbarButtonStyle1">
          <button label="=" action="MathEquals.Action"/>
          <button label="&ne;" action="MathNotEqual.Action"/>
          <button label="&lt;" action="MathLessThan.Action" longPressAction="MathLessThanEqual.Action" pageFoldover="true"/>
          <button label="&gt;" action="MathGreaterThan.Action" longPressAction="MathGreaterThanEqual.Action" pageFoldover="true"/>
          <button label="Pg 1/2 &#x25B7;" activatePane="compPg2" onPanel="ScientificToolbars" style="ToolbarButtonStyle1NI"/>
        </array>
        <array ID="compPg2" alignment="horizontal" style="ToolbarButtonStyle1">
          <button label="if" action="MathIf.Action"/>
          <button label="and" action="MathAnd.Action"/>
          <button label="or" action="MathOr.Action"/>
          <button label="not" action="MathNot.Action"/>
          <button label="&#x25C1; Pg 2/2" activatePane="compPg1" onPanel="ScientificToolbars" style="ToolbarButtonStyle1NI"/>
        </array>
        ...
      </panel>
      ...
    </foldaway>
    ...
    <foldaway ID="StaticButtons" ...>
      <array ID="ScientificStaticButtons" ...>
        ...
        <!-- Add an ID to the 9 button so we can reference it in behavior -->
        <button ID="sDigit9" label="9" action="StackBox.Digit9"/>
        ...
      </array>
    </foldaway>
    ...
  </layout>
  ...
  <behavior>
    ...
    <!-- When the 9 button is long-pressed, show the comparison toolbar -->
    <button ref="sDigit9" event="longPress">
      <panel ref="ScientificToolbars" pane="compPg1"/>
    </button>
    ...
  </behavior>
  ...
</root>