CommandbarCombo box change event not firing in VISIO

P

Pavan

Hi
I'm creating a Toolbar in Visio with CommandbarCombo box using VS 2003.The
combobox should display the tooltip on change of each item in the list. I
have handled changeevent but still event is not fired.

Here is the code attached for the referecne:
********************************
CommandBar oStandardBar = null;
private Hashtable hashTable = new Hashtable();
public static int iPrgId = 0;
CommandBarComboBox cmbSecurityClass = null;
Object oMissing = System.Reflection.Missing.Value;
oStandardBar = (oVisio.ActiveDocument.Application.CommandBars as
CommandBars).Add("IAMToolbar", MsoBarPosition.msoBarTop, Type.Missing, true);
oStandardBar.Protection =
Microsoft.Office.Core.MsoBarProtection.msoBarNoResize
iPrgId++;
cmbSecurityClass =
(CommandBarComboBox)oStandardBar.Controls.Add(MsoControlType.msoControlDropdown, oMissing, oMissing, oMissing, true);
cmbSecurityClass.AddItem("One",oMissing );
cmbSecurityClass.AddItem("Two",oMissing );
cmbSecurityClass.AddItem("Three",oMissing );
cmbSecurityClass.Caption =
dsLabel.Tables["locStrings"].Rows[0]["secureity_class"].ToString();
cmbSecurityClass.Style = MsoComboStyle.msoComboLabel;
cmbSecurityClass.ListIndex = 0;
cmbSecurityClass.Tag = "cmbSecurityClass_Tag" + iPrgId.ToString();
cmbSecurityClass.Change += new
Microsoft.Office.Core._CommandBarComboBoxEvents_ChangeEventHandler(cmbSecurityClass_Change);
hashTable.Add(oStandardBar.GetHashCode(),oStandardBar);

// Change Event
private void cmbSecurityClass_Change(CommandBarComboBox ctrl)
{
if(ctrl.Text != "")
{
switch(ctrl.text)
{
case "One":
ctrl.TooltipText = "You have selected one";
break;
case "Two":
ctrtl.TooltipText = "You have selected two";
break;
default:
ctrl.TooltipText = "you have selected three";
break;
}
}
}

Any inputs on this is highly apprecaited.

Thanks in advance
Pavan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top