vcl/jsdialog/executor.cxx |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 99937777801d0fc9574d03c40369de166f601d9c
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Mon Feb 15 19:43:17 2021 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Feb 23 15:21:52 2021 +0100

    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 <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 4c40109a5057..bca3d0a98ea7 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -242,11 +242,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;
                 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to