diff --git a/src/osdep/gui/ShowCustomFields.cpp b/src/osdep/gui/ShowCustomFields.cpp index dea6508ec..d0341f872 100644 --- a/src/osdep/gui/ShowCustomFields.cpp +++ b/src/osdep/gui/ShowCustomFields.cpp @@ -106,9 +106,8 @@ static ShowCustomFieldsActionListener* showCustomFieldsActionListener; void create_custom_field(custom_widget& widget, const int number, const std::string& caption, const whdload_custom& custom_field, int& pos_y, const int custom_list_index) { - constexpr int textfield_width = 350; + constexpr int textfield_width = 300; constexpr int pos_x1 = DISTANCE_BORDER; - constexpr int pos_x2 = 200; for (int i = 0; i < number; i++) { std::string id; @@ -118,6 +117,8 @@ void create_custom_field(custom_widget& widget, const int number, const std::str widget.lbl.emplace_back(label); wndShowCustomFields->add(label); + int pos_x2 = label->getWidth() + 15; + switch (custom_field.type) { case bit_type: { auto checkbox = new gcn::CheckBox(custom_field.label_bit_pairs[i].first); @@ -150,6 +151,9 @@ void create_custom_field(custom_widget& widget, const int number, const std::str case list_type: { label->setCaption(custom_field.caption); label->adjustSize(); + pos_x2 = textfield_width + 15; + label->setPosition(pos_x2, pos_y); + for (const auto& item : custom_field.labels) { custom_list[custom_list_index].add(item); @@ -162,7 +166,7 @@ void create_custom_field(custom_widget& widget, const int number, const std::str dropdown->setForegroundColor(gui_foreground_color); dropdown->setSelectionColor(gui_selection_color); dropdown->addActionListener(showCustomFieldsActionListener); - dropdown->setPosition(pos_x2, pos_y); + dropdown->setPosition(pos_x1, pos_y); widget.list.emplace_back(dropdown); wndShowCustomFields->add(dropdown); pos_y += dropdown->getHeight() + 8;