-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alt Key accelerators aren't rendered #196
Comments
I don't understand what should work. What is AccessKey? I see HotKey on the Button for instance. |
Stack trace when access key was pressed on Avalonia under Linux:
|
Yeah I think the buttons works it's the visualization that doesn't |
No, ALT and other modifiers are not processed in Consolonia (but do in Avalonia). |
I've done handling for Windows (CTRL, SHIFT and ALT added). The question:
@tomlm We probably can not draw this properly, right? Do we need some own special AccessText control? |
Oh awesome! Just make the pen stroke thickness UnderlineThickness and it will turn the text to TextDecoration underline! internal class DrawingContextImpl : IDrawingContextImpl
{
public const int UnderlineThickness = 10; |
oh I see, I think a custom AccessText with UnderlineThickness. Kind of sucks but should work. Technically it's an avalonia bug, as AccessText should be using FontMetrics.UnderlineThickness which in our case is set to the correct magic value. |
I filed a bug with Avalonia, AvaloniaUI/Avalonia#17763 |
But how does it help us. Its entire string being rendered, will be entire string underline, not just one symbol |
no, it's using a pen over the top of characters to draw the underline. Avalonia doesn't use the font system to underline, it draws them with pens. It's drawing an underline under just the accelerator key character. TextBlock normally uses the FontMetric.UnderlineThickness to do that, and so I use a thickness of 10 to signify that we should apply TextDecoration of underline to the pixel. Our FontMetric.UnderlinePosition = -1, so it causes the line to be drawn on the same pixels that are the text, and the thickness tells me to change the TextDecoration of the text....then when we render we Esc output the text with underline escape sequence. |
As a workaround we can implement own AccessText. |
Blarg. AccessText is using internal shit. |
I want to check what we've got on linux and default .net console also |
@tomlm UX question: in some cases we can not receive ALT key alone. My suggesion:
|
I think leaving them on is fine. That's what Windows 3.x used to do. |
Menu, Button, etc.
I looked into it and figured this much out:
I updated ConsoleWindow.cs to look like this:
Much to my dismay, this did not fix it. I think that somehow the accesskeyhandler is not being registered correctly because our root window is a ConsoleWindow, but I haven't figured out where/how that happens. It looks like it might have something to do with TopLevel, which we don't even implement? Each control calls RegisterServices and inside there it seems to create an accesshandler...?
Anyhow. I though I would file this bug with my learnings to hopefully help either me or the next guy who comes along and tries to fix this.
The text was updated successfully, but these errors were encountered: