Create menus in your application
Am sure a lot of developers have always found complicated or even have never dreamed to create a trick this, complicated or well, not with the FM script!
For the creation of the menus of this kind, we will distinguish 2 approaches:
- Static Menus
They are created directly from an interface, not too flexible in the changes.
- Dynamic Menus
Offer great opportunity in the update more flexible menus.
Creating static menus :
Creating dynamic menus:
We will now see another theme of creating menus so dynamic, you might decide to import data from your servers to create interactive content, beautiful is not it. All this is possible thanks to two magic functions:
- MenuItemAdd.
- InputMenu.
The signature of the following functions are detailed directly as a result.
Signing functions to add dynamic menus.
- MenuItemAdd
MenuItemAdd(AMenuName : String; RawText : String; Text : String; SelectID : String; Hint :
String; Color : String; Blink : String; Height : String; TextAlign : String; ImageNEngAndClick :
String = ""; Others : String = "");
AMenuName : the name of the menu to which I associate the element. This one works a little like a pile, for those who understands easily term, but it does not matter if it is abstract for some, considered just like a box in which one Stack the elements.
RawText : the text of the element that will display on the native terminals(USSD)
Text : the text of the element that will be displayed on the graphic terminals
SelectID : the value returned when the user selects the item
Hint : Value attached to the right roof of the menu. We will use it most of the time for notifications.
Color : Contains the color of the text and menu background
Blink : flashes the menu when it is 1
Height : the height of the element ;
TextAlign : the alignment of the content of the element. He can take the values : LEFT,
RIGHT, CENTER
ImageNEngAndClick : ImageID of the menu. (oupp, Qwhat does that mean? without panic we will come back.)
Others : this parameter will be very useful, especially in the parameterization of the type menu to display, we will explain it better as an example.
- InputMenu
MenuName : the name of the menu to call
Timeout : Waiting time server
SearchMode : it allows to activate the option to search contents on a list menu items
HideSystemGoback : Hidden menu auto back system
DeepCatching : activation of DeepCatching on the menu
Options : additional menu options.
Exemple
VAR Result : String ;
VAR GotoUssdCode : String ;
VAR ValueStr : String ;
VAR i,j : Integer ;
// Redirect the user to his balance
GotoUssdCode := '*fm*21#';
//---- menu creation with different options
Result := MenuItemAdd('MyMenu','1. Yaounde 1 ', 'Yaounde 1 ', '1', '', '', '', '', ' ');
Result := MenuItemAdd('MyMenu','2. Yaounde', 'Yaounde', .'12:1:0:1:', '', '', '', '', ' ');
Result := MenuItemAdd('MyMenu','1. Yaounde', 'Yaounde', '1:1:0:1:', '2::$FFEB371A:1', '', '', '', ' ');
Result := MenuItemAdd('MyMenu','2. Douala', 'Douala', '2', '3::$FF05A80B:1', '', '', '', ' ');
Result := MenuItemAdd('MyMenu','3. Bafoussam', 'Bafoussam', '3', '4:::0', '', '', '', ' ');
Result := InputMenu('MyMenu', 2500);
//---- gestion valeur de retour
IF Result = ‘00’ THEN
(
Exit ;
) ;
ShowMessage(Result) ;
Exit ;