Skip to content

Commit

Permalink
pressing tab switches between textboxes in the deco editor
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Feb 6, 2014
1 parent 1266307 commit d38b7b9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -51,7 +51,7 @@ Makefile.me
*.cbp
*.layout
*.config
*.creator
*.creator*
*.files
*.includes
config.log
Expand Down
14 changes: 14 additions & 0 deletions src/gui/colourpicker/ColourPickerActivity.cpp
Expand Up @@ -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()
{
Expand Down
1 change: 1 addition & 0 deletions src/gui/colourpicker/ColourPickerActivity.h
Expand Up @@ -36,6 +36,7 @@ class ColourPickerActivity: public WindowActivity {
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();
Expand Down
6 changes: 6 additions & 0 deletions src/gui/interface/Textbox.cpp
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/gui/interface/Textbox.h
Expand Up @@ -42,6 +42,7 @@ class Textbox : public Label
void SetInputType(ValidInput input);

void resetCursorPosition();
void TabFocus();
//Determines if the given character is valid given the input type
bool CharacterValid(Uint16 character);

Expand Down

0 comments on commit d38b7b9

Please sign in to comment.