Trying to directly control caret/cursor visibility for my custom derived View. #4186
-
I'm building my own edit control (of sorts) and would like the cursor to be visible when my control HasFocus. I read this (and can see this may change): The only condition I don't seem to be able to set (or understand how to) is (my Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Ok here is how to do it. Note that I am using class MyView : View
{
public MyView ()
{
CanFocus = true;
CursorVisibility = CursorVisibility.Default;
}
/// <inheritdoc />
public override Point? PositionCursor ()
{
return new Point (1,1);
}
}
private static int Main (string [] args)
{
Application.Init (null,"v2");
var w = new Toplevel();
w.Add (new TextField (){Text = "Hi", Width = 5, Height = 1});
w.Add (new MyView ()
{
Y = 1,
Width = 5,
Height = 5,
Text = "Hhh"
});
Application.Run (w);
Application.Shutdown ();
return 0;
} |
Beta Was this translation helpful? Give feedback.
-
Perfect! Thank you. |
Beta Was this translation helpful? Give feedback.
Ok here is how to do it. Note that I am using
"v2"
for the driver, when I leave it blank (WindowsDriver i.e. v1) then the cursor keeps vanishing even in the TextField.