Added some functions to the text_field to control input focus and

select text.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402823
This commit is contained in:
Davis King 2009-01-18 23:15:21 +00:00
parent 74aaea6f2b
commit f739b89a96
3 changed files with 44 additions and 0 deletions

View File

@ -442,6 +442,29 @@ namespace dlib
right_click_menu.enable();
}
// ----------------------------------------------------------------------------------------
void text_field::
give_input_focus (
)
{
auto_mutex M(m);
has_focus = true;
cursor_visible = true;
parent.invalidate_rectangle(rect);
t.start();
}
// ----------------------------------------------------------------------------------------
void text_field::
select_all_text (
)
{
auto_mutex M(m);
on_select_all();
}
// ----------------------------------------------------------------------------------------
void text_field::

View File

@ -409,6 +409,12 @@ namespace dlib
const std::wstring& text_
);
void give_input_focus (
);
void select_all_text (
);
void set_text (
const dlib::ustring& text_
);

View File

@ -526,6 +526,21 @@ namespace dlib
nothing else changes.
!*/
void give_input_focus (
);
/*!
ensures
- gives this text field input keyboard focus
!*/
void select_all_text (
);
/*!
ensures
- causes all the text in the text field to become selected.
(note that it doesn't give input focus)
!*/
void set_text_color (
const rgb_pixel color
);