comboBox

In the object model this is RibbonComboBox.
The value returned is the actual list value.
This is a combination of an editbox and a dropdown control. The edit box allows the user to enter a value. The dropdown allows the user to choose a value from a list.
cannot be contained within a buttonGroup
The values in the list can be specified at design time or dynamically at runtime
You can control the width of the edit box.
You can control the default text
You cannot control the width of the dropdown list.
The dropdown list can display a label, an image or both.
You can use the RibbonComboBoxItems collection to add,remove and modify items at runtime.


<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> 
  <ribbon startFromScratch="true">
    <tabs>
      <tab id="CustomTab" label="My Tab">
        <group id="Group1" label="MyGroup">
          <comboBox id="MyCombo"
                    label="Attributes"
                    sizeString="AAAAAAAAAAAAAAAAAA"
                    onChange="ComboBox_OnChange">
            <item id="Super" label="First" />
            <item id="Next" label="Second" />
            <item id="Last" label="Third" />
          </comboBox>
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

Attributes (properties)

enabled(Enabled) "true" | "false"
id 
idMso 
idQ 
image(Image)
imageMso(OfficeImageId)
insertAfterMso 
insertAfterQ 
insertBeforeMso 
insertBeforeQ 
invalidContentOnDrop 
item 
keytip(KeyTip)
label(Label)
maxLength(MaxLength) 1 to 1024 maximum length of entry
screentip(ScreenTip) "my screentip"
showImage(ShowImage) "true" | "false"
showItemImage(ShowItemImage) "true" | "false" whether the images are displayed
showLabel(ShowLabel) "true" | "false"
size"normal" | "large" (large is on 3 rows)
sizeString(SizeString) "AAAAAAAAAAAAAA"
supertip(SuperTip)
tag(Tag)
visible(Visible) "true" | "false"
 (GenerateMember)
 (ImageName)
 (Items)
 (Locked)
 (Modifiers)

Children

This control can contain the following controls

item 

C# Events (design-time)

The RibbonComboBox has a TextChanged event that is raised when the user changes the text in the edit box and the user exits the edit box by pressing the Enter key or changing the focus.
This event is also raised when the user selects a different value from the dropdown list.
The ItemsLoading event is raised before the dropdown list is displayed and allows you to change the list immediately before it is shown.


Callbacks (run-time)

onChangeComboBox_OnChange - In here we can InvalidateControl"combo") to rewrite and update the list of items
getEnabledComboBox_OnGetEnabled -
getImageComboBox_OnGetImage -
getImageMso 
getItemCountComboBox_OnGetItemCount -
getItemIDComboBox_OnGetItemID -
getItemImageComboBox_OnGetItemImage -
getItemLabelComboBox_OnGetItemLabel - Called multiple times to populate the list
getItemScreentipComboBox_OnGetItemScreentip -
getItemSupertipComboBox_OnGetItemSupertip -
getKeytipComboBox_OnGetKeytip -
getLabelComboBox_OnGetLabel -
getScreentipComboBox_OnGetScreenTip -
getShowImageComboBox_OnGetShowImage -
getShowLabelComboBox_OnGetShowLabel -
getSupertipComboBox_OnGetSupertip -
getTextComboBox_OnGetText -
getVisibleComboBox_OnGetVisible -

' VBA
Public Sub ComboBox_OnChange( _
   ByRef control As Office.IRibbonControl, _
   ByRef Text As Variant)

End Sub

' C# Equivalent
void ComboBox_OnChange(
   Office.IRibbonControl control,
   string text)
{
}

' VBA
Public Sub ComboBox_OnGetEnabled( _
   ByRef control As IRibbonControl, _
   ByRef Enabled As Variant)

End Sub

' C# Equivalent
bool ComboBox_OnGetEnabled(
   Office.IRibbonControl control)
{
}

' VBA
Public Sub ComboBox_OnGetItemCount( _
   ByRef control As Office.IRibbonControl, _
   ByRef Count As Variant)

End Sub

' C# Equivalent
public int ComboBox_OnGetItemCount(
   Office.IRibbonControl control)
{
}

' VBA
Public Sub ComboBox_OnGetItemImage( _
   ByRef control As Office.IRibbonControl,
   ByRef index As Integer, _
   ByRef ItemImage As Variant)

End Sub

' C# Equivalent
Bitmap ComboBox_OnGetItemImage(
   Office.IRibbonControl control,
   int itemIndex)
{
}

' VBA
Public Sub ComboBox_OnGetItemLabel( _
   ByRef control As Office.IRibbonControl, _
   ByRef index As Integer, _
   ByRef ItemLabel As Variant)

End Sub

' C# Equivalent
string ComboBox_OnGetItemLabel(
   Office.IRibbonControl control,
   int index)
{
}

' VBA
Public Sub ComboBox_OnGetText( _
   ByRef control As Office.IRibbonControl, _
   ByRef Text As Variant)

End Sub

' C# Equivalent
string ComboBox_OnGetText(
   Office.IRibbonControl control}
{
}


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext