pressing tab switches between textboxes in the deco editor

This commit is contained in:
jacob1 2014-02-06 12:15:26 -05:00
parent 1266307070
commit d38b7b9b11
5 changed files with 23 additions and 1 deletions

2
.gitignore vendored
View File

@ -51,7 +51,7 @@ Makefile.me
*.cbp
*.layout
*.config
*.creator
*.creator*
*.files
*.includes
config.log

View File

@ -241,6 +241,20 @@ void ColourPickerActivity::OnMouseUp(int x, int y, unsigned button)
}
}
void ColourPickerActivity::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
{
if (key == KEY_TAB)
{
if (rValue->IsFocused())
gValue->TabFocus();
else if (gValue->IsFocused())
bValue->TabFocus();
else if (bValue->IsFocused())
aValue->TabFocus();
else if (aValue->IsFocused())
rValue->TabFocus();
}
}
void ColourPickerActivity::OnDraw()
{

View File

@ -36,6 +36,7 @@ public:
virtual void OnMouseMove(int x, int y, int dx, int dy);
virtual void OnMouseDown(int x, int y, unsigned button);
virtual void OnMouseUp(int x, int y, unsigned button);
virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
virtual void OnTryExit(ExitMethod method);
ColourPickerActivity(ui::Colour initialColour, ColourPickedCallback * callback = NULL);
virtual ~ColourPickerActivity();

View File

@ -127,6 +127,12 @@ void Textbox::resetCursorPosition()
Graphics::PositionAtCharIndex(multiline?((char*)textLines.c_str()):((char*)text.c_str()), cursor, cursorPositionX, cursorPositionY);
}
void Textbox::TabFocus()
{
GetParentWindow()->FocusComponent(this);
selectAll();
}
void Textbox::cutSelection()
{
char * clipboardText;

View File

@ -42,6 +42,7 @@ public:
void SetInputType(ValidInput input);
void resetCursorPosition();
void TabFocus();
//Determines if the given character is valid given the input type
bool CharacterValid(Uint16 character);