summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2021-02-15 19:43:17 -0400
committerHenry Castro <hcastro@collabora.com>2021-04-06 19:37:22 +0200
commita7f1439ca765384b8352a054ea2da28ef68c02ff (patch)
treedbf5490b34ac848525948177ab9c10929f8bca42 /vcl
parente90a9b6782b708b1add6ec912ef9c0e8d2b7c421 (diff)
lok: fix treeview action "select"
Unfortunately the Macros dialog has a treeview control that fill on demand and the position is absolute and it has a side effect to deselect the item since the relative entry position is nullptr. Change-Id: Ie442f6d634437a293cde65da0764d3f433a70155 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110963 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113677 Tested-by: Jenkins Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/jsdialog/executor.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 3644dc1bcf9b..de055a9c1700 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -220,11 +220,14 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
{
OString nRowString
= OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
- int nRow = std::atoi(nRowString.getStr());
-
pTreeView->unselect(pTreeView->get_selected_index());
- pTreeView->select(nRow);
- pTreeView->set_cursor(nRow);
+
+ int nAbsPos = std::atoi(nRowString.getStr());
+
+ std::unique_ptr<weld::TreeIter> itEntry(pTreeView->make_iterator());
+ pTreeView->get_iter_abs_pos(*itEntry, nAbsPos);
+ pTreeView->select(*itEntry);
+ pTreeView->set_cursor(*itEntry);
LOKTrigger::trigger_changed(*pTreeView);
return true;
}