nmpButtonCreate (Function) |
Top Previous Next |
This function will initialize a configurable button on the NMP. It is not necessary to call this function as all the settings can be set with the functions for the individual properties, but this makes it possible to set all the visible properties at once. Using this function will avoid showing the user the intermediate states.
The following parameters was used to create the buttons on the following image.
Input: id : INT The ID of the button - between 1 and the button count defined in nmpButtonsDefine.
weight : INT (default : 1) Determines the width of the button relative to the total weight of all the buttons. A button with weight 2 is twice as wide as a button with weight 1. If the total weight of the buttons is 4, a button with weight 2 will have a width 50% of this.
max_width : INT (0..100, default: 0) Determines the maximum width of the button as an integer between 1 and 100, where 100 is the entire width of the panel.To have no maximum value, use 0. This is used to prevent a button from becoming too wide when only a few buttons are defined by limiting the width to e.g. 50 % of the total width.
visible : BOOL (default: FALSE) The visibility of the button.
enable : BOOL (default: FALSE) Determines if the button is enabled and can raise the "NMP Button Pressed" event. See also navWaitEvent for event # 11.
color: DINT (-1, 16#00_00_00..16#FF_FF_FF, default: -1) This determines the color of the button. If -1, the theme color will be used. Instead of specifying the color directly, the nmpRGBToDint function can be used.
night_color: DINT (-1, 16#00_00_00..16#FF_FF_FF, default: -1) This determines the color of the button to use when in the night theme. If -1, the day color will be used unless it is set to use the theme, in which case the color of the night theme will be used. Instead of specifying the color directly, the nmpRGBToDint function can be used.
text : STRING The text of the button. Max. 49 characters.
Returns: INT
Declaration: FUNCTION nmpButtonCreate : INT;
Example: INCLUDE rtcu.inc |