AdxRibbonComboBox Get Selected Item

Add-in Express™ Support Service
That's what is more important than anything else

AdxRibbonComboBox Get Selected Item
AdxRibbonComboBox No OnSelect Event? 
C-MOTS




Posts: 13
Joined: 2014-07-29
vText := ((adxCMRibbon.Controls[1].AsRibbonGroup).Controls[1].AsRibbonComboBox).Text;
vIndex := ((adxCMRibbon.Controls[1].AsRibbonGroup).Controls[1].AsRibbonComboBox).Index;
vCode := ((adxCMRibbon.Controls[1].AsRibbonGroup).Controls[1].AsRibbonComboBox).Items.Items[vIndex].Id;
ShowMessage(vCode + '|' + vText);

Populated some items in the RibbonComboBox when select any item I get the Selected text correct, but the code which is stored in the id is not correct it gives me the first item code only

HOW to get the correct id of selected item?
Posted 02 Jan, 2015 05:55:09 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Hello,

You can intercept the OnChange event of the TadxRibbonComboBox component to find the item which is selected. Currently, your code retrieves the index of the combo box in the TadxRibbonGroup.Controls collection.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 05 Jan, 2015 05:09:09 Top
C-MOTS




Posts: 13
Joined: 2014-07-29
Hi Andrei,

My ComboBox ItemIndex issue got sorted out thanks.

Now I am adding a CommandBar to support the Lower version of Excel.
Added a TAdxCommandBarComboBox and a CommandBarButton.

1) When I type in the ComboBox and Click anywhere the typed text gets disappeared. Only when I type anything and press enter key the text remains and then I am populating the COmbo BOx at runtime.
I want the typed text to be retained even when the focus gets changed from Combo Box.

2) Even when I close excel and re-open it the Combo Box items remains. How to avoid this?

3) How to Adjust the width of the ComboBox its not having the sizeString property.

Regards,
Nadesh Thevar
Posted 06 Jan, 2015 05:04:33 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Hello Nadesh,

#1. This is how commandbar controls work; this cannot be fixed. You and your users need to press {Enter} after you enter something to the combo box.
#2. Try using Temporary=true on the commandbar
#3. There's no sizeString property. What you have is the TadxCommandBarCombobox.Width property.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 06 Jan, 2015 08:37:25 Top
C-MOTS




Posts: 13
Joined: 2014-07-29
Thanks Andrei.

Is there any way that I can intercept OnKeyPressEvent of ComboBox?
So that I can populate the ComboBox on Enter Key.

Regards,
Nadesh Thevar
Posted 06 Jan, 2015 23:47:43 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Hello Nadesh,

No such way exists; the CommandBar system doesn't provide many, many simple features.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 08 Jan, 2015 06:37:08 Top