Registers a new add-on widget type.
Public Sub RegisterWidget( _ ByVal wrParams As WidgetRegParams _ )
try { SAPbouiCOM.Cockpits ckpts = sbo_Application.Cockpits; //Pop up the dialog now. RegisterWidget regWdt = new RegisterWidget(); regWdt.ShowDialog(); if(regWdt.DialogResult == DialogResult.OK) { string strWidgetType = regWdt.GetWidgetType(); string strWidgetName = regWdt.GetWidgetName(); string strCategory = regWdt.GetWidgetCategory(); int iWidth = (int)regWdt.GetWidgetWidth(); int iHeight = (int)regWdt.GetWidgetHeight(); string strImagePath = regWdt.GetImagePath(); //Widget Registration Parameters. SAPbouiCOM.WidgetRegParams wrp = (SAPbouiCOM.WidgetRegParams)sbo_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_WidgetRegParams); wrp.WidgetType = "AddonWidget"; wrp.WidgetName = "Addon_Menu"; wrp.ImagePath = "D:\\CockPit\\addon_wdt.png"; wrp.Width = 50; wrp.Height = 40; wrp.CategoryUID = "General Widgets"; //You can add new widget category by providing new category names wrp.WidgetType = strWidgetType; wrp.WidgetName = strWidgetName; wrp.ImagePath = strImagePath; wrp.Width = iWidth; wrp.Height = iHeight; wrp.CategoryUID = strCategory; //Register Add-on widget prototype. ckpts.RegisterWidget(wrp); } } catch (Exception ex) { string strErrAlert = "Errors:\n\n"; MessageBox.Show(strErrAlert + ex.Message); }
Cockpits Object