fix bug that textbox::caret_pos() doesn't move the caret

This commit is contained in:
Jinhao
2017-07-16 21:42:24 +08:00
parent a7bfc61007
commit 822a762804
4 changed files with 46 additions and 12 deletions

View File

@@ -149,12 +149,13 @@ namespace nana{ namespace widgets
void text(std::wstring, bool end_caret);
std::wstring text() const;
/// Sets caret position through text coordinate.
/// Moves the caret at specified position
/**
* @param pos the text position
* @param reset indicates whether to reset the text position by the pos. If this parameter is true, the text position is set by pos. If the parameter is false, it only moves the UI caret to the specified position.
* @param stay_in_view Indicates whether to adjust the view to make the caret in view. This parameter is ignored if the caret is already in view.
* @return true indicates a refresh is required.
*/
bool move_caret(const upoint& pos, bool reset = false);
bool move_caret(upoint pos, bool stay_in_view = false);
void move_caret_end(bool update);
void reset_caret_pixels() const;
void reset_caret(bool stay_in_view = false);

View File

@@ -175,6 +175,9 @@ namespace nana
/// Returns true if the caret is in the area of display, false otherwise.
bool caret_pos(point& pos, bool text_coordinate) const;
/// Gets the caret position, in text coordinate
upoint caret_pos() const;
/// Sets the caret position with a text position
textbox& caret_pos(const upoint&);