MiniGUI API Reference (MiniGUI-Processes)  v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Macros
Messages of menubutton control

Macros

#define MBM_ADDITEM   0xF200
 Sends to the control to add an item to the menu list. More...
 
#define MBM_DELITEM   0xF201
 Sends to the control to delete an item in the menu list. More...
 
#define MBM_RESETCTRL   0xF202
 Sends to the control to remove all items in the menu list. More...
 
#define MBM_SETITEMDATA   0xF203
 Sends to the control to set the data of a specific item. More...
 
#define MBM_GETITEMDATA   0xF204
 Sends to the control to retrive the data of a specific item. More...
 
#define MBM_GETCURITEM   0xF206
 Sends to get the index of the current selected item. More...
 
#define MBM_SETCURITEM   0xF207
 Sends to set the current selected item based on index. More...
 
#define MBM_SETSTRCMPFUNC   0xF208
 Set the STRCMP function used to sort items. More...
 

Detailed Description

Macro Definition Documentation

◆ MBM_ADDITEM

#define MBM_ADDITEM   0xF200

Sends to the control to add an item to the menu list.

int pos;
wParam = (WPARAM)pos;
lParam = (LPARAM)&newitem;
Parameters
posThe position at which to add the item. If the control was created with the style of MBS_SORT, this parameter will be ignored. If this parameter is less than 0, the new item will be append to the tail of the menu list.
newitemPointer to the menubutton item info structure.
Returns
The position at which the item has been added, i.e., the index of the added item if success. Otherwise, the following error code will be returned:
  • MB_ERR_SPACE
    No memory can be allocated for new item.

Definition at line 214 of file menubutton.h.

◆ MBM_DELITEM

#define MBM_DELITEM   0xF201

Sends to the control to delete an item in the menu list.

MBM_DELETEITEM
int del;
wParam = (WPARAM)del;
lParam = 0;
Parameters
delThe index of the item to be deleted.
Returns
MB_OKAY if success, else MB_INV_ITEM to indicate valid index.

Definition at line 232 of file menubutton.h.

◆ MBM_GETCURITEM

#define MBM_GETCURITEM   0xF206

Sends to get the index of the current selected item.

wParam = 0;
lParam = 0;
Returns
The index of the current selected item. If there is no seleted item, MB_INV_ITEM will be returned.

Definition at line 308 of file menubutton.h.

◆ MBM_GETITEMDATA

#define MBM_GETITEMDATA   0xF204

Sends to the control to retrive the data of a specific item.

int index;
wParam = (WPARAM)index;
lParam = (LPARAM)pmbi;
Parameters
indexThe index of the specific item.
pmbiPointer to the MENUBUTTONITEM structure for storing the menubutton item data.
Returns
MB_OKAY if success, otherwise MB_INV_ITEM to indicate invalid index.

Definition at line 292 of file menubutton.h.

◆ MBM_RESETCTRL

#define MBM_RESETCTRL   0xF202

Sends to the control to remove all items in the menu list.

wParam = 0;
lParam = 0;
Returns
Always be zero.

Definition at line 247 of file menubutton.h.

◆ MBM_SETCURITEM

#define MBM_SETCURITEM   0xF207

Sends to set the current selected item based on index.

int cur;
wParam = (WPARAM)cur;
lParam = 0;
Parameters
curThe index to be the current item.
Returns
The index of the old selected item.

Definition at line 326 of file menubutton.h.

◆ MBM_SETITEMDATA

#define MBM_SETITEMDATA   0xF203

Sends to the control to set the data of a specific item.

int index;
wParam = (WPARAM)index;
lParam = (LPARAM)pmbi;
Parameters
indexThe index of the item to be altered.
pmbiPointer to the MENUBUTTONITEM structure that stores the new menubutton item data.
Returns
MB_OKAY if success, otherwise will be one of the following error codes:
     - MB_INV_ITEM\n     Indicate that the index you passed is valid.
     - MB_ERR_SPACE\n    No memory can be allocated for new item data.

Definition at line 271 of file menubutton.h.

◆ MBM_SETSTRCMPFUNC

#define MBM_SETSTRCMPFUNC   0xF208

Set the STRCMP function used to sort items.

An application sends a MBM_SETSTRCMPFUNC message to set a new STRCMP function to sort items in the menubutton.

Note that you should send this message before adding any item to the menubutton control.

static int my_strcmp (const char* s1, const char* s2, size_t n)
{
...
return 0;
}
wParam = 0;
lParam = (LPARAM) my_strcmp;
Parameters
my_strcmpYour own function to compare two strings.
Returns
One of the following values:
  • MB_OKAY
    Success
  • MB_ERR
    Not an empty menubutton

Definition at line 357 of file menubutton.h.

WPARAM
UINT_PTR WPARAM
A type definition for the first message paramter.
Definition: common.h:706
MBM_ADDITEM
#define MBM_ADDITEM
Sends to the control to add an item to the menu list.
Definition: menubutton.h:214
MBM_GETITEMDATA
#define MBM_GETITEMDATA
Sends to the control to retrive the data of a specific item.
Definition: menubutton.h:292
MBM_SETSTRCMPFUNC
#define MBM_SETSTRCMPFUNC
Set the STRCMP function used to sort items.
Definition: menubutton.h:357
MBM_SETITEMDATA
#define MBM_SETITEMDATA
Sends to the control to set the data of a specific item.
Definition: menubutton.h:271
MBM_SETCURITEM
#define MBM_SETCURITEM
Sends to set the current selected item based on index.
Definition: menubutton.h:326
_MENUBUTTONITEM
Definition: menubutton.h:109
LPARAM
UINT_PTR LPARAM
A type definition for the second message paramter.
Definition: common.h:712
MBM_RESETCTRL
#define MBM_RESETCTRL
Sends to the control to remove all items in the menu list.
Definition: menubutton.h:247
MBM_GETCURITEM
#define MBM_GETCURITEM
Sends to get the index of the current selected item.
Definition: menubutton.h:308