Didascalie delle mattonelle dinamiche nel menu principale
La modifica dinamica delle didascalie delle tegole nel menu principale viene eseguita all’interno del menu principale corrispondente, all’interno del menu principale OnOpenMenMenu Trigger. In questo modo è possibile regolare l’icona, il colore e il testo della piastrella.
Icone/Colori
L’icona e il colore delle caselle del menu principale sono memorizzati nella tabella ACF Anvaigo Page Element Menu. Per modificare questi valori nell’applicazione, è necessario identificare prima la voce corrispondente nella tabella. Tutte le voci di menu che non appartengono ad una Anvaigo Page sono contrassegnate dal campo Codice Anvaigo Page vuoto.
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();
In questa voce, il simbolo e il colore di sfondo possono essere modificati dinamicamente cambiando i campi Background Color e Icon Description. Un esempio completo delle notifiche potrebbe assomigliare a questo:
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;
Testo
I testi per le voci del menu principale sono definiti nella tabella ACF Multilanguage. Sono identificati dal table number, dai campi PK e dalla language. Il campo contiene il testo visualizzato. Per la tabella ACF Anvaigo Page Element Menu (in cui sono memorizzati i riquadri del menu principale) questi possono essere trovati e modificati come segue:
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);
Esempio di modifica della mattonella di notifica delle applicazioni Anvaigo Base Apps
L’esempio per le notifiche è il seguente, compresa la modifica dei testi:
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;