PositionCursor() public method

Moves inside the first location inside the container

A helper routine that positions the cursor at the logical beginning of the widget. The default implementation merely puts the cursor at the beginning, but derived classes should find a suitable spot for the cursor to be shown.

This method must be overwritten by most widgets since screen repaints can happen at any point and it is important to leave the cursor in a position that would make sense for the user (as not all terminals support hiding the cursor), and give the user an impression of where the cursor is. For a button, that would be the position where the hotkey is, for an entry the location of the editing cursor and so on.

public PositionCursor ( ) : void
return void
コード例 #1
0
ファイル: gui.cs プロジェクト: mono/mono-curses
 /// <summary>
 ///   Focuses the specified widget in this container.
 /// </summary>
 /// <remarks>
 ///   Focuses the specified widge, taking the focus
 ///   away from any previously focused widgets.   This
 ///   method only works if the widget specified
 ///   supports being focused.
 /// </remarks>
 public void SetFocus(Widget w)
 {
     if (!w.CanFocus)
         return;
     if (focused == w)
         return;
     if (focused != null)
         focused.HasFocus = false;
     focused = w;
     focused.HasFocus = true;
     Container wc = w as Container;
     if (wc != null)
         wc.EnsureFocus ();
     focused.PositionCursor ();
 }