chromelyapps / Chromely

Build Cross Platform HTML Desktop Apps on .NET using native GUI, HTML5, JavaScript, CSS, Owin, AspNetCore (MVC, RazorPages, Blazor)
MIT License
2.98k stars 280 forks source link

Backspace in kiosk mode not working #331

Closed software-driven closed 3 years ago

software-driven commented 3 years ago

When the kiosk mode is activated, it is quite inconvenient to delete inputs from a text field, since the backspace key does not work. Is it possible to allow this key?

mattkol commented 3 years ago

@software-driven It could be due to this: https://github.com/chromelyapps/Chromely/blob/3cdb28e16182651e7fbec193593c07343e657e85/src/Chromely/NativeHosts/WinHost/WinBase/DefaulKeyboadHookHandler.cs#L82

This part of kiosk mode was contributed by @Soarc and was well tested at the time. If this is the issue, there may be a good reason why it was disallowed, but I do not know if it is a standard for kiosk mode or just specific to what @Soarc was doing at the time.

Meanwhile I will suggest you try remove that and see, by creating a custom keyboard handler using the default implemetation.

    public class DemoApp : ChromelyBasicApp
    {
        public override void ConfigureServices(IServiceCollection services)
        {
            base.ConfigureServices(services);
            services.AddSingleton<IKeyboadHookHandler, CustomKeyboadHookHandler>();

            ----
        }
    }

    public class CustomKeyboadHookHandler : IKeyboadHookHandler
    {
    }

Based on your feedback, we can update the default implementation. If @Soarc respond too, we can use both feedbacks.

software-driven commented 3 years ago

@mattkol thank you for your prompt reply. As suggested, I have created a custom implementation based on the default.

if (key < Keys.Back || instead of if (key <= Keys.Back || fixes the issue with the backspace key.

Soarc commented 3 years ago

If I remember correctly, I added because it, because it was possible to go on initial screen using back button and broke kiosk mode. I'm not sure, if it still case.

mattkol commented 3 years ago

Thanks for the feedback @Soarc. @software-driven please let me know if your fix is still valid based on @Soarc comment.

MrCircuit commented 3 years ago

Hi there

The param of the HandleKey interface is filled in with an object of an internal class of yours (KeyboardParam). Can you change its modifier to public? Otherwise, we can't use the custom keyboard handler at all...

Best regards Uwe

MrCircuit commented 3 years ago

Thanks!