From 1adae3160caf869429bf2b39a7e2110c3d6d87cf Mon Sep 17 00:00:00 2001
From: Thomas Goyne <plorkyeran@aegisub.org>
Date: Wed, 26 Jun 2013 12:15:31 -0700
Subject: [PATCH] Send a fake focus lost event to wxSpinCtrlDouble before
 reading the value

wxSpinCtrlDouble only updates its value when the spin button is clicked
or it loses focus, and in some cases we want to read the value while it
still has focus.

Closes #1610.
---
 aegisub/src/auto4_lua_dialog.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/aegisub/src/auto4_lua_dialog.cpp b/aegisub/src/auto4_lua_dialog.cpp
index 7b3506da6..47d81d773 100644
--- a/aegisub/src/auto4_lua_dialog.cpp
+++ b/aegisub/src/auto4_lua_dialog.cpp
@@ -350,7 +350,10 @@ namespace Automation4 {
 
 				bool TransferFromWindow()
 				{
-					*value = static_cast<wxSpinCtrlDouble*>(GetWindow())->GetValue();
+					wxSpinCtrlDouble *ctrl = static_cast<wxSpinCtrlDouble*>(GetWindow());
+					wxFocusEvent evt;
+					ctrl->OnTextLostFocus(evt);
+					*value = ctrl->GetValue();
 					return true;
 				}
 			};
-- 
GitLab