Hi,
I need some information on how to setup the width of the popup items which displays when i click on the ultradropdown button. The width of the popup items should be equal to the width of the button.
Here is the sample piece of code I am trying to create :
/*------------------------------------------------------------------------ File : UltraDropdowntest Purpose : Syntax : Description : Author(s) : sagumami Created : Thu Sep 07 09:06:46 IST 2017 Notes : ----------------------------------------------------------------------*/
USING Progress.Lang.*.USING Progress.Windows.Form.
BLOCK-LEVEL ON ERROR UNDO, THROW.
CLASS UltraDropdowntest INHERITS Form: DEFINE PRIVATE VARIABLE m_UltraDropdowntest_Toolbars_Dock_Area_Top AS Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea NO-UNDO. DEFINE PRIVATE VARIABLE m_UltraDropdowntest_Toolbars_Dock_Area_Right AS Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea NO-UNDO. DEFINE PRIVATE VARIABLE m_UltraDropdowntest_Toolbars_Dock_Area_Left AS Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea NO-UNDO. DEFINE PRIVATE VARIABLE m_UltraDropdowntest_Toolbars_Dock_Area_Bottom AS Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea NO-UNDO. DEFINE PRIVATE VARIABLE components AS System.ComponentModel.IContainer NO-UNDO. DEFINE PRIVATE VARIABLE ultraToolbarsManager1 AS Infragistics.Win.UltraWinToolbars.UltraToolbarsManager NO-UNDO. DEFINE PRIVATE VARIABLE ultraDropDownButton1 AS Infragistics.Win.Misc.UltraDropDownButton NO-UNDO. DEFINE PRIVATE VARIABLE UltraDropdowntest_Fill_Panel AS Infragistics.Win.Misc.UltraPanel NO-UNDO.
CONSTRUCTOR PUBLIC UltraDropdowntest ( ): SUPER(). InitializeComponent(). THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components). CATCH e AS Progress.Lang.Error: UNDO, THROW e. END CATCH.
END CONSTRUCTOR.
METHOD PRIVATE VOID InitializeComponent( ): /* NOTE: The following method is automatically generated. We strongly suggest that the contents of this method only be modified using the Visual Designer to avoid any incompatible modifications. Modifying the contents of this method using a code editor will invalidate any support for this file. */ THIS-OBJECT:components = NEW System.ComponentModel.Container(). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE buttonTool1 AS Infragistics.Win.UltraWinToolbars.ButtonTool NO-UNDO. buttonTool1 = NEW Infragistics.Win.UltraWinToolbars.ButtonTool("ButtonTool1"). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE buttonTool2 AS Infragistics.Win.UltraWinToolbars.ButtonTool NO-UNDO. buttonTool2 = NEW Infragistics.Win.UltraWinToolbars.ButtonTool("ButtonTool2"). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE buttonTool3 AS Infragistics.Win.UltraWinToolbars.ButtonTool NO-UNDO. buttonTool3 = NEW Infragistics.Win.UltraWinToolbars.ButtonTool("ButtonTool3"). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE buttonTool4 AS Infragistics.Win.UltraWinToolbars.ButtonTool NO-UNDO. buttonTool4 = NEW Infragistics.Win.UltraWinToolbars.ButtonTool("ButtonTool4"). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE buttonTool5 AS Infragistics.Win.UltraWinToolbars.ButtonTool NO-UNDO. buttonTool5 = NEW Infragistics.Win.UltraWinToolbars.ButtonTool("ButtonTool5"). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE popupMenuTool3 AS Infragistics.Win.UltraWinToolbars.PopupMenuTool NO-UNDO. popupMenuTool3 = NEW Infragistics.Win.UltraWinToolbars.PopupMenuTool("PopupMenuTool1"). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE buttonTool11 AS Infragistics.Win.UltraWinToolbars.ButtonTool NO-UNDO. buttonTool11 = NEW Infragistics.Win.UltraWinToolbars.ButtonTool("ButtonTool1"). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE buttonTool12 AS Infragistics.Win.UltraWinToolbars.ButtonTool NO-UNDO. buttonTool12 = NEW Infragistics.Win.UltraWinToolbars.ButtonTool("ButtonTool2"). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE buttonTool13 AS Infragistics.Win.UltraWinToolbars.ButtonTool NO-UNDO. buttonTool13 = NEW Infragistics.Win.UltraWinToolbars.ButtonTool("ButtonTool3"). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE buttonTool14 AS Infragistics.Win.UltraWinToolbars.ButtonTool NO-UNDO. buttonTool14 = NEW Infragistics.Win.UltraWinToolbars.ButtonTool("ButtonTool4"). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE buttonTool15 AS Infragistics.Win.UltraWinToolbars.ButtonTool NO-UNDO. buttonTool15 = NEW Infragistics.Win.UltraWinToolbars.ButtonTool("ButtonTool5"). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE popupMenuTool5 AS Infragistics.Win.UltraWinToolbars.PopupMenuTool NO-UNDO. popupMenuTool5 = NEW Infragistics.Win.UltraWinToolbars.PopupMenuTool("PopupMenuTool2"). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE popupMenuTool6 AS Infragistics.Win.UltraWinToolbars.PopupMenuTool NO-UNDO. popupMenuTool6 = NEW Infragistics.Win.UltraWinToolbars.PopupMenuTool("PopupMenuTool3"). @VisualDesigner.FormMember (NeedsInitialize="true"). DEFINE VARIABLE popupMenuTool7 AS Infragistics.Win.UltraWinToolbars.PopupMenuTool NO-UNDO. popupMenuTool7 = NEW Infragistics.Win.UltraWinToolbars.PopupMenuTool("PopupMenuTool4"). THIS-OBJECT:ultraDropDownButton1 = NEW Infragistics.Win.Misc.UltraDropDownButton(). THIS-OBJECT:ultraToolbarsManager1 = NEW Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(THIS-OBJECT:components). THIS-OBJECT:UltraDropdowntest_Fill_Panel = NEW Infragistics.Win.Misc.UltraPanel(). THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Left = NEW Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(). THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Right = NEW Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(). THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Top = NEW Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(). THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Bottom = NEW Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(). CAST(THIS-OBJECT:ultraToolbarsManager1, System.ComponentModel.ISupportInitialize):BeginInit(). THIS-OBJECT:UltraDropdowntest_Fill_Panel:ClientArea:SuspendLayout(). THIS-OBJECT:UltraDropdowntest_Fill_Panel:SuspendLayout(). THIS-OBJECT:SuspendLayout(). /* */ /* ultraDropDownButton1 */ /* */ THIS-OBJECT:ultraDropDownButton1:Location = NEW System.Drawing.Point(151, 123). THIS-OBJECT:ultraDropDownButton1:Name = "ultraDropDownButton1". THIS-OBJECT:ultraDropDownButton1:PopupItemKey = "PopupMenuTool1". THIS-OBJECT:ultraDropDownButton1:PopupItemProvider = THIS-OBJECT:ultraToolbarsManager1. THIS-OBJECT:ultraDropDownButton1:Size = NEW System.Drawing.Size(202, 43). THIS-OBJECT:ultraDropDownButton1:Style = Infragistics.Win.Misc.SplitButtonDisplayStyle:DropDownButtonOnly. THIS-OBJECT:ultraDropDownButton1:TabIndex = 0. THIS-OBJECT:ultraDropDownButton1:Text = "ultraDropDownButton1". /* */ /* ultraToolbarsManager1 */ /* */ THIS-OBJECT:ultraToolbarsManager1:DesignerFlags = 1. THIS-OBJECT:ultraToolbarsManager1:DockWithinContainer = THIS-OBJECT. THIS-OBJECT:ultraToolbarsManager1:DockWithinContainerBaseType = Progress.Util.TypeHelper:GetType("Progress.Windows.Form"). THIS-OBJECT:ultraToolbarsManager1:ShowFullMenusDelay = 500. buttonTool1:SharedPropsInternal:Caption = "ButtonTool1". buttonTool1:SharedPropsInternal:Category = "Test". buttonTool2:SharedPropsInternal:Caption = "ButtonTool2". buttonTool2:SharedPropsInternal:Category = "Test". buttonTool3:SharedPropsInternal:Caption = "ButtonTool3". buttonTool3:SharedPropsInternal:Category = "Test". buttonTool4:SharedPropsInternal:Caption = "ButtonTool4". buttonTool4:SharedPropsInternal:Category = "Test". buttonTool5:SharedPropsInternal:Caption = "ButtonTool5". buttonTool5:SharedPropsInternal:Category = "Test". popupMenuTool3:SharedPropsInternal:Caption = "PopupMenuTool1". @VisualDesigner.FormMember (NeedsInitialize="false", InitializeArray="true"). DEFINE VARIABLE arrayvar0 AS Infragistics.Win.UltraWinToolbars.ToolBase EXTENT 5 NO-UNDO. arrayvar0[1] = buttonTool11. arrayvar0[2] = buttonTool12. arrayvar0[3] = buttonTool13. arrayvar0[4] = buttonTool14. arrayvar0[5] = buttonTool15. popupMenuTool3:Tools:AddRange(arrayvar0). popupMenuTool5:SharedPropsInternal:Caption = "PopupMenuTool2". popupMenuTool6:SharedPropsInternal:Caption = "PopupMenuTool3". popupMenuTool7:SharedPropsInternal:Caption = "PopupMenuTool4". @VisualDesigner.FormMember (NeedsInitialize="false", InitializeArray="true"). DEFINE VARIABLE arrayvar1 AS Infragistics.Win.UltraWinToolbars.ToolBase EXTENT 9 NO-UNDO. arrayvar1[1] = buttonTool1. arrayvar1[2] = buttonTool2. arrayvar1[3] = buttonTool3. arrayvar1[4] = buttonTool4. arrayvar1[5] = buttonTool5. arrayvar1[6] = popupMenuTool3. arrayvar1[7] = popupMenuTool5. arrayvar1[8] = popupMenuTool6. arrayvar1[9] = popupMenuTool7. THIS-OBJECT:ultraToolbarsManager1:Tools:AddRange(arrayvar1). THIS-OBJECT:ultraToolbarsManager1:UseLargeImagesOnMenu = TRUE. THIS-OBJECT:ultraToolbarsManager1:UseLargeImagesOnToolbar = TRUE. /* */ /* UltraDropdowntest_Fill_Panel */ /* */ /* */ /* UltraDropdowntest_Fill_Panel.ClientArea */ /* */ THIS-OBJECT:UltraDropdowntest_Fill_Panel:ClientArea:Controls:Add(THIS-OBJECT:ultraDropDownButton1). THIS-OBJECT:UltraDropdowntest_Fill_Panel:Cursor = System.Windows.Forms.Cursors:Default. THIS-OBJECT:UltraDropdowntest_Fill_Panel:Dock = System.Windows.Forms.DockStyle:Fill. THIS-OBJECT:UltraDropdowntest_Fill_Panel:Location = NEW System.Drawing.Point(0, 0). THIS-OBJECT:UltraDropdowntest_Fill_Panel:Name = "UltraDropdowntest_Fill_Panel". THIS-OBJECT:UltraDropdowntest_Fill_Panel:Size = NEW System.Drawing.Size(549, 465). THIS-OBJECT:UltraDropdowntest_Fill_Panel:TabIndex = 0. /* */ /* m_UltraDropdowntest_Toolbars_Dock_Area_Left */ /* */ THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Left:AccessibleRole = System.Windows.Forms.AccessibleRole:Grouping. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Left:BackColor = System.Drawing.SystemColors:Control. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Left:DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition:Left. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Left:ForeColor = System.Drawing.SystemColors:ControlText. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Left:Location = NEW System.Drawing.Point(0, 0). THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Left:Name = "m_UltraDropdowntest_Toolbars_Dock_Area_Left". THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Left:Size = NEW System.Drawing.Size(0, 465). THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Left:ToolbarsManager = THIS-OBJECT:ultraToolbarsManager1. /* */ /* m_UltraDropdowntest_Toolbars_Dock_Area_Right */ /* */ THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Right:AccessibleRole = System.Windows.Forms.AccessibleRole:Grouping. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Right:BackColor = System.Drawing.SystemColors:Control. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Right:DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition:Right. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Right:ForeColor = System.Drawing.SystemColors:ControlText. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Right:Location = NEW System.Drawing.Point(549, 0). THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Right:Name = "m_UltraDropdowntest_Toolbars_Dock_Area_Right". THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Right:Size = NEW System.Drawing.Size(0, 465). THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Right:ToolbarsManager = THIS-OBJECT:ultraToolbarsManager1. /* */ /* m_UltraDropdowntest_Toolbars_Dock_Area_Top */ /* */ THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Top:AccessibleRole = System.Windows.Forms.AccessibleRole:Grouping. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Top:BackColor = System.Drawing.SystemColors:Control. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Top:DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition:Top. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Top:ForeColor = System.Drawing.SystemColors:ControlText. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Top:Location = NEW System.Drawing.Point(0, 0). THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Top:Name = "m_UltraDropdowntest_Toolbars_Dock_Area_Top". THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Top:Size = NEW System.Drawing.Size(549, 0). THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Top:ToolbarsManager = THIS-OBJECT:ultraToolbarsManager1. /* */ /* m_UltraDropdowntest_Toolbars_Dock_Area_Bottom */ /* */ THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Bottom:AccessibleRole = System.Windows.Forms.AccessibleRole:Grouping. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Bottom:BackColor = System.Drawing.SystemColors:Control. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Bottom:DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition:Bottom. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Bottom:ForeColor = System.Drawing.SystemColors:ControlText. THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Bottom:Location = NEW System.Drawing.Point(0, 465). THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Bottom:Name = "m_UltraDropdowntest_Toolbars_Dock_Area_Bottom". THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Bottom:Size = NEW System.Drawing.Size(549, 0). THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Bottom:ToolbarsManager = THIS-OBJECT:ultraToolbarsManager1. /* */ /* UltraDropdowntest */ /* */ THIS-OBJECT:ClientSize = NEW System.Drawing.Size(549, 465). THIS-OBJECT:Controls:Add(THIS-OBJECT:UltraDropdowntest_Fill_Panel). THIS-OBJECT:Controls:Add(THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Left). THIS-OBJECT:Controls:Add(THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Right). THIS-OBJECT:Controls:Add(THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Bottom). THIS-OBJECT:Controls:Add(THIS-OBJECT:m_UltraDropdowntest_Toolbars_Dock_Area_Top). THIS-OBJECT:Name = "UltraDropdowntest". THIS-OBJECT:Text = "UltraDropdowntest". CAST(THIS-OBJECT:ultraToolbarsManager1, System.ComponentModel.ISupportInitialize):EndInit(). THIS-OBJECT:UltraDropdowntest_Fill_Panel:ClientArea:ResumeLayout(FALSE). THIS-OBJECT:UltraDropdowntest_Fill_Panel:ResumeLayout(FALSE). THIS-OBJECT:ResumeLayout(FALSE). CATCH e AS Progress.Lang.Error: UNDO, THROW e. END CATCH. END METHOD.
DESTRUCTOR PUBLIC UltraDropdowntest ( ):
END DESTRUCTOR.
END CLASS.
Hello Santosh,
If I understand you correctly you have UltraDorpDownButton and you set as its PopupItem a PopupMenuTool from UltraToolbarsManager. Then you need to set the width of the PopupMenuTool. Note, that UltraToolbarsManager mimics the Office and VS style toolbars, where the tool size on content. Therefore there is no easy way to set the size of the PopupMenuTool. One possible solution could be to create derived ButtonTool and override its CalculateLogicalSizeOfToolInstance method as discussed in this forum thread “Equal Size Buttons on Toolbar”. Other possible solution could be implementing of creation filter as was shown here “Width of PopupMenuTool”.
As both these are not trivial I would suggest you to use UltraPopupControlContainer as PopupItem for your UltraDropDownButton. In popup control container you can add any control you may need as Popup Control, e.g. an UltraPanel with several UltraButtons. Then you can design your popup control as you need. Attached is a small sample showing this approach. Please, check my sample and let me know if any additional questions on this matter arise.