GithubHelp home page GithubHelp logo

Comments (9)

IgnaceMaes avatar IgnaceMaes commented on August 11, 2024

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.

AlexxEG avatar AlexxEG commented on August 11, 2024

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.

IgnaceMaes avatar IgnaceMaes commented on August 11, 2024

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.

AlexxEG avatar AlexxEG commented on August 11, 2024

That sounds good, but there is 2 possible problems I can see:

  1. Cursor would have to be changed manually to the caret (right name?). This might be easy
  2. 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.

IgnaceMaes avatar IgnaceMaes commented on August 11, 2024

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.

AlexxEG avatar AlexxEG commented on August 11, 2024

I remembered having used it before in some old projects and found it again. :)

Yep, I can do it.

from materialskin.

AlexxEG avatar AlexxEG commented on August 11, 2024

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.

IgnaceMaes avatar IgnaceMaes commented on August 11, 2024

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.

AlexxEG avatar AlexxEG commented on August 11, 2024

Ah, didn't know how it would work across repos. I'm not too experienced with GitHub myself. :)

from materialskin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.