+
+ if(!style)
+ {
+ text_part = 0;
+ return;
+ }
+
+ text_part = style->get_part("text");
+
+ if(multiline)
+ check_view_range();
+}
+
+void Entry::set_edit_position(unsigned ep)
+{
+ edit_pos = ep;
+ check_view_range();
+ rebuild();
+}
+
+void Entry::check_view_range()
+{
+ if(!multiline || !text_part)
+ return;
+
+ float font_size = style->get_font_size();
+ unsigned line_spacing = static_cast<unsigned>(font_size*6/5);
+
+ const Sides &margin = text_part->get_margin();
+ visible_rows = max((geom.h-margin.top-margin.bottom)/line_spacing, 1U);
+
+ unsigned row, col;
+ text.offset_to_coords(edit_pos, row, col);
+
+ if(first_row>row)
+ first_row = row;
+ else if(row>=first_row+visible_rows)
+ first_row = row+1-visible_rows;
+
+ unsigned scroll = max(text.get_n_lines(), visible_rows)-visible_rows;
+ slider->set_range(0, scroll);
+ slider->set_value(scroll-first_row);
+}
+
+void Entry::slider_value_changed(double value)
+{
+ if(text.get_n_lines()>visible_rows)
+ first_row = text.get_n_lines()-visible_rows-static_cast<unsigned>(value);