Duivision Menu class is Cduimenu, there are two kinds of display location, one is the window at the top of a button click can drop a menu, the other is the tray icon of the right-click menu.
The menu definition in the window is defined as the Action property of a button in the XML file, starting with the menu: the XML filename or the XML definition name, as defined below:
<imgbtn name="button.menu" pos="-110,0,-77,29" skin="IDB_BT_MENU" tip="菜单" action="menu:mainmenu.xml"/>
The tray menu defaults to loading the menu according to the XML file pointed to by the Menu_tray defined in Resource.xml.
The menu definition XML file format that is loaded in both ways is the same, referring to the example in the previous XML Description section.
The properties of the menu class are as follows:
Property name |
type |
description |
Width |
Digital |
Menu window width |
Item-height |
Digital |
Height of each menu item |
Left |
Digital |
Width of the icon area on the left side of the menu |
Sep-height |
Digital |
Height of the menu divider line |
Font |
String |
Font |
Fontwidth |
Digital |
Font width |
Frame-width |
Digital |
Width of menu item distance border |
Top-height |
Digital |
The height of the border from the top of the menu item |
Bottom-height |
Digital |
Height of the bottom distance border of the menu item |
Crrowhover |
Color |
menu item background color (color when mouse moves to menu item), default color if not set |
Img-rowhover |
Image |
menu item background picture (background picture when mouse moves to menu item), priority is higher than background color |
Img-popuparrow |
Image |
Pop-up menu arrow picture |
Common functions are as follows:
function |
whether the virtual function |
Description |
Loadxmlfile |
Whether |
Load Menu XML file |
AddMenu |
Whether |
Adding menu items Dynamically |
AddSeparator |
Whether |
Dynamically add a menu separator line |
Setitemtitle |
Whether |
Title of the preset menu item |
Setitemvisible |
Whether |
The visibility of a preset menu item |
Setitemdisable |
Whether |
Default menu item disabled state |
Setitemcheck |
Whether |
Check flags for preset menu items |
Setmenupoint |
Whether |
Refresh location information for all menu items |
Getparentmenu |
Whether |
Get parent Menu Object |
Gethovermenuitem |
Whether |
Gets the current active menu item object |
The controls for each menu item loaded in the menus are the Cmenuitem class, the control type name is MenuItem, and the menu item's properties are as follows:
Property name |
type |
description |
seperator |
0|1 |
whether to delimit line |
Select |
0|1 | td> whether to select (if it is a checkbox or RadioButton type of menu item, this property must be set to 1)
check |
0|1 |
is selected |
Group |
string |
broadcast button belongs to the group name, the same group name of the broadcast button is a group, you can linkage, only one group in the selected state |
Td>value the value of the
string |
broadcast button, the values of multiple buttons in a set of broadcast buttons are different, and when the value of this set of broadcast buttons is obtained, the value of the selected button is obtained |
menu |
string |
refers to the name of the other menu (the name of the menu that can be found by the resource definition) and sets this property, the corresponding menu is embedded in the current menu |
image |
picture |
The small picture on the left side of the menu item, if it is a popup menu, and the Img-popuparrow property of the menu is not set, the Image property represents the arrow image to the right of the menu item |
img-count |
number |
the picture to the left of the Set menu item is made up of several small, parallel images |
taskmsg |
0|1 |
whether the menu handler function is executed by task, if there is a blocking or waiting action in the handler function of the popup menu (such as opening a dialog box), the pop-up menu during execution may lose focus and Object deletion, in which case the menu handler function needs to be executed by inserting the action into the task queue, which is then executed by the task queue thread to execute the menu handler |
The common functions of the menu item class are as follows:
function |
whether the virtual function |
Description |
SetCheck |
Whether |
Sets whether to select |
Getcheck |
Whether |
Gets whether the selected state |
IsSeparator |
Whether |
Determine if the divider line |
Setgroupname |
Whether |
Set the name of the broadcast button group |
Getgroupname |
Whether |
Get the name of the broadcast button group |
GetValue |
Whether |
Gets the value of the broadcast button |
Getgroupvalue |
Whether |
Gets the value of the broadcast button group |
Resetgroupcheck |
Whether |
Refreshes the state of the RadioButton control for all the same groups under the parent control |
The menu interface examples are as follows:
Duivision Open Source Code (GitHub): https://github.com/blueantst/DuiVision
Blue Ant Studio homepage: http://www.blueantstudio.net
Duivision QQ Group: 325880743
Public number: Blueantstudio or search blue Ant Studios
Duivision Development Tutorials (19)-Menu