Browse Source

hide and show inputbox.

repros/web-null-signature
Dan Walmsley 5 years ago
parent
commit
3e5f3f6281
  1. 8
      samples/ControlCatalog.Web/wwwroot/index.html
  2. 20
      src/Web/Avalonia.Blazor/AvaloniaView.razor.cs

8
samples/ControlCatalog.Web/wwwroot/index.html

@ -38,6 +38,14 @@
setCursor = (kind) => {
document.getElementById("inputBox").style.cursor = kind;
};
hideInput = () => {
document.getElementById('inputBox').style.display = 'none';
};
showInput = () => {
document.getElementById('inputBox').style.display = 'block';
};
</script>
</html>

20
src/Web/Avalonia.Blazor/AvaloniaView.razor.cs

@ -165,6 +165,7 @@ namespace Avalonia.Blazor
{
Avalonia.Threading.Dispatcher.UIThread.Post(async () =>
{
await Js.InvokeVoidAsync("hideInput");
await Js.InvokeVoidAsync("setCursor", "default");
Console.WriteLine("starting html canvas setup");
@ -256,22 +257,35 @@ namespace Avalonia.Blazor
public void SetActive(bool active)
{
Console.WriteLine("focus input box.");
Console.WriteLine($"focus input box. {active}");
Js.InvokeVoidAsync("clearInput");
Js.InvokeVoidAsync("focusInput");
if (active)
{
Js.InvokeVoidAsync("showInput");
Js.InvokeVoidAsync("focusInput");
}
else
{
Js.InvokeVoidAsync("hideInput");
}
}
public void SetCursorRect(Rect rect)
{
Console.WriteLine("SetCursorRect");
}
public void SetOptions(TextInputOptionsQueryEventArgs options)
{
Console.WriteLine("SetOptions");
}
public void Reset()
{
Console.WriteLine("reset");
Js.InvokeVoidAsync("clearInput");
}
}
}
}

Loading…
Cancel
Save