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 Anvaigo 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 Anvaigo Page são marcadas pelo campo Código de Anvaigo Page vazio.
local anvaigoPageElementMenu = Record('ACF Anvaigo Page Element Menu');
-- [[get Main Menu Entry for My Messages]]
anvaigoPageElementMenu:SETRANGE('Anvaigo Page Code','');
anvaigoPageElementMenu:SETRANGE('Action Code','');
anvaigoPageElementMenu:SETRANGE('Linked Anvaigo Page','ASLS_NOTIFICATIONS');
anvaigoPageElementMenu: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 anvaigoPageElementMenu = Record('ACF Anvaigo 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]]
anvaigoPageElementMenu:SETRANGE('Anvaigo Page Code','');
anvaigoPageElementMenu:SETRANGE('Action Code','');
anvaigoPageElementMenu:SETRANGE('Linked Anvaigo Page','ASLS_NOTIFICATIONS');
anvaigoPageElementMenu: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"]]
anvaigoPageElementMenu:SETVALUE('Background Color', colorGray);
anvaigoPageElementMenu:SETVALUE('Icon Description', 'mail');
anvaigoPageElementMenu:MODIFY(false);
else
--[[there are unread messages]]
--[[set the background color to red and set the symbol to "mail_open"]]
anvaigoPageElementMenu:SETVALUE('Background Color', colorRed);
anvaigoPageElementMenu:SETVALUE('Icon Description', 'mail_open');
anvaigoPageElementMenu: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 Anvaigo Page Element Menu (no qual os azulejos do menu principal são armazenados), estes podem ser encontrados e alterados da seguinte forma:
local anvaigoPageElementMenu = Record('ACF Anvaigo Page Element Menu');
anvaigoPageElementMenu:SETRANGE('Anvaigo Page Code','');
anvaigoPageElementMenu:SETRANGE('Action Code','');
anvaigoPageElementMenu:SETRANGE('Linked Anvaigo Page','ASLS_NOTIFICATIONS');
anvaigoPageElementMenu:FINDFIRST();
--[[Get Multilanguage Entry for currently selected Language and Main Menu entry]]
local multilanguage = Record('ACF Multilanguage');
multilanguage:SETRANGE('PK Table No.', anvaigoPageElementMenu:GETTABLENO());
multilanguage:SETRANGE('Language', GLOBALLANGUAGECODE());
multilanguage:SETRANGE('PK No. 1', anvaigoPageElementMenu:GETVALUE('Anvaigo Page Element Line No.'));
multilanguage:SETRANGE('PK No. 2', anvaigoPageElementMenu: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 Anvaigo Base
O exemplo para as notas tem a seguinte aparência, incluindo a modificação dos textos:
local function changeText(anvaigoPageElementMenu,text)
--[[Get Multilanguage Entry for currently selected Language and Main Menu entry]]
local multilanguage = Record('ACF Multilanguage');
multilanguage:SETRANGE('PK Table No.', anvaigoPageElementMenu:GETTABLENO());
multilanguage:SETRANGE('Language', GLOBALLANGUAGECODE());
multilanguage:SETRANGE('PK No. 1', anvaigoPageElementMenu:GETVALUE('Anvaigo Page Element Line No.'));
multilanguage:SETRANGE('PK No. 2', anvaigoPageElementMenu:GETVALUE('Entry No.'));
multilanguage:FINDFIRST();
multilanguage:SETVALUE('Value',text);
multilanguage:MODIFY(false);
end;
local anvaigoPageElementMenu = Record('ACF Anvaigo 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]]
anvaigoPageElementMenu:SETRANGE('Anvaigo Page Code','');
anvaigoPageElementMenu:SETRANGE('Action Code','');
anvaigoPageElementMenu:SETRANGE('Linked Anvaigo Page','ASLS_NOTIFICATIONS');
anvaigoPageElementMenu: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"]]
anvaigoPageElementMenu:SETVALUE('Background Color', colorGray);
anvaigoPageElementMenu:SETVALUE('Icon Description', 'mail');
anvaigoPageElementMenu:MODIFY(false);
--[[change Text accordingly]]
changeText(anvaigoPageElementMenu,GETTEXT('ASLS_NOTIFICATIONS',total));
else
--[[there are unread messages]]
--[[set the background color to red and set the symbol to "mail_open"]]
anvaigoPageElementMenu:SETVALUE('Background Color', colorRed);
anvaigoPageElementMenu:SETVALUE('Icon Description', 'mail_open');
anvaigoPageElementMenu:MODIFY(false);
--[[change Text accordingly]]
changeText(anvaigoPageElementMenu,GETTEXT('ASLS_NOTIFICATIONS_UNREAD',total,unread));
end;