IgnaceMaes / MaterialSkin

Theming .NET WinForms, C# or VB.Net, to Google's Material Design Principles.
MIT License
2.86k stars 831 forks source link

Double tab key for move to next MaterialSingleLineTextField #51

Closed carlosvzz closed 9 years ago

carlosvzz commented 9 years ago

When you have 2 (or more) MaterialSingleLineTextField with consecutive tab order, you need to press Tab twice to get the focus on the next one.... i'm looking to just need 1 press on tab to get the focus on next Textfiled

lukeskinner commented 9 years ago

I'll see if I can make a PR for this later today - it only requires 2 lines of code to be added to the MaterialSingleLineTextField control.

This is happening because the MaterialSingleLineTextField component inherits from the Control base class and adds a TextBox to its control collection. This means there are technically 2 controls inside the MaterialSingleLineTextField. Setting the TabStop property on the MaterialSingleLineTextField to false and the baseTextBox to true fixes this.

public MaterialSingleLineTextField()
{
   //... 
   baseTextBox.TabStop = true;
   this.TabStop = false;
}
carlosvzz commented 9 years ago

Thanks, that's the solution .... now it works with just 1 tab press .....

Frank-Shaw-FS commented 9 years ago

Why this control need to add a textbox control inside the control, it seems just inherited from the textbox can do the same work.

IgnaceMaes commented 9 years ago

@lukeskinner Thanks for posting the solution. I'm currently quite busy with my exams but if I find the time I'll make a commit to fix this issue. (If you haven't done already)

@Frank-Explorer It is needed to be able to draw the bottom line animation. If you want to have your own custom drawing in the TextBox you lose the systems one. (You aren't able to draw a line under it) A workaround for this problem is creating a wrapper control (containing a normal TextBox) and doing the animation in there.

P4R4DiSi4C commented 7 years ago

Hello, You should push this fixes to the nuget package :+1: