/// <summary> /// Handle the Button Click event. /// </summary> /// <param name="something">The button that was clicked.</param> /// <param name="args">Unused event arguments.</param> private void OnClick(object something, System.EventArgs args) { ButtonItem item = (ButtonItem)something; ChoiceBase control = (ChoiceBase)item.Tag; Debug.Assert(control != null); control.OnClick(item, null); }
/// <summary> /// Handles the AfterSelect event of the tree view. /// </summary> /// <param name="sender">(Not used.)</param> /// <param name="arguments">Gets the node that was selected.</param> protected void OnTreeNodeSelected(object sender, TreeViewEventArgs arguments) { ChoiceBase control = null; if (arguments.Node.Tag is ChoiceGroup) { control = ((ChoiceGroup)arguments.Node.Tag).CommandChoice; } else { control = (ChoiceBase)arguments.Node.Tag; } if (control != null) { control.OnClick(null, null); } }
/// <summary> /// Create a ButtonItem for the sidebar. /// </summary> /// <param name="panelItem"></param> /// <param name="control"></param> protected void MakeButton(SideBarPanelItem panelItem, ChoiceBase control) { UIItemDisplayProperties display = control.GetDisplayProperties(); display.Text = display.Text.Replace("_", ""); ButtonItem button = new ButtonItem(control.Id, display.Text); button.Tag = control; control.ReferenceWidget = button; if (panelItem.ItemImageSize == eBarImageSize.Large) { if (m_largeImages.ImageList.Images.Count > 0) { button.ImageIndex = m_largeImages.GetImageIndex(display.ImageLabel); } } else { if (m_smallImages.ImageList.Images.Count > 0) { button.ImageIndex = m_smallImages.GetImageIndex(display.ImageLabel); } } button.Text = display.Text; button.ButtonStyle = eButtonStyle.ImageAndText; if (!display.Enabled) { button.Text = button.Text + " NA"; } button.Click += new EventHandler(OnClick); panelItem.SubItems.Add(button); //a button in this framework not really a Control... so I don't know how to use //(the same company's) balloon tip control on a sidebar button! // m_mediator.SendMessage("RegisterHelpTarget", button.ContainerControl); }