Add utils for GUI list
This commit is contained in:
@@ -12,6 +12,8 @@ let listDialog = {
|
||||
window: null,
|
||||
messageLabel: null,
|
||||
listGrid: null,
|
||||
|
||||
listRows: [],
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
@@ -78,7 +80,7 @@ function initListGUI() {
|
||||
|
||||
function showListGUI() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing login window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing list window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
listDialog.window.shown = true;
|
||||
@@ -90,19 +92,56 @@ function showListGUI() {
|
||||
// ===========================================================================
|
||||
|
||||
function checkListDialogSelection() {
|
||||
if (!listDialog.listGrid.activeRow) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sendNetworkEventToServer("agrp.list.select", listDialog.listGrid.activeRow.getEntryIndex());
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectPreviousListItem() {
|
||||
if (!listDialog.listGrid.activeRow) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let activeRowId = listDialog.listGrid.activeRow.getEntryIndex();
|
||||
if (activeRowId <= 1) {
|
||||
listDialog.listGrid.activeRow = 0;
|
||||
} else {
|
||||
listDialog.listGrid.activeRow = listDialog.listRows[activeRowId - 1];
|
||||
}
|
||||
|
||||
//sendNetworkEventToServer("agrp.list.next", listDialog.listGrid.activeRow.getEntryIndex());
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectNextListItem() {
|
||||
let activeRowId = listDialog.listGrid.activeRow.getEntryIndex();
|
||||
if (activeRowId >= listDialog.listRows.length - 1) {
|
||||
listDialog.listGrid.activeRow = 0;
|
||||
} else {
|
||||
listDialog.listGrid.activeRow = listDialog.listRows[activeRowId + 1];
|
||||
}
|
||||
|
||||
//sendNetworkEventToServer("agrp.list.next", listDialog.listGrid.activeRow.getEntryIndex());
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function clearListGUI() {
|
||||
listDialog.listGrid.removeAllEntries();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function populateListGUI(listItems) {
|
||||
for (let i in listItems) {
|
||||
let row = listDialog.listGrid.row(listItems[i]);
|
||||
listDialog.listRows.push(row);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user