fix bug that spinbox always resets the caret(#185)
This commit is contained in:
parent
9f366ab008
commit
2829a6c2de
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* A Spin box widget
|
* A Spin box widget
|
||||||
* Nana C++ Library(http://www.nanapro.org)
|
* Nana C++ Library(http://www.nanapro.org)
|
||||||
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
|
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* A Spin box widget
|
* A Spin box widget
|
||||||
* Nana C++ Library(http://www.nanapro.org)
|
* Nana C++ Library(http://www.nanapro.org)
|
||||||
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
|
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -295,13 +295,13 @@ namespace nana
|
|||||||
return range_->value();
|
return range_->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool value(const ::std::string& value_str)
|
bool value(const ::std::string& value_str, bool reset_editor)
|
||||||
{
|
{
|
||||||
bool diff;
|
bool diff;
|
||||||
if (!range_->value(value_str, diff))
|
if (!range_->value(value_str, diff))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (diff)
|
if (diff && reset_editor)
|
||||||
reset_text();
|
reset_text();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -572,7 +572,7 @@ namespace nana
|
|||||||
{
|
{
|
||||||
if (impl_->editor()->respond_char(arg))
|
if (impl_->editor()->respond_char(arg))
|
||||||
{
|
{
|
||||||
if (!impl_->value(to_utf8(impl_->editor()->text())))
|
if (!impl_->value(to_utf8(impl_->editor()->text()), false))
|
||||||
impl_->draw_spins();
|
impl_->draw_spins();
|
||||||
|
|
||||||
API::dev::lazy_refresh();
|
API::dev::lazy_refresh();
|
||||||
@ -657,7 +657,7 @@ namespace nana
|
|||||||
internal_scope_guard lock;
|
internal_scope_guard lock;
|
||||||
if (handle())
|
if (handle())
|
||||||
{
|
{
|
||||||
if (get_drawer_trigger().impl()->value(s))
|
if (get_drawer_trigger().impl()->value(s, true))
|
||||||
API::refresh_window(handle());
|
API::refresh_window(handle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user