private void LoadTabContent(Tab tab) { tabContents.Clear(); if (settings == null) { return; } var table = tab.userData as LocalizationTable; var entries = table !.Entries; var scrollView = new ScrollView(ScrollViewMode.VerticalAndHorizontal); keyColumn = Factory.Create <VisualElement>(null, "table-col"); keyColumn.AddGet(new TableCell("key", false)).AddToClassList("header"); for (var i = 0; i < entries.Count; i++) { keyColumn.Add(MakeKeyCell(table, entries[i].Key, i)); } createEntry = new TableCell("Add...", true) { name = "CreateEntryCell" }; createEntry.OnValueChanged += CreateEntry; createEntry.OnBeginEdit += field => { field.value = ""; }; createEntry.OnCancelEdit += field => { createEntry.Text = "Add..."; }; createEntry.OnNextCellSelected += () => Schedule(0, () => GetCell(keyColumn.childCount - 3, 1)?.BeginEdit()); createEntry.OnPreviousCellSelected += () => Schedule(0, () => GetCell(keyColumn.childCount - 3, localeColumns.Count)?.BeginEdit()); createEntry.OnNextRowSelected += () => Schedule(0, () => createEntry.BeginEdit()); createEntry.OnPreviousRowSelected += () => Schedule(0, () => GetCell(keyColumn.childCount - 3, 0)?.BeginEdit()); keyColumn.Add(createEntry); var locales = settings.Locales; localeColumns = new List <VisualElement>(locales.Count); for (var i = 0; i < locales.Count; i++) { var col = i; var locale = locales[i]; var isDefaultLocale = locale.Equals(settings.DefaultLocale); var localeColumn = Factory.Create <VisualElement>(null, "table-col"); localeColumn.Add(new TableCell($"{locale.EnglishName}{(isDefaultLocale ? " - Default" : "")}", false).Do(cell => { cell.AddToClassList("header"); if (isDefaultLocale) { cell.AddToClassList("bold"); } })); for (var j = 0; j < entries.Count; j++) { var row = j; localeColumn.Add(MakeCell(entries[row].Values[col], row, col, table)); } // Add empty cell for Add entry cell localeColumn.Add(new TableCell("", false)); localeColumns.Add(localeColumn); } var tableElement = new VisualElement { name = "Table" }; tableElement.AddToClassList("table"); tableElement.Add(keyColumn); foreach (var column in localeColumns) { tableElement.Add(column); } tableElement.Add(scrollView); scrollView.Add(tableElement); tabContents.Add(scrollView); }