mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Start cursor at the end of text in single-line text popups.
Fixed an error message being in lower-case.
This commit is contained in:
parent
71700bd0c9
commit
1df8e6555d
|
@ -174,6 +174,16 @@ void TextEditComponent::moveCursor(int amt)
|
|||
onCursorChanged();
|
||||
}
|
||||
|
||||
void TextEditComponent::setCursor(size_t pos)
|
||||
{
|
||||
if(pos == std::string::npos)
|
||||
mCursor = mText.length();
|
||||
else
|
||||
mCursor = (int)pos;
|
||||
|
||||
moveCursor(0);
|
||||
}
|
||||
|
||||
void TextEditComponent::onTextChanged()
|
||||
{
|
||||
std::string wrappedText = (isMultiline() ? mFont->wrapText(mText, getTextAreaSize().x()) : mText);
|
||||
|
|
|
@ -28,6 +28,8 @@ public:
|
|||
inline bool isEditing() const { return mEditing; };
|
||||
inline const std::shared_ptr<Font>& getFont() const { return mFont; }
|
||||
|
||||
void setCursor(size_t pos);
|
||||
|
||||
virtual std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -138,7 +138,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
|
|||
if(mDeleteFunc)
|
||||
{
|
||||
auto deleteFileAndSelf = [&] { mDeleteFunc(); delete this; };
|
||||
auto deleteBtnFunc = [this, deleteFileAndSelf] { mWindow->pushGui(new GuiMsgBox(mWindow, "This will delete a file!\nAre you sure?", "YES", deleteFileAndSelf, "NO", nullptr)); };
|
||||
auto deleteBtnFunc = [this, deleteFileAndSelf] { mWindow->pushGui(new GuiMsgBox(mWindow, "THIS WILL DELETE A FILE!\nARE YOU SURE?", "YES", deleteFileAndSelf, "NO", nullptr)); };
|
||||
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, "DELETE", "delete", deleteBtnFunc));
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ GuiTextEditPopup::GuiTextEditPopup(Window* window, const std::string& title, con
|
|||
mText = std::make_shared<TextEditComponent>(mWindow);
|
||||
mText->setValue(initValue);
|
||||
|
||||
if(!multiLine)
|
||||
mText->setCursor(initValue.size());
|
||||
|
||||
std::vector< std::shared_ptr<ButtonComponent> > buttons;
|
||||
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, acceptBtnText, acceptBtnText, [this, okCallback] { okCallback(mText->getValue()); delete this; }));
|
||||
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, "CANCEL", "discard changes", [this] { delete this; }));
|
||||
|
|
Loading…
Reference in a new issue