dbaccess/source/ui/control/FieldDescControl.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 037a9b4e3ccd0f3978f613c5a2feef44d9b2668d
Author:     Neil Roberts <[email protected]>
AuthorDate: Mon Oct 20 20:55:37 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Oct 21 07:59:19 2025 +0200

    FieldDescControl: Fix conditions needed to update the format sample
    
    OnControlFocusLost has a long if-chain of actions to perform for each
    control. The last one looks like it was trying to update the format
    sample whenever the default value changes. However, there’s already a
    case further up the chain that handles the case where the default value
    text box loses focus and the value is different from the saved value.
    That means the format sample would only end up being updated if the
    default value control loses focus but nothing was changed in it, which
    seems pretty clearly like a mistake. It makes it so the only way to make
    the format sample update after changing the default value is to first
    move the focus to another control, move it back to the default value and
    then move it away again.
    
    This patch just moves the format sample update into the same branch of
    the if-chain that already exists to handle the default value control.
    
    Change-Id: Ia4885589a7f50e01479972cceb4e7c6875efbde0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192753
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx 
b/dbaccess/source/ui/control/FieldDescControl.cxx
index 565d3dcdc4b2..ba2bf000d712 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -1078,7 +1078,10 @@ IMPL_LINK(OFieldDescControl, OnControlFocusLost, 
weld::Widget&, rControl, void )
     else if (m_xColumnName && &rControl == m_xColumnName->GetWidget() && 
m_xColumnName->get_value_changed_from_saved())
         CellModified(-1, m_xColumnName->GetPos());
     else if (m_xDefault && &rControl == m_xDefault->GetWidget() && 
m_xDefault->get_value_changed_from_saved())
+    {
         CellModified(-1, m_xDefault->GetPos());
+        UpdateFormatSample(pActFieldDescr);
+    }
     else if (m_xFormatSample && &rControl == m_xFormatSample->GetWidget() && 
m_xFormatSample->get_value_changed_from_saved())
         CellModified(-1, m_xFormatSample->GetPos());
     else if (m_xAutoIncrementValue && &rControl == 
m_xAutoIncrementValue->GetWidget() && 
m_xAutoIncrementValue->get_value_changed_from_saved())
@@ -1093,8 +1096,6 @@ IMPL_LINK(OFieldDescControl, OnControlFocusLost, 
weld::Widget&, rControl, void )
         CellModified(-1, m_xBoolDefault->GetPos());
     else if (m_xType && &rControl == m_xType->GetWidget() && 
m_xType->get_value_changed_from_saved())
         CellModified(-1, m_xType->GetPos());
-    else if (m_xDefault && &rControl == m_xDefault->GetWidget())
-        UpdateFormatSample(pActFieldDescr);
 
     implFocusLost(&rControl);
 }

Reply via email to