Gwynneth
Topic Author
Posts: 15
Joined: 20 Apr 2017, 18:31

TextBox Selection- and CaretBrush

26 Sep 2017, 15:52

I'm trying to change the Selection- and CaretBrush of a TextBox. Setting the properties works fine in WPF and Noesis 1.2. However, when using Unity 2017.1.1f1 and Noesis 2.1.0b4 it doesn't, any thoughts?
 
User avatar
sfernandez
Site Admin
Posts: 1915
Joined: 22 Dec 2011, 19:20

Re: TextBox Selection- and CaretBrush

29 Sep 2017, 02:32

I found a bug in the ShowSoftwareKeyboardCallback definition (NoesisGUI.cs) that made caret hidden by default.

The fix is just changing the return type of that callback to bool type: (Assets/NoesisGUI/Plugins/API/Core/NoesisGUI.cs line 152)
delegate bool ShowSoftwareKeyboardCallback(IntPtr focusedElement);
private static ShowSoftwareKeyboardCallback _showSoftwareKeyboard = ShowSoftwareKeyboard;
[MonoPInvokeCallback(typeof(ShowSoftwareKeyboardCallback))]
private static bool ShowSoftwareKeyboard(IntPtr focusedElement)
{
    try
    {
        if (_initialized)
        {
            UIElement element = Extend.GetProxy(focusedElement, false) as UIElement;
            return _softwareKeyboard.Show(element);
        }
    }
    catch (Exception e)
    {
        Noesis.Error.SetNativePendingError(e);
    }

    return false;
}
After that change, are you being able to correctly see the caret and change Selection and Caret Brushes?
 
Gwynneth
Topic Author
Posts: 15
Joined: 20 Apr 2017, 18:31

Re: TextBox Selection- and CaretBrush

29 Sep 2017, 10:19

I found a bug in the ShowSoftwareKeyboardCallback definition (NoesisGUI.cs) that made caret hidden by default.

The fix is just changing the return type of that callback to bool type: (Assets/NoesisGUI/Plugins/API/Core/NoesisGUI.cs line 152)
delegate bool ShowSoftwareKeyboardCallback(IntPtr focusedElement);
private static ShowSoftwareKeyboardCallback _showSoftwareKeyboard = ShowSoftwareKeyboard;
[MonoPInvokeCallback(typeof(ShowSoftwareKeyboardCallback))]
private static bool ShowSoftwareKeyboard(IntPtr focusedElement)
{
    try
    {
        if (_initialized)
        {
            UIElement element = Extend.GetProxy(focusedElement, false) as UIElement;
            return _softwareKeyboard.Show(element);
        }
    }
    catch (Exception e)
    {
        Noesis.Error.SetNativePendingError(e);
    }

    return false;
}
After that change, are you being able to correctly see the caret and change Selection and Caret Brushes?

Yes, it works now, thanks!

Who is online

Users browsing this forum: No registered users and 1 guest