MiniGUI API Reference (MiniGUI-Threads)  v3.2.0
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
 Sets the STRCMP function used to sort items. More...
 

Detailed Description

Macro Definition Documentation

#define MBM_ADDITEM   0xF200

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

1 MBM_ADDITEM
2 int pos;
3 MENUBUTTONITEM newitem;
4 
5 wParam = (WPARAM)pos;
6 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 202 of file menubutton.h.

#define MBM_DELITEM   0xF201

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

1 MBM_DELETEITEM
2 int del;
3 
4 wParam = (WPARAM)del;
5 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 220 of file menubutton.h.

#define MBM_GETCURITEM   0xF206

Sends to get the index of the current selected item.

1 MBM_GETCURITEM
2 
3 wParam = 0;
4 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 296 of file menubutton.h.

#define MBM_GETITEMDATA   0xF204

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

1 MBM_GETITEMDATA
2 int index;
3 PMENUBUTTONITEM pmbi;
4 
5 wParam = (WPARAM)index;
6 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 280 of file menubutton.h.

#define MBM_RESETCTRL   0xF202

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

1 MBM_RESETCTRL
2 
3 wParam = 0;
4 lParam = 0;
Returns
Always be zero.

Definition at line 235 of file menubutton.h.

#define MBM_SETCURITEM   0xF207

Sends to set the current selected item based on index.

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

Definition at line 314 of file menubutton.h.

#define MBM_SETITEMDATA   0xF203

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

1 MBM_SETITEMDATA
2 int index;
3 PMENUBUTTONITEM pmbi;
4 
5 wParam = (WPARAM)index;
6 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 259 of file menubutton.h.

#define MBM_SETSTRCMPFUNC   0xF208

Sets 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.

1 static int my_strcmp (const char* s1, const char* s2, size_t n)
2 {
3  ...
4  return 0;
5 }
6 
7 MBM_SETSTRCMPFUNC
8 
9 wParam = 0;
10 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 345 of file menubutton.h.