AddItem Method
Description
Adds a PopupControlItem to the popup control. This is how you add icons and text to the popup control. This is also used when creating custom themes.
Syntax
Public Function AddItem( _
ByVal [Left](#) As Long, _
ByVal [Top](#) As Long, _
ByVal [Right](#) As Long, _
ByVal [Bottom](#) As Long, _
ByVal [Caption](#) As String, _
Optional ByVal [BackgroundColor](#) As Variant, _
Optional ByVal [BorderColor](#) As Variant _
) As [PopupControlItem](XtremeSuiteControls~PopupControlItem.md)
Parameters
- Left: Left coordinate of the area in PopupControl the item will occupy.
- Top: Top coordinate of the area in PopupControl the item will occupy.
- Right: Right coordinate of the area in PopupControl the item will occupy.
- Bottom: Bottom coordinate of the area in PopupControl the item will occupy.
- Caption: Text of the item that will be displayed in the area specified by the top, left, right, and bottom parameters.
- BackgroundColor: Background color of the item; this will fill the area specified by the top, left, right, and bottom parameters with the selected color.
- BorderColor: Color used to draw a border around the area specified by the top, left, right, and bottom parameters.
Remarks
This adds a PopupControlItem to the PopupControl and will occupy the area specified by the left, top, right, and bottom parameters. The left, top, right, and bottom parameters specify coordinates in the PopupControl starting at 0,0 up to the size of the PopupControl set by the SetSize method.
To summarize, the PopupControl occupies the area on the screen defined by the SetSize method. Inside this area, you have a coordinate system starting at 0,0. You then use the AddItem method to add an item to the PopupControl. You must specify the area within the PopupControl that the item will occupy.
Example
Adding Items to the PopupControl using the AddItem method (Visual Basic)
This sample illustrates how to add items to a popup control using the AddItem method.
Dim Item As PopupControlItem
' Removes all existing items from the PopupControl
PopupControl.RemoveAllItems
' Adds an item to the popup control.
Set Item = PopupControl.AddItem(25, 6, 170, 19, "PopupControlDemo")
' Specifies that the Item will be a hyperlink
Item.Hyperlink = False
Set Item = PopupControl.AddItem(0, 27, 160, 0, "Options")
Item.TextAlignment = DT_RIGHT
Item.CalculateHeight
Item.CalculateWidth
Set Item = PopupControl.AddItem(0, 50, 170, 100, "Please visit our website for additional product information including registration details.")
Item.TextAlignment = DT_CENTER Or DT_WORDBREAK
Item.CalculateHeight
Item.Id = IDSITE
Set Item = PopupControl.AddItem(151, 6, 164, 19, "")
Item.SetIcons LoadBitmap("Icons\CloseMSN.bmp"), 0, xtpPopupItemIconNormal Or xtpPopupItemIconSelected Or xtpPopupItemIconPressed
Item.Id = IDCLOSE
Set Item = PopupControl.AddItem(7, 6, 20, 19, "")
Item.SetIcons LoadBitmap("Icons\CaptionMSN.bmp"), 0, xtpPopupItemIconNormal
Set Item = PopupControl.AddItem(115, 102, 160, 120, "")
Item.SetIcons LoadBitmap("Icons\LogoMSN.bmp"), 0, xtpPopupItemIconNormal
' Uses a predefined theme
PopupControl.VisualTheme = xtpPopupThemeMSN
PopupControl.SetSize 170, 130
See Also
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.