Comments (9)
Oh snap, this is very annoying.
It's most likely cause by switching between UserPaint on (for the Hint) and UserPaint off (for the default system TextBox). Ill look around and hope to be able to fix it, but I don't directly see a solution for this. Customizing the TextBox is really a mess because of it not being painted in the paint method. I won't have much time though the next few days/weeks. (because of exams)
from materialskin.
I'm making progress by blocking the second mouse click if Hint should be visible. Still not perfect, there is a lot of flickering.
from materialskin.
Hmm I got this idea, maybe it would be better to completely hide the baseTextBox when the focus is lost & the hint should be shown. The hint could then be drawn in the baseTextBox's parent. And when it gets the focus back the base should be set visible again.
This way it would probably not flicker because it doesn't need the UserPaint flag anymore. The downside would be that when the baseTextBox got focus and the text is empty, the Hint can't be drawn.
from materialskin.
That sounds good, but there is 2 possible problems I can see:
- Cursor would have to be changed manually to the caret (right name?). This might be easy
- The right click menu, it wouldn't be able to show unless the user first selects the control. However if you're planing to create a material design context menu, it might not be a issue.
Actually the default behavior for hints in Windows seems to be to disappear when gaining focus. Which reminds me of something. Using this code:
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, string lParam);
SendMessage(TextBox.Handle, 0x1500 + 1, IntPtr.Zero.ToInt32(), "Hint");
You can set the hint of any TextBox, without needing anything else. Only problem is that the hint might be difficult to read on Dark theme since you can't change the hint color with this.
You should try it by inserting it into the BaseTextBox initializer, it might be good enough.
from materialskin.
Oh wow I didn't knew it was built in!
It's good enough for me, its properly readable in both dark & light. It looks even better than the current implementation because that isn't drawn 100% at where the text would appear when typed. The implementation will avoid many annoying flaws so I'd say we use it instead of the current custom Hint. Can you put it in the code? I'm going to study now 😛, if not no problem, then I'll do it tonight.
from materialskin.
I remembered having used it before in some old projects and found it again. :)
Yep, I can do it.
from materialskin.
Actually, maybe you wanna do it. That way you can close this issue as well. Here is the complete MaterialSingleLineTextField.cs code: http://pastebin.com/VH1m72DE.
Should just have to copy and paste. ;)
from materialskin.
I'm pretty sure you can just commit and write in the title issue #10, that way it's linked to this thread. Afterwards when I merge it, I can manually close this issue.
I kinda feel like stealing your work if I would commit it :P I'm not 100% sure though, as this is my first ever repository on GitHub.
from materialskin.
Ah, didn't know how it would work across repos. I'm not too experienced with GitHub myself. :)
from materialskin.
Related Issues (20)
- Screen resolutions not 100%
- MaterialTextBox "Password" Attribute is strange
- Mainform crashed when using Password Property HOT 2
- window 7 process
- Drawer does not show icons HOT 3
- MaterialSnackBar TopMost issue HOT 1
- How do I enable or disable (Show or Hide) a specific tabpage in a MaterialTabControl ?
- Textbox with Korean Char is not correctly entered
- MultiLineTextBox line wrapping and text appending
- TabSelector and TabPages
- Modify border style for drop shadow
- Setting TabControl Alignment property to left or right doesn't affect tab selector position.
- Font size can not be changed,字体大小不能更改 HOT 1
- Timers not allowed on forms with MaterialSkin.2? HOT 2
- Maximize on Second Monitor Goes Off Screen
- Save UI settings HOT 1
- MaterialSkin and MaterialSkin.2 Torjan (Wacatac.H!ml) HOT 1
- Font issue on foreign computers HOT 1
- How to write in a combobox HOT 3
- Save Click Event Handler in Expansion Panel.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from materialskin.