In the function svy_nav_favoriteMove in the svy_nav_navigation#3246 I found a little bug, with no excesive importancy but a little uncomfortable.
When i want to move the final element of the favourites to te left or the right, like you can see in the image
Show me an error that say can’t find the item.
Exception Object: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "shortcut_id" from undefined (/Applications/Servoys/Servoy_QCinst_nuevo/workspace/svy_nav_navigation/globals.js#3280)
MSG: TypeError: Cannot read property "shortcut_id" from undefined (/Applications/Servoys/Servoy_QCinst_nuevo/workspace/svy_nav_navigation/globals.js#3280)
<null>
Exception calling form method 'moveUp' with arguments [-1, -1, false, null, Move left, 0.0] on form 'svy_nav_fr_p_favorites'in async mode on solution jQCinst
TypeError: Cannot read property "shortcut_id" from undefined (/Applications/Servoys/Servoy_QCinst_nuevo/workspace/svy_nav_navigation/globals.js#3280)
at /Applications/Servoys/Servoy_QCinst_nuevo/workspace/svy_nav_navigation/globals.js:3280 (svy_nav_favoriteMove)
at /Applications/Servoys/Servoy_QCinst_nuevo/workspace/svy_nav_navigation/forms/svy_nav_fr_p_favorites.js:116 (moveUp)
I’m fixing mysqlf implementing one if after the line
if (_direction == 'down') {
_buttonnr_next = _buttonnr + 1
}
And the result is this:
if (globals.nav.shortcuts[_buttonnr_next] != undefined) {
/** @type {JSFoundset<db:/svy_framework/nav_shortcut>} */
var _fs = databaseManager.getFoundSet(globals.nav_db_framework, 'nav_shortcut')
// get the origenal record
if (_fs.find()) {
_fs.nav_shortcut_id = globals.nav.shortcuts[_buttonnr].shortcut_id
_fs.program_name = globals.nav.shortcuts[_buttonnr].program
_fs.search()
_rec_org = _fs.getRecord(1)
}
// get the next record
if (_fs.find()) {
_fs.nav_shortcut_id = globals.nav.shortcuts[_buttonnr_next].shortcut_id
_fs.program_name = globals.nav.shortcuts[_buttonnr_next].program
_fs.search()
_rec_next = _fs.getRecord(1)
}
// toggle the sortorder of the records
_sort_org = _rec_org.sort_order
_sort_next = _rec_next.sort_order
_rec_org.sort_order = _sort_next
_rec_next.sort_order = _sort_org
databaseManager.saveData(_rec_org)
databaseManager.saveData(_rec_next)
}
Another thing related to the favourites is the popup text is always in english, with any internationalitation, I think is better to internationalitate, like other texts in the login screen. The piece of code is this:
function popmenu(event) {
application.output(event.getElementName())
var _button = event.getElementName();
var _buttonnr = _button.replace(/[^0-9]/g, "") * 1
var popupmenu = plugins.window.createPopupMenu()
var _item = popupmenu.addMenuItem('Delete', deleteFavorite)
_item.methodArguments = [_buttonnr]
_item = popupmenu.addMenuItem('Move left', moveUp)
_item.methodArguments = [_buttonnr]
_item = popupmenu.addMenuItem('Move right', moveDown)
_item.methodArguments = [_buttonnr]
var source = event.getSource()
if (source != null) {
popupmenu.show(source);
}
}
This is in the file svy_nav_fr_p_favorites in the line 84. I can translate myself, but i think is better in new versions do the i18n.
