Anveo Mobile App / Características de la aplicación base / Subtítulos dinámicos en el menú principal
Esta es una traducción automática. El mensaje original está disponible en Inglés.

Subtítulos dinámicos en el menú principal

El cambio dinámico de los títulos de las baldosas en el menú principal se realiza dentro del OnOpenMenu Trigger del menú principal correspondiente. De esta manera se puede ajustar el icono, el color y el texto de la baldosa.

Iconos/Colores

El icono y el color de las fichas del menú principal se almacenan en la tabla ACF Anveo Page Element Menu. Para poder cambiar estos valores en la aplicación, primero debe identificarse la entrada correspondiente en la tabla. Todas las entradas de menú que no pertenecen a una Anveo Page se marcan con el campo Código de Anveo Page vacío.

local anveoPageElementMenu = Record('ACF Anveo Page Element Menu');

-- [[get Main Menu Entry for My Messages]]
anveoPageElementMenu:SETRANGE('Anveo Page Code','');
anveoPageElementMenu:SETRANGE('Action Code','');
anveoPageElementMenu:SETRANGE('Linked Anveo Page','ASLS_NOTIFICATIONS');
anveoPageElementMenu:FINDFIRST();

En esta entrada, el símbolo y el color de fondo pueden cambiarse dinámicamente cambiando los campos Background Color y Icon Description. Un ejemplo completo de las notificaciones podría ser así:

local anveoPageElementMenu = Record('ACF Anveo Page Element Menu');
local ACFNotification = Record('ACF Notification');
local colorRed = '#bd3939';
local colorGreen = '#00b050';
local colorBlue = '#5b9bd5';
local colorGray = '#7c7c7c';

-- [[get Main Menu Entry for My Messages]]
anveoPageElementMenu:SETRANGE('Anveo Page Code','');
anveoPageElementMenu:SETRANGE('Action Code','');
anveoPageElementMenu:SETRANGE('Linked Anveo Page','ASLS_NOTIFICATIONS');
anveoPageElementMenu:FINDFIRST();
--[[check if there are unread Notifications]]
ACFNotification:SETRANGE('Status', 5);
if ACFNotification:ISEMPTY() then
--[[no unread messages]]
--[[set the background color to gray and set the symbol to "mail"]]
anveoPageElementMenu:SETVALUE('Background Color', colorGray);
anveoPageElementMenu:SETVALUE('Icon Description', 'mail');
anveoPageElementMenu:MODIFY(false);
else
--[[there are unread messages]]
--[[set the background color to red and set the symbol to "mail_open"]]
anveoPageElementMenu:SETVALUE('Background Color', colorRed);
anveoPageElementMenu:SETVALUE('Icon Description', 'mail_open');
anveoPageElementMenu:MODIFY(false);
end;

Texto

Los textos de las entradas del menú principal se definen en la tabla ACF Multilanguage. Se identifican por el table number, los campos PK y el language. El campo contiene el texto que se muestra. Para la tabla ACF Anveo Page Element Menu (en la que se almacenan las fichas del menú principal) se pueden encontrar y cambiar de la siguiente manera:

local anveoPageElementMenu = Record('ACF Anveo Page Element Menu');
anveoPageElementMenu:SETRANGE('Anveo Page Code','');
anveoPageElementMenu:SETRANGE('Action Code','');
anveoPageElementMenu:SETRANGE('Linked Anveo Page','ASLS_NOTIFICATIONS');
anveoPageElementMenu:FINDFIRST();

--[[Get Multilanguage Entry for currently selected Language and Main Menu entry]]
local multilanguage = Record('ACF Multilanguage');
multilanguage:SETRANGE('PK Table No.', anveoPageElementMenu:GETTABLENO());
multilanguage:SETRANGE('Language', GLOBALLANGUAGECODE());
multilanguage:SETRANGE('PK No. 1', anveoPageElementMenu:GETVALUE('Anveo Page Element Line No.'));
multilanguage:SETRANGE('PK No. 2', anveoPageElementMenu:GETVALUE('Entry No.'));
multilanguage:FINDFIRST();
multilanguage:SETVALUE('Value','Hello World');
multilanguage:MODIFY(false);

Ejemplo para cambiar la tesela de notificación de las aplicaciones Anveo Base

El ejemplo para los avisos tiene el siguiente aspecto, incluida la modificación de los textos:

local function changeText(anveoPageElementMenu,text)
--[[Get Multilanguage Entry for currently selected Language and Main Menu entry]]
local multilanguage = Record('ACF Multilanguage');
multilanguage:SETRANGE('PK Table No.', anveoPageElementMenu:GETTABLENO());
multilanguage:SETRANGE('Language', GLOBALLANGUAGECODE());
multilanguage:SETRANGE('PK No. 1', anveoPageElementMenu:GETVALUE('Anveo Page Element Line No.'));
multilanguage:SETRANGE('PK No. 2', anveoPageElementMenu:GETVALUE('Entry No.'));
multilanguage:FINDFIRST();
multilanguage:SETVALUE('Value',text);
multilanguage:MODIFY(false);
end;

local anveoPageElementMenu = Record('ACF Anveo Page Element Menu');
local ACFNotification = Record('ACF Notification');
local colorRed = '#bd3939';
local colorGreen = '#00b050';
local colorBlue = '#5b9bd5';
local colorGray = '#7c7c7c';

-- [[get Main Menu Entry for My Messages]]
anveoPageElementMenu:SETRANGE('Anveo Page Code','');
anveoPageElementMenu:SETRANGE('Action Code','');
anveoPageElementMenu:SETRANGE('Linked Anveo Page','ASLS_NOTIFICATIONS');
anveoPageElementMenu:FINDFIRST();
--[[check if there are unread Notifications]]
local total = ACFNotification:COUNT();
ACFNotification:SETRANGE('Status', 5);
local unread = ACFNotification:COUNT();
if ACFNotification:ISEMPTY() then
--[[no unread messages]]
--[[set the background color to gray and set the symbol to "mail"]]
anveoPageElementMenu:SETVALUE('Background Color', colorGray);
anveoPageElementMenu:SETVALUE('Icon Description', 'mail');
anveoPageElementMenu:MODIFY(false);
--[[change Text accordingly]]
changeText(anveoPageElementMenu,GETTEXT('ASLS_NOTIFICATIONS',total));
else
--[[there are unread messages]]
--[[set the background color to red and set the symbol to "mail_open"]]
anveoPageElementMenu:SETVALUE('Background Color', colorRed);
anveoPageElementMenu:SETVALUE('Icon Description', 'mail_open');
anveoPageElementMenu:MODIFY(false);
--[[change Text accordingly]]
changeText(anveoPageElementMenu,GETTEXT('ASLS_NOTIFICATIONS_UNREAD',total,unread));
end;