fabior

PBCommandBarPopup: Event does not start

Discussion created by fabior on Mar 15, 2012
Latest reply on Mar 16, 2012 by fabior

Hi everyone,

 

I am having a problem when dealing with a PBCommandBarPopup that I have inan add-in. The problem isthat I got the items/buttons, but the eventhandler seems not to be working or sth like this as nothing happens when I click inany of the itens. Here isthe code so that you can have a clue about.

 

 
private PBObjLib.PBCommandBar cmBar;
private PBObjLib.PBCommandBarControls cmBarControls;
private PBObjLib.PBCommandBarPopup cmBarScrollControlBar;
private PBObjLib.PBCommandBarButton cmBarControlLogo;

private void AddScrollButtonToolBar()
{
     this.cmBar = this.app.CommandBars.Item(AppUtil.ADDIN_NOME);

     if (this.cmBar == null)
     {
          this.app.CommandBars.Add(AppUtil.ADDIN_NOME, 1, false, false);
          this.cmBar = this.app.CommandBars.Item(AppUtil.ADDIN_NOME);
          this.cmBarControls = (PBObjLib.PBCommandBarControls)this.cmBar.Controls;

          this.cmBarControlLogo = (PBObjLib.PBCommandBarButton)this.cmBarControls.Add((object)PBObjLib.pbControlType.pbControlButton, 1, null, null, false);
          this.cmBarControlLogo.ToolTipText = "";
          this.cmBarControlLogo.Style = pbButtonStyle.pbButtonIcon;
          this.cmBarControlLogo.LoadFace("giop_dsvazao_petrobras.bmp");

          // Adiciona o Scroll
          this.cmBarScrollControlBar = (PBObjLib.PBCommandBarPopup)this.cmBarControls.Add((object)PBObjLib.pbControlType.pbControlPopup, 1, null, null, false);
          this.cmBarScrollControlBar.ToolTipText = AppUtil.ADDIN_SCROLL_BAR_NOME;
          this.cmBarScrollControlBar.Caption = AppUtil.ADDIN_NOME;
          this.cmBarScrollControlBar.Enabled = true;
          this.cmBarScrollControlBar.Controls.Add((object)PBObjLib.pbControlType.pbControlButton, 1, null, null, false);
          this.cmBarScrollControlBar.Controls.Add((object)PBObjLib.pbControlType.pbControlButton, 2, null, null, false);
          this.cmBarScrollControlBar.Controls.Add((object)PBObjLib.pbControlType.pbControlButton, 3, null, null, false);

          // Altera propriedades dos itens de menu
          this.cmBarScrollControlBar.Controls.Item(1).ToolTipText = AppUtil.ADDIN_SCROLL_BAR_COPIAR_NOME;
          this.cmBarScrollControlBar.Controls.Item(1).Caption = AppUtil.ADDIN_SCROLL_BAR_COPIAR_CAPTION;
          this.cmBarScrollControlBar.Controls.Item(1).Enabled = true;

          this.cmBarScrollControlBar.Controls.Item(2).ToolTipText = AppUtil.ADDIN_SCROLL_BAR_IMPORTAR_NOME;
          this.cmBarScrollControlBar.Controls.Item(2).Caption = AppUtil.ADDIN_SCROLL_BAR_IMPORTAR_CAPTION;
          this.cmBarScrollControlBar.Controls.Item(3).Enabled = true;

          this.cmBarScrollControlBar.Controls.Item(3).ToolTipText = AppUtil.ADDIN_SCROLL_BAR_EXPORTAR_NOME;
          this.cmBarScrollControlBar.Controls.Item(3).Caption = AppUtil.ADDIN_SCROLL_BAR_EXPORTAR_CAPTION;
          this.cmBarScrollControlBar.Controls.Item(3).Enabled = true;
     }

     // Altera propriedades do Command Bar
     this.cmBar.Enabled = true;
     this.cmBar.Visible = true;

     // Adiciona os controles no Scroll
     this.cmBarControls = (PBObjLib.PBCommandBarControls)this.cmBar.Controls;
     this.cmBarScrollControlBar = (PBObjLib.PBCommandBarPopup)this.cmBarControls.Item(AppUtil.ADDIN_NOME);
     ((ECommandBarButtonEvents_Event)this.cmBarScrollControlBar.Controls.Item(1)).Click += new PBObjLib.ECommandBarButtonEvents_ClickEventHandler(tagSimController.AddInCopiarClicked);
     ((ECommandBarButtonEvents_Event)this.cmBarScrollControlBar.Controls.Item(2)).Click += new PBObjLib.ECommandBarButtonEvents_ClickEventHandler(tagSimController.AddInImportarDadosClicked);
     ((ECommandBarButtonEvents_Event)this.cmBarScrollControlBar.Controls.Item(3)).Click += new PBObjLib.ECommandBarButtonEvents_ClickEventHandler(tagSimController.AddInExportarClicked);
}

 

 

Thanks,

 

Fábio Reis

Outcomes