View Bug Details

IDProjectCategoryView StatusLast Update
0001944DCP-o-maticBugspublic2023-09-01 21:49
Reportercarl Assigned Tocarl  
PriorityimmediateSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Target Version2.16.0 
Summary0001944: Can't enter numbers in some dialog fields
Description

Really strange; on macOS can't type numbers into the subtitle scale %age/offset fields (sometimes it's just the offset fields).

TagsNo tags attached.
Branch
Estimated weeks required
Estimated work required

Activities

carl

2021-03-29 01:39

administrator   ~0004197

Attached seems to fix it; SetRange() changes to fix the non-entry of numbers and the rest to make "Enter" work properly.

foo (2,906 bytes)   
diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc
index ec4904afd..b4113a526 100644
--- a/src/wx/text_panel.cc
+++ b/src/wx/text_panel.cc
@@ -52,6 +52,7 @@ using std::shared_ptr;
 using boost::optional;
 using std::dynamic_pointer_cast;
 using boost::bind;
+using namespace boost::placeholders;
 
 /** @param t Original text type of the content, if known */
 TextPanel::TextPanel (ContentPanel* p, TextType t)
@@ -100,7 +101,7 @@ TextPanel::TextPanel (ContentPanel* p, TextType t)
 
 	_scale_label = create_label (this, _("Scale"), true);
 	_x_scale_label = create_label (this, _("X"), true);
-	_x_scale = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(spin_width, -1));
+	_x_scale = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(spin_width, -1), wxSP_ARROW_KEYS | wxTE_PROCESS_ENTER);
 	_x_scale_pc_label = new StaticText (this, _("%"));
 	_y_scale_label = create_label (this, S_("Coord|Y"), true);
 	_y_scale = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(spin_width, -1));
@@ -119,8 +120,8 @@ TextPanel::TextPanel (ContentPanel* p, TextType t)
 
 	_x_offset->SetRange (-100, 100);
 	_y_offset->SetRange (-100, 100);
-	_x_scale->SetRange (10, 1000);
-	_y_scale->SetRange (10, 1000);
+	_x_scale->SetRange (0, 1000);
+	_y_scale->SetRange (0, 1000);
 	_line_spacing->SetRange (10, 1000);
 
 	_reference->Bind                (wxEVT_CHECKBOX, boost::bind (&TextPanel::reference_clicked, this));
@@ -130,6 +131,7 @@ TextPanel::TextPanel (ContentPanel* p, TextType t)
 	_x_offset->Bind                 (wxEVT_SPINCTRL, boost::bind (&TextPanel::x_offset_changed, this));
 	_y_offset->Bind                 (wxEVT_SPINCTRL, boost::bind (&TextPanel::y_offset_changed, this));
 	_x_scale->Bind                  (wxEVT_SPINCTRL, boost::bind (&TextPanel::x_scale_changed, this));
+	_x_scale->Bind			(wxEVT_TEXT_ENTER, boost::bind (&TextPanel::x_scale_enter, this, _1));
 	_y_scale->Bind                  (wxEVT_SPINCTRL, boost::bind (&TextPanel::y_scale_changed, this));
 	_line_spacing->Bind             (wxEVT_SPINCTRL, boost::bind (&TextPanel::line_spacing_changed, this));
 	_stream->Bind                   (wxEVT_CHOICE,   boost::bind (&TextPanel::stream_changed, this));
@@ -141,6 +143,12 @@ TextPanel::TextPanel (ContentPanel* p, TextType t)
 	content_selection_changed ();
 }
 
+void
+TextPanel::x_scale_enter (wxCommandEvent& ev)
+{
+	dynamic_cast<wxWindow*>(ev.GetEventObject())->Navigate();
+}
+
 void
 TextPanel::setup_visibility ()
 {
diff --git a/src/wx/text_panel.h b/src/wx/text_panel.h
index f35f39cbe..446fed602 100644
--- a/src/wx/text_panel.h
+++ b/src/wx/text_panel.h
@@ -42,6 +42,7 @@ private:
 	void x_offset_changed ();
 	void y_offset_changed ();
 	void x_scale_changed ();
+	void x_scale_enter (wxCommandEvent& ev);
 	void y_scale_changed ();
 	void line_spacing_changed ();
 	void dcp_track_changed ();
foo (2,906 bytes)   

carl

2021-03-29 01:40

administrator   ~0004198

See https://forums.wxwidgets.org/viewtopic.php?t=46747&amp;p=196332

carl

2021-03-29 21:39

administrator   ~0004199

5baecb091f5f3f956be002668ce74291c7826b95

Bug History

Date Modified Username Field Change
2021-03-28 23:21 carl New Bug
2021-03-28 23:22 carl Assigned To => carl
2021-03-28 23:22 carl Status new => confirmed
2021-03-29 01:39 carl Note Added: 0004197
2021-03-29 01:39 carl File Added: foo
2021-03-29 01:40 carl Note Added: 0004198
2021-03-29 21:39 carl Status confirmed => resolved
2021-03-29 21:39 carl Resolution open => fixed
2021-03-29 21:39 carl Note Added: 0004199
2023-09-01 21:49 carl Status resolved => closed