Denis Molchanov 1 Posted October 27, 2020 Share Posted October 27, 2020 К примеру, делаю: MainNavigator.Items[1].Selected := true; Но эффекта это не приносит. Как был выделен первый элемент, так и остается. Должно наверное быть что-то Repaint или Refresh ? Quote Link to post Share on other sites
Denis Molchanov 1 Posted October 27, 2020 Author Share Posted October 27, 2020 Я нашел на форуме: ANode.Selected := true; with MainNavigator do begin JSInterface.JSCall('getActiveItem().select', [ANode.Id]); JSInterface.JSCall('getActiveItem().ensureVisible', [ANode.Id]); end; Но у меня выдает ошибку: Quote Link to post Share on other sites
Sherzod 1183 Posted October 27, 2020 Share Posted October 27, 2020 3 hours ago, Denis Molchanov said: MainNavigator В вашем случае, это одноуровневый список? Quote Link to post Share on other sites
Denis Molchanov 1 Posted October 28, 2020 Author Share Posted October 28, 2020 Нет, не одноуровневый. --------------------------- Элемент 1 Элемент 2 --- Элемент 2.1 --- Элемент 2.2 Элемент 3 --------------------------- Сначала нахожу Элемент 3 по его SelectedIndex, а затем пытаюсь его выделить: function TMainmForm.GetNavItemBySelectedIndex( ASelectedIndex: Integer): TUniTreeNode; var i : Integer; begin result := nil; for I := 0 to MainNavigator.Items.Count - 1 do if MainNavigator.Items[i].SelectedIndex = ASelectedIndex then begin result := MainNavigator.Items[i]; break; end; end; ---- var ANode : TUniTreeNode; begin ANode := GetNavItemBySelectedIndex(2); if ANode <> nil then begin ANode.Selected := true; DebugInfoStr('ANode ID: ' + IntToStr(ANode.Id)); with MainNavigator do begin JSInterface.JSCall('getActiveItem().select', [ANode.Id]); JSInterface.JSCall('getActiveItem().ensureVisible', [ANode.Id]); end; MainNavigatorLeafClick(nil); end; end; Quote Link to post Share on other sites
Sherzod 1183 Posted October 28, 2020 Share Posted October 28, 2020 8 hours ago, Denis Molchanov said: Нет, не одноуровневый. Нужно проанализировать. Еще один вопрос. С какой целью Вы хотите программно выделить узел!? Quote Link to post Share on other sites
Denis Molchanov 1 Posted October 29, 2020 Author Share Posted October 29, 2020 Хотел сделать переход из одного раздела в другой по ссылке. В примере на скриншоте при нажатии на "13", должен открываться раздел "Сотрудники". Открыть у меня его получается, но хочется чтобы еще и в навигаторе этот раздел был подсвечен\выделен. Quote Link to post Share on other sites
Sherzod 1183 Posted October 29, 2020 Share Posted October 29, 2020 4 hours ago, Denis Molchanov said: Хотел сделать переход из одного раздела в другой по ссылке. В примере на скриншоте при нажатии на "13", должен открываться раздел "Сотрудники". Здравствуйте, Если список одноуровневый, то выделить можно. На данный момент, у меня возникает проблема с многоуровневым списком. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.