From 037ef43594fe13a7aae1e4b63490adb3a599f349 Mon Sep 17 00:00:00 2001 From: PearlWang Date: Wed, 15 May 2019 09:25:37 +0800 Subject: [PATCH] add text() function to class textbox --- include/nana/gui/widgets/textbox.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/nana/gui/widgets/textbox.hpp b/include/nana/gui/widgets/textbox.hpp index 68c408b7..8557c68a 100644 --- a/include/nana/gui/widgets/textbox.hpp +++ b/include/nana/gui/widgets/textbox.hpp @@ -1,4 +1,4 @@ -/** +/** * A Textbox Implementation * Nana C++ Library(http://www.nanapro.org) * Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com) @@ -177,6 +177,10 @@ namespace nana /// Read the text from a specified line with a set offset. It returns true for success. bool getline(std::size_t line_index,std::size_t offset,std::string& text) const; + // Get all text from textbox. + // It returns a empty string if failed or the textbox is empty. + std::string text() const { return caption(); } + /// Read the text from a specified line; returns an empty optional on failure std::optional getline(std::size_t pos) const;