Anveo Mobile App / Características da aplicação base / Legendas dinâmicas da telha no menu principal
Esta é uma tradução automática. O post original está disponível em Inglês .

Legendas dinâmicas da telha no menu principal

A mudança dinâmica das legendas dos mosaicos no menu principal é realizada dentro do acionador OnOpenMenu do menu principal correspondente. Desta forma, o ícone, a cor e o texto do mosaico podem ser ajustados.

Ícones/Cores

O ícone e a cor das telhas do menu principal são armazenados na tabela ACF Anveo Page Element Menu Para modificar esses valores no aplicativo, a entrada correspondente na tabela deve primeiro ser identificada. Todas as entradas de menu que não pertencem a uma Anveo Page são marcadas pelo campo Código de Anveo Page vazio.

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();

Nessa entrada, o símbolo e a cor de fundo podem ser modificados dinamicamente ao modificar os campos Background Color e Icon Description Um exemplo completo das notificações pode ter este aspecto:

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

Os textos das entradas do menu principal são definidos na tabela ACF Multilanguage. Eles são identificados pelo table number, campos PK e language. O campo contém o texto que é exibido. Para a tabela ACF Anveo Page Element Menu (no qual os azulejos do menu principal são armazenados), estes podem ser encontrados e alterados da seguinte forma:

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);

Exemplo de modificação do Tile de notificação das aplicações Anveo Base

O exemplo para as notas tem a seguinte aparência, incluindo a modificação dos 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;