Help!

Setting a default value for a RibbonX ComboBox item


Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Program Add-Ins RSS
Next:  How to monitor deleted calendar events?  
Author Message
Rajesh K
External


Since: Jul 27, 2007
Posts: 6



PostPosted: Fri Jul 27, 2007 5:26 pm    Post subject: Setting a default value for a RibbonX ComboBox item
Archived from groups: microsoft>public>outlook>program_addins (more info?)

I was wondering how the default value of an item in a combBox is set in the
RibbonX world. This used to be ListIndex in the older CommandBar model and I
used to set it to 1 (for example) after doing AddItems.

I used OutlookRibbonXVB_VSTO as a starting point and have the following XML
for the ribbon:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
onLoad="Ribbon_OnLoad">
<ribbon>
<tabs>
<tab idMso="TabNewMailMessage">
<group id="MyWidgetsGroup"
getVisible="MyWidgetsGroup_GetVisible"
getLabel="MyWidgetsGroup_GetLabel"
insertBeforeMso="GroupClipboard" >

<comboBox
id="MyCombo"
label="My Combo"
onChange ="MyCombo_OnChange"
getItemCount ="MyCombo_GetItemCount"
getItemLabel ="MyCombo_GetItemLabel"

/>
{etc. for brevity}

The MyCombo_GetItemCount returns 4 and MyCombo_GetItemLabel returns the
strings
"A", "B", "C", and "D" for index values of 0, 1, 2,and 3 respectively.

When I display the new inspector, all the items are there when I pull down
the comboBox but the initial value is blank.

I am missing some connection somewhere between the object model and the XML
and can't seem to figure out the connection. Or there is a simple callback
somewhere I am missing.

Hope someone can help.
Back to top
Patrick Schmid [MVP]
External


Since: Oct 16, 2006
Posts: 725



PostPosted: Mon Jul 30, 2007 8:29 pm    Post subject: Re: Setting a default value for a RibbonX ComboBox item [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Let me start off with something else: If you want to limit your users to
choices only in the list, then use a dropDown, not a comboBox. For the
dropDown, I think it is getSelectedItemID or getSelectedItemIndex.
The comboBox has a getText callback. Use that callback to return the
string that you want it to show.


Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Outlook 2007 Performance Update: http://pschmid.net/blog/2007/04/13/105
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://ribboncustomizer.com
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed




"Rajesh K" <RajeshK.TakeThisOut@discussions.microsoft.com> wrote in message
news:6840AD40-011A-49D1-9ECD-728549B1FF42@microsoft.com:

> I was wondering how the default value of an item in a combBox is set in the
> RibbonX world. This used to be ListIndex in the older CommandBar model and I
> used to set it to 1 (for example) after doing AddItems.
>
> I used OutlookRibbonXVB_VSTO as a starting point and have the following XML
> for the ribbon:
> <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
> onLoad="Ribbon_OnLoad">
> <ribbon>
> <tabs>
> <tab idMso="TabNewMailMessage">
> <group id="MyWidgetsGroup"
> getVisible="MyWidgetsGroup_GetVisible"
> getLabel="MyWidgetsGroup_GetLabel"
> insertBeforeMso="GroupClipboard" >
>
> <comboBox
> id="MyCombo"
> label="My Combo"
> onChange ="MyCombo_OnChange"
> getItemCount ="MyCombo_GetItemCount"
> getItemLabel ="MyCombo_GetItemLabel"
>
> />
> {etc. for brevity}
>
> The MyCombo_GetItemCount returns 4 and MyCombo_GetItemLabel returns the
> strings
> "A", "B", "C", and "D" for index values of 0, 1, 2,and 3 respectively.
>
> When I display the new inspector, all the items are there when I pull down
> the comboBox but the initial value is blank.
>
> I am missing some connection somewhere between the object model and the XML
> and can't seem to figure out the connection. Or there is a simple callback
> somewhere I am missing.
>
> Hope someone can help.
Back to top
Rajesh K
External


Since: Jul 27, 2007
Posts: 6



PostPosted: Mon Jul 30, 2007 10:36 pm    Post subject: Re: Setting a default value for a RibbonX ComboBox item [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Works. Thank you. Thanks for also providing the dropDown information. I
could never have guessed the functionality based on their names or their
documentation. It is clear now.

-- R

"Patrick Schmid [MVP]" wrote:

> Let me start off with something else: If you want to limit your users to
> choices only in the list, then use a dropDown, not a comboBox. For the
> dropDown, I think it is getSelectedItemID or getSelectedItemIndex.
> The comboBox has a getText callback. Use that callback to return the
> string that you want it to show.
>
>
> Patrick Schmid [OneNote MVP]
> --------------
> http://pschmid.net
> ***
> Outlook 2007 Performance Update: http://pschmid.net/blog/2007/04/13/105
> Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
> ***
> Customize Office 2007: http://pschmid.net/office2007/customize
> RibbonCustomizer Add-In: http://ribboncustomizer.com
> OneNote 2007: http://pschmid.net/office2007/onenote
> ***
> Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
>
>
>
>
> "Rajesh K" <RajeshK DeleteThis @discussions.microsoft.com> wrote in message
> news:6840AD40-011A-49D1-9ECD-728549B1FF42@microsoft.com:
>
> > I was wondering how the default value of an item in a combBox is set in the
> > RibbonX world. This used to be ListIndex in the older CommandBar model and I
> > used to set it to 1 (for example) after doing AddItems.
> >
> > I used OutlookRibbonXVB_VSTO as a starting point and have the following XML
> > for the ribbon:
> > <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
> > onLoad="Ribbon_OnLoad">
> > <ribbon>
> > <tabs>
> > <tab idMso="TabNewMailMessage">
> > <group id="MyWidgetsGroup"
> > getVisible="MyWidgetsGroup_GetVisible"
> > getLabel="MyWidgetsGroup_GetLabel"
> > insertBeforeMso="GroupClipboard" >
> >
> > <comboBox
> > id="MyCombo"
> > label="My Combo"
> > onChange ="MyCombo_OnChange"
> > getItemCount ="MyCombo_GetItemCount"
> > getItemLabel ="MyCombo_GetItemLabel"
> >
> > />
> > {etc. for brevity}
> >
> > The MyCombo_GetItemCount returns 4 and MyCombo_GetItemLabel returns the
> > strings
> > "A", "B", "C", and "D" for index values of 0, 1, 2,and 3 respectively.
> >
> > When I display the new inspector, all the items are there when I pull down
> > the comboBox but the initial value is blank.
> >
> > I am missing some connection somewhere between the object model and the XML
> > and can't seem to figure out the connection. Or there is a simple callback
> > somewhere I am missing.
> >
> > Hope someone can help.
>
>
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Program Add-Ins All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum