eMbedded Visual Basic: Windows CE and Pocket PC Mobile Applications By Chris Tacke, Timothy Bassett
Table of Contents
appendix A. Control Reference
The Pocket PC MenuBar control allows eVB applications to display a standard Pocket PC menu. The control is selectable from the Project/Components dialog as Microsoft PocketPC MenuBar Control 3.0. The library file is mscemenubar.dll.
Table A.1. MenuBar Control Properties
Property
Type
Description
Controls
Collection
Collection of all first-level children objects on the menu control. Use this collection to enumerate through the first-level objects owned by the menu control. Calling methods on this collection allow the manipulation of the control itself, changing its appearance and behavior.
Enabled
Boolean
No effect on control.
ImageList
Handle (Long)
Used as a handle to an ImageList control to add graphics to menu.
Name
String
Name assigned to menu object.
NewButton
Boolean
Whether New button should be displayed. Is available only to set at design time, read-only at runtime. The actual new button object can't be programmatically referenced; doesn't appear in Controls collection.
Parent
Object
Parent object of menu bar. Should always refer to Form object.
Tag
String
Used for user -defined values.
Table A.2. MenuBar Control Events
Event
Description
NewClick
Occurs when a user clicks New button. Available only when NewButton = True (at design time).
ButtonClick
Occurs when a button is clicked on the menu bar. Passes a reference to the button clicked as a parameter.
MenuClick
Occurs when a menu bar is clicked. Passes a reference to the menu bar clicked as a parameter.
Table A.3. MenuBar Controls Collection Methods
Method
Parameter(s)
Returns
Description
AddButton
[ Key ]( string ) Unique value that identifies the item(button)
Reference to a button object (MenuBarButton)
Adds a button to the menu (or parent object).
AddMenu
Caption ( string ) Caption for menu bar
[ Key ]( string ) Unique value that identifies the item (button)
Reference to menu object (MenuBar)
Adds a menu bar to the menu (or parent object).
Clear
None
Nothing
Removes all items from the menu bar (or parent object).
Table A.4. MenuBar Controls Collection Properties
Property
Type
Description
Count
Integer
Number of items in the collection.
Item
Menu object (button or menu bar)
An individual item from the collection (by Key or Index).
Table A.5. MenuBarMenu Properties
Property
Type
Description
Caption
String
Caption of menu bar. If menu bar is placed on root menu, can't be modified after being assigned.
Enabled
Boolean
Whether the menu bar is accessible to the user. Ignored if menu bar is placed on root menu.
Index
Long
Index of item within its parent's collection.
Items
Collection (Item either MenuBarButton or MenuBarMenu)
Collection of items contained on object. On a menu bar, this can only be other menu bars and can't only be used from a menu bar on the root menu.
Key
String
Unique identifier of object in its parent's collection.
Tag
String
User property able to hold a string value.
Type
MenuBarControlType
Read-only. Always equal to mbrMenuBar for menu bars.
[ index ](Long) Index value to position item. If the index value already exists in collection, the item is inserted before it.
[ key ](String) Unique value t identify item in collection.
[ caption ](String) Caption of objectto be added [ style ](MenuStyleConstant)
Object (Item)
Adds a menu bar the Items to collection.
Clear
None
None
Clears all menu bars from Items collection.
Remove
Index
None
Removes individual menu from Items collection.
Table A.8. MenuBarMenu Items Properties
Property
Type
Description
Count
Long
Number of menu bars in Items collection.
Item
MenuBar object
Returns an individual menu bar object from the Items collection.
Table A.9. MenuBarButton Properties
Property
Type
Description
Caption
String
Caption of button.
Enabled
Boolean
Whether or not button is enabled.
Image
Long
Index to collection of images in ImageList control. Must set ImageList property on MenuBarControl object.
Index
Long
Index of button in collection.
Key
String
Unique identifier of button object in collection.
MixedState
Boolean
Causes button to be shaded.
Style
ButtonStyleConstants
Allows button to be a check box button, radio button, default, or separator.
Tag
String
User property able to hold a string value.
ToolTip
String
Text that pops up as a ToolTip when the user does a tap-and-hold action on the control.
Type
MenuBarControlType
Denotes whether the control is a Button or a Menu.
Value
ButtonValueConstants
Denotes the current value of the control.
Visible
Boolean
Denotes whether or not the control is visible to the User.
Width
Long
The screen-based width of the control.
Table A.10. Items Properties
Property
Type
Description
Count
Long
Number of items in the Items collection.
Item
Enumerator
Allows access to an individual item within the collection. Accepts either the index or the key as the value as to which item to return.
Table A.11. Items Methods
Method
Parameters
Returns
Description
Add
[ index ](Long) Value as to where to add to the collection.
[ key ](String) Unique value to identify the item within the collection.
[ caption ](String) Caption of the menu bar or the button.
[ style ](MenuStyleConstants) Allows defining whether a menu is a menu bar or a separator.
Item
Adds a MenuBarMenu to the collection.
Clear
None
None
Removes all items from the collection.
Remove
Index (StringLong) Correlates to the Index or Key value of the Item in the collection.
None
Clears an individual Item from the collection.
Table A.12. Item Properties
Property
Type
Description
Caption
String
Caption of the button or the menu.
Checked
Boolean
Implemented only for MenuBarMenu. Allows the menu bar to display a check mark. If used with a button, returns an error.
Enabled
Boolean
If Item is MenuBarMenu, will have no effect if MenuBarMenu is on root menu. If item is MenuBarButton, setting Enabled to False causes unexpected behavior.
Index
Long
Unique value of item in its parent collection. Assigned as count of items when added to collection.
Key
String
Unique value of item in its parent collection.
Parent
Object
Reference to the object in which the Item is contained as part of parent collection.
Style
MenuStyleConstants
Applies only to MenuBarMenu class. Allows MenuBarMenu to be a menu (mbrMenuDefault) or a separator (mbrMenuSeparator). Ignored if Item is MenuBarButton.
SubItems
Collection
Collection of items contained by the Item. This applies only to the root MenuBarMenu object as the collection of MenuBarMenu as bars on the root MenuBarMenu.
Tag
String
User-defined value.
Visible
Boolean
Whether the Item is visible to users. If the Item is a MenuBarMenu on the root MenuBar, setting has no effect.
Table A.13. ButtonStyleContants Constants
Constant
Value
Description
mbrAutoSize
5
Not necessary; buttons resize automatically.
mbrButtonGroup
2
Creates a group of buttons similar to a radio-button group .
mbrCheck
1
Creates a button that acts like a check box.
mbrDefault
Regular button.
mbrSeparator
3
Spaceholder between buttons or menu bars. Can be used to separate more than one group of button groups.