WT_USTRING WLineEdit::selectedText() const { if (selectionStart() != -1) { WApplication *app = WApplication::instance(); return WString::fromUTF8(UTF8Substr(text().toUTF8(), app->selectionStart(), app->selectionEnd() - app->selectionStart())); } else return WString::Empty; }
int WLineEdit::selectionStart() const { WApplication *app = WApplication::instance(); if (app->focus() == id()) { if (app->selectionStart() != -1 && app->selectionEnd() != app->selectionStart()) { return app->selectionStart(); } else return -1; } else return -1; }
WT_USTRING WLineEdit::selectedText() const { if (selectionStart() != -1) { WApplication *app = WApplication::instance(); std::string result = UTF8Substr(text().toUTF8(), app->selectionStart(), app->selectionEnd() - app->selectionStart()); #ifdef WT_TARGET_JAVA return result; #else return WString::fromUTF8(result); #endif } else return WString::Empty; }