Terminal.Gui.Button.html 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917
  1. <!DOCTYPE html>
  2. <!--[if IE]><![endif]-->
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <title>Class Button
  8. </title>
  9. <meta name="viewport" content="width=device-width">
  10. <meta name="title" content="Class Button
  11. ">
  12. <meta name="generator" content="docfx 2.54.0.0">
  13. <link rel="shortcut icon" href="../../favicon.ico">
  14. <link rel="stylesheet" href="../../styles/docfx.vendor.css">
  15. <link rel="stylesheet" href="../../styles/docfx.css">
  16. <link rel="stylesheet" href="../../styles/main.css">
  17. <meta property="docfx:navrel" content="../../toc.html">
  18. <meta property="docfx:tocrel" content="toc.html">
  19. <meta property="docfx:rel" content="../../">
  20. </head>
  21. <body data-spy="scroll" data-target="#affix" data-offset="120">
  22. <div id="wrapper">
  23. <header>
  24. <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
  25. <div class="container">
  26. <div class="navbar-header">
  27. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
  28. <span class="sr-only">Toggle navigation</span>
  29. <span class="icon-bar"></span>
  30. <span class="icon-bar"></span>
  31. <span class="icon-bar"></span>
  32. </button>
  33. <a class="navbar-brand" href="../../index.html">
  34. <img id="logo" class="svg" src="../../images/logo48.png" alt="">
  35. </a>
  36. </div>
  37. <div class="collapse navbar-collapse" id="navbar">
  38. <form class="navbar-form navbar-right" role="search" id="search">
  39. <div class="form-group">
  40. <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
  41. </div>
  42. </form>
  43. </div>
  44. </div>
  45. </nav>
  46. <div class="subnav navbar navbar-default">
  47. <div class="container hide-when-search" id="breadcrumb">
  48. <ul class="breadcrumb">
  49. <li></li>
  50. </ul>
  51. </div>
  52. </div>
  53. </header>
  54. <div class="container body-content">
  55. <div id="search-results">
  56. <div class="search-list"></div>
  57. <div class="sr-items">
  58. <p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
  59. </div>
  60. <ul id="pagination"></ul>
  61. </div>
  62. </div>
  63. <div role="main" class="container body-content hide-when-search">
  64. <div class="sidenav hide-when-search">
  65. <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
  66. <div class="sidetoggle collapse" id="sidetoggle">
  67. <div id="sidetoc"></div>
  68. </div>
  69. </div>
  70. <div class="article row grid-right">
  71. <div class="col-md-10">
  72. <article class="content wrap" id="_content" data-uid="Terminal.Gui.Button">
  73. <h1 id="Terminal_Gui_Button" data-uid="Terminal.Gui.Button" class="text-break">Class Button
  74. </h1>
  75. <div class="markdown level0 summary">
  76. Button is a <a class="xref" href="Terminal.Gui.View.html">View</a> that provides an item that invokes an <span class="xref">System.Action</span> when activated by the user.
  77. </div>
  78. <div class="markdown level0 conceptual"></div>
  79. <div class="inheritance">
  80. <h5>Inheritance</h5>
  81. <div class="level0"><span class="xref">System.Object</span></div>
  82. <div class="level1"><a class="xref" href="Terminal.Gui.Responder.html">Responder</a></div>
  83. <div class="level2"><a class="xref" href="Terminal.Gui.View.html">View</a></div>
  84. <div class="level3"><span class="xref">Button</span></div>
  85. </div>
  86. <div classs="implements">
  87. <h5>Implements</h5>
  88. <div><span class="xref">System.Collections.IEnumerable</span></div>
  89. </div>
  90. <div class="inheritedMembers">
  91. <h5>Inherited Members</h5>
  92. <div>
  93. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Enter">View.Enter</a>
  94. </div>
  95. <div>
  96. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Leave">View.Leave</a>
  97. </div>
  98. <div>
  99. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_MouseEnter">View.MouseEnter</a>
  100. </div>
  101. <div>
  102. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_MouseLeave">View.MouseLeave</a>
  103. </div>
  104. <div>
  105. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_MouseClick">View.MouseClick</a>
  106. </div>
  107. <div>
  108. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Driver">View.Driver</a>
  109. </div>
  110. <div>
  111. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Subviews">View.Subviews</a>
  112. </div>
  113. <div>
  114. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Id">View.Id</a>
  115. </div>
  116. <div>
  117. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_IsCurrentTop">View.IsCurrentTop</a>
  118. </div>
  119. <div>
  120. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_WantMousePositionReports">View.WantMousePositionReports</a>
  121. </div>
  122. <div>
  123. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_WantContinuousButtonPressed">View.WantContinuousButtonPressed</a>
  124. </div>
  125. <div>
  126. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Frame">View.Frame</a>
  127. </div>
  128. <div>
  129. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_GetEnumerator">View.GetEnumerator()</a>
  130. </div>
  131. <div>
  132. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_LayoutStyle">View.LayoutStyle</a>
  133. </div>
  134. <div>
  135. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Bounds">View.Bounds</a>
  136. </div>
  137. <div>
  138. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_X">View.X</a>
  139. </div>
  140. <div>
  141. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Y">View.Y</a>
  142. </div>
  143. <div>
  144. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Width">View.Width</a>
  145. </div>
  146. <div>
  147. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Height">View.Height</a>
  148. </div>
  149. <div>
  150. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_SuperView">View.SuperView</a>
  151. </div>
  152. <div>
  153. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_SetNeedsDisplay">View.SetNeedsDisplay()</a>
  154. </div>
  155. <div>
  156. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_SetNeedsDisplay_Terminal_Gui_Rect_">View.SetNeedsDisplay(Rect)</a>
  157. </div>
  158. <div>
  159. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_ChildNeedsDisplay">View.ChildNeedsDisplay()</a>
  160. </div>
  161. <div>
  162. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Add_Terminal_Gui_View_">View.Add(View)</a>
  163. </div>
  164. <div>
  165. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Add_Terminal_Gui_View___">View.Add(View[])</a>
  166. </div>
  167. <div>
  168. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_RemoveAll">View.RemoveAll()</a>
  169. </div>
  170. <div>
  171. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Remove_Terminal_Gui_View_">View.Remove(View)</a>
  172. </div>
  173. <div>
  174. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_BringSubviewToFront_Terminal_Gui_View_">View.BringSubviewToFront(View)</a>
  175. </div>
  176. <div>
  177. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_SendSubviewToBack_Terminal_Gui_View_">View.SendSubviewToBack(View)</a>
  178. </div>
  179. <div>
  180. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_SendSubviewBackwards_Terminal_Gui_View_">View.SendSubviewBackwards(View)</a>
  181. </div>
  182. <div>
  183. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_BringSubviewForward_Terminal_Gui_View_">View.BringSubviewForward(View)</a>
  184. </div>
  185. <div>
  186. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Clear">View.Clear()</a>
  187. </div>
  188. <div>
  189. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Clear_Terminal_Gui_Rect_">View.Clear(Rect)</a>
  190. </div>
  191. <div>
  192. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_ScreenToView_System_Int32_System_Int32_">View.ScreenToView(Int32, Int32)</a>
  193. </div>
  194. <div>
  195. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_ClipToBounds">View.ClipToBounds()</a>
  196. </div>
  197. <div>
  198. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_SetClip_Terminal_Gui_Rect_">View.SetClip(Rect)</a>
  199. </div>
  200. <div>
  201. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_DrawFrame_Terminal_Gui_Rect_System_Int32_System_Boolean_">View.DrawFrame(Rect, Int32, Boolean)</a>
  202. </div>
  203. <div>
  204. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_DrawHotString_NStack_ustring_Terminal_Gui_Attribute_Terminal_Gui_Attribute_">View.DrawHotString(ustring, Attribute, Attribute)</a>
  205. </div>
  206. <div>
  207. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_DrawHotString_NStack_ustring_System_Boolean_Terminal_Gui_ColorScheme_">View.DrawHotString(ustring, Boolean, ColorScheme)</a>
  208. </div>
  209. <div>
  210. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Move_System_Int32_System_Int32_">View.Move(Int32, Int32)</a>
  211. </div>
  212. <div>
  213. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_HasFocus">View.HasFocus</a>
  214. </div>
  215. <div>
  216. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_OnEnter">View.OnEnter()</a>
  217. </div>
  218. <div>
  219. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_OnLeave">View.OnLeave()</a>
  220. </div>
  221. <div>
  222. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Focused">View.Focused</a>
  223. </div>
  224. <div>
  225. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_MostFocused">View.MostFocused</a>
  226. </div>
  227. <div>
  228. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_ColorScheme">View.ColorScheme</a>
  229. </div>
  230. <div>
  231. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_AddRune_System_Int32_System_Int32_System_Rune_">View.AddRune(Int32, Int32, Rune)</a>
  232. </div>
  233. <div>
  234. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_ClearNeedsDisplay">View.ClearNeedsDisplay()</a>
  235. </div>
  236. <div>
  237. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_DrawContent">View.DrawContent</a>
  238. </div>
  239. <div>
  240. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_OnDrawContent_Terminal_Gui_Rect_">View.OnDrawContent(Rect)</a>
  241. </div>
  242. <div>
  243. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_SetFocus_Terminal_Gui_View_">View.SetFocus(View)</a>
  244. </div>
  245. <div>
  246. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_KeyPress">View.KeyPress</a>
  247. </div>
  248. <div>
  249. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_KeyDown">View.KeyDown</a>
  250. </div>
  251. <div>
  252. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_OnKeyDown_Terminal_Gui_KeyEvent_">View.OnKeyDown(KeyEvent)</a>
  253. </div>
  254. <div>
  255. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_KeyUp">View.KeyUp</a>
  256. </div>
  257. <div>
  258. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_OnKeyUp_Terminal_Gui_KeyEvent_">View.OnKeyUp(KeyEvent)</a>
  259. </div>
  260. <div>
  261. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_EnsureFocus">View.EnsureFocus()</a>
  262. </div>
  263. <div>
  264. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_FocusFirst">View.FocusFirst()</a>
  265. </div>
  266. <div>
  267. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_FocusLast">View.FocusLast()</a>
  268. </div>
  269. <div>
  270. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_FocusPrev">View.FocusPrev()</a>
  271. </div>
  272. <div>
  273. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_FocusNext">View.FocusNext()</a>
  274. </div>
  275. <div>
  276. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_LayoutComplete">View.LayoutComplete</a>
  277. </div>
  278. <div>
  279. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_LayoutSubviews">View.LayoutSubviews()</a>
  280. </div>
  281. <div>
  282. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_ToString">View.ToString()</a>
  283. </div>
  284. <div>
  285. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_OnMouseEnter_Terminal_Gui_MouseEvent_">View.OnMouseEnter(MouseEvent)</a>
  286. </div>
  287. <div>
  288. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_OnMouseLeave_Terminal_Gui_MouseEvent_">View.OnMouseLeave(MouseEvent)</a>
  289. </div>
  290. <div>
  291. <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_OnMouseEvent_Terminal_Gui_MouseEvent_">View.OnMouseEvent(MouseEvent)</a>
  292. </div>
  293. <div>
  294. <a class="xref" href="Terminal.Gui.Responder.html#Terminal_Gui_Responder_CanFocus">Responder.CanFocus</a>
  295. </div>
  296. <div>
  297. <span class="xref">System.Object.Equals(System.Object)</span>
  298. </div>
  299. <div>
  300. <span class="xref">System.Object.Equals(System.Object, System.Object)</span>
  301. </div>
  302. <div>
  303. <span class="xref">System.Object.GetHashCode()</span>
  304. </div>
  305. <div>
  306. <span class="xref">System.Object.GetType()</span>
  307. </div>
  308. <div>
  309. <span class="xref">System.Object.MemberwiseClone()</span>
  310. </div>
  311. <div>
  312. <span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
  313. </div>
  314. </div>
  315. <h6><strong>Namespace</strong>: <a class="xref" href="Terminal.Gui.html">Terminal.Gui</a></h6>
  316. <h6><strong>Assembly</strong>: Terminal.Gui.dll</h6>
  317. <h5 id="Terminal_Gui_Button_syntax">Syntax</h5>
  318. <div class="codewrapper">
  319. <pre><code class="lang-csharp hljs">public class Button : View, IEnumerable</code></pre>
  320. </div>
  321. <h5 id="Terminal_Gui_Button_remarks"><strong>Remarks</strong></h5>
  322. <div class="markdown level0 remarks">
  323. <p>
  324. Provides a button showing text invokes an <span class="xref">System.Action</span> when clicked on with a mouse
  325. or when the user presses SPACE, ENTER, or hotkey. The hotkey is specified by the first uppercase
  326. letter in the button.
  327. </p>
  328. <p>
  329. When the button is configured as the default (<a class="xref" href="Terminal.Gui.Button.html#Terminal_Gui_Button_IsDefault">IsDefault</a>) and the user presses
  330. the ENTER key, if no other <a class="xref" href="Terminal.Gui.View.html">View</a> processes the <a class="xref" href="Terminal.Gui.KeyEvent.html">KeyEvent</a>, the <a class="xref" href="Terminal.Gui.Button.html">Button</a>&apos;s
  331. <span class="xref">System.Action</span> will be invoked.
  332. </p>
  333. </div>
  334. <h3 id="constructors">Constructors
  335. </h3>
  336. <a id="Terminal_Gui_Button__ctor_" data-uid="Terminal.Gui.Button.#ctor*"></a>
  337. <h4 id="Terminal_Gui_Button__ctor_NStack_ustring_System_Boolean_" data-uid="Terminal.Gui.Button.#ctor(NStack.ustring,System.Boolean)">Button(ustring, Boolean)</h4>
  338. <div class="markdown level1 summary">
  339. Initializes a new instance of <a class="xref" href="Terminal.Gui.Button.html">Button</a> using <a class="xref" href="Terminal.Gui.LayoutStyle.html#Terminal_Gui_LayoutStyle_Computed">Computed</a> layout.
  340. </div>
  341. <div class="markdown level1 conceptual"></div>
  342. <h5 class="decalaration">Declaration</h5>
  343. <div class="codewrapper">
  344. <pre><code class="lang-csharp hljs">public Button(ustring text, bool is_default = false)</code></pre>
  345. </div>
  346. <h5 class="parameters">Parameters</h5>
  347. <table class="table table-bordered table-striped table-condensed">
  348. <thead>
  349. <tr>
  350. <th>Type</th>
  351. <th>Name</th>
  352. <th>Description</th>
  353. </tr>
  354. </thead>
  355. <tbody>
  356. <tr>
  357. <td><span class="xref">NStack.ustring</span></td>
  358. <td><span class="parametername">text</span></td>
  359. <td>The button&apos;s text</td>
  360. </tr>
  361. <tr>
  362. <td><span class="xref">System.Boolean</span></td>
  363. <td><span class="parametername">is_default</span></td>
  364. <td>
  365. If <code>true</code>, a special decoration is used, and the user pressing the enter key
  366. in a <a class="xref" href="Terminal.Gui.Dialog.html">Dialog</a> will implicitly activate this button.
  367. </td>
  368. </tr>
  369. </tbody>
  370. </table>
  371. <h5 id="Terminal_Gui_Button__ctor_NStack_ustring_System_Boolean__remarks">Remarks</h5>
  372. <div class="markdown level1 remarks">
  373. The width of the <a class="xref" href="Terminal.Gui.Button.html">Button</a> is computed based on the
  374. text length. The height will always be 1.
  375. </div>
  376. <a id="Terminal_Gui_Button__ctor_" data-uid="Terminal.Gui.Button.#ctor*"></a>
  377. <h4 id="Terminal_Gui_Button__ctor_System_Int32_System_Int32_NStack_ustring_" data-uid="Terminal.Gui.Button.#ctor(System.Int32,System.Int32,NStack.ustring)">Button(Int32, Int32, ustring)</h4>
  378. <div class="markdown level1 summary">
  379. Initializes a new instance of <a class="xref" href="Terminal.Gui.Button.html">Button</a> using <a class="xref" href="Terminal.Gui.LayoutStyle.html#Terminal_Gui_LayoutStyle_Absolute">Absolute</a> layout, based on the given text
  380. </div>
  381. <div class="markdown level1 conceptual"></div>
  382. <h5 class="decalaration">Declaration</h5>
  383. <div class="codewrapper">
  384. <pre><code class="lang-csharp hljs">public Button(int x, int y, ustring text)</code></pre>
  385. </div>
  386. <h5 class="parameters">Parameters</h5>
  387. <table class="table table-bordered table-striped table-condensed">
  388. <thead>
  389. <tr>
  390. <th>Type</th>
  391. <th>Name</th>
  392. <th>Description</th>
  393. </tr>
  394. </thead>
  395. <tbody>
  396. <tr>
  397. <td><span class="xref">System.Int32</span></td>
  398. <td><span class="parametername">x</span></td>
  399. <td>X position where the button will be shown.</td>
  400. </tr>
  401. <tr>
  402. <td><span class="xref">System.Int32</span></td>
  403. <td><span class="parametername">y</span></td>
  404. <td>Y position where the button will be shown.</td>
  405. </tr>
  406. <tr>
  407. <td><span class="xref">NStack.ustring</span></td>
  408. <td><span class="parametername">text</span></td>
  409. <td>The button&apos;s text</td>
  410. </tr>
  411. </tbody>
  412. </table>
  413. <h5 id="Terminal_Gui_Button__ctor_System_Int32_System_Int32_NStack_ustring__remarks">Remarks</h5>
  414. <div class="markdown level1 remarks">
  415. The width of the <a class="xref" href="Terminal.Gui.Button.html">Button</a> is computed based on the
  416. text length. The height will always be 1.
  417. </div>
  418. <a id="Terminal_Gui_Button__ctor_" data-uid="Terminal.Gui.Button.#ctor*"></a>
  419. <h4 id="Terminal_Gui_Button__ctor_System_Int32_System_Int32_NStack_ustring_System_Boolean_" data-uid="Terminal.Gui.Button.#ctor(System.Int32,System.Int32,NStack.ustring,System.Boolean)">Button(Int32, Int32, ustring, Boolean)</h4>
  420. <div class="markdown level1 summary">
  421. Initializes a new instance of <a class="xref" href="Terminal.Gui.Button.html">Button</a> using <a class="xref" href="Terminal.Gui.LayoutStyle.html#Terminal_Gui_LayoutStyle_Absolute">Absolute</a> layout, based on the given text.
  422. </div>
  423. <div class="markdown level1 conceptual"></div>
  424. <h5 class="decalaration">Declaration</h5>
  425. <div class="codewrapper">
  426. <pre><code class="lang-csharp hljs">public Button(int x, int y, ustring text, bool is_default)</code></pre>
  427. </div>
  428. <h5 class="parameters">Parameters</h5>
  429. <table class="table table-bordered table-striped table-condensed">
  430. <thead>
  431. <tr>
  432. <th>Type</th>
  433. <th>Name</th>
  434. <th>Description</th>
  435. </tr>
  436. </thead>
  437. <tbody>
  438. <tr>
  439. <td><span class="xref">System.Int32</span></td>
  440. <td><span class="parametername">x</span></td>
  441. <td>X position where the button will be shown.</td>
  442. </tr>
  443. <tr>
  444. <td><span class="xref">System.Int32</span></td>
  445. <td><span class="parametername">y</span></td>
  446. <td>Y position where the button will be shown.</td>
  447. </tr>
  448. <tr>
  449. <td><span class="xref">NStack.ustring</span></td>
  450. <td><span class="parametername">text</span></td>
  451. <td>The button&apos;s text</td>
  452. </tr>
  453. <tr>
  454. <td><span class="xref">System.Boolean</span></td>
  455. <td><span class="parametername">is_default</span></td>
  456. <td>
  457. If <code>true</code>, a special decoration is used, and the user pressing the enter key
  458. in a <a class="xref" href="Terminal.Gui.Dialog.html">Dialog</a> will implicitly activate this button.
  459. </td>
  460. </tr>
  461. </tbody>
  462. </table>
  463. <h5 id="Terminal_Gui_Button__ctor_System_Int32_System_Int32_NStack_ustring_System_Boolean__remarks">Remarks</h5>
  464. <div class="markdown level1 remarks">
  465. The width of the <a class="xref" href="Terminal.Gui.Button.html">Button</a> is computed based on the
  466. text length. The height will always be 1.
  467. </div>
  468. <h3 id="fields">Fields
  469. </h3>
  470. <h4 id="Terminal_Gui_Button_Clicked" data-uid="Terminal.Gui.Button.Clicked">Clicked</h4>
  471. <div class="markdown level1 summary">
  472. Clicked <span class="xref">System.Action</span>, raised when the button is clicked.
  473. </div>
  474. <div class="markdown level1 conceptual"></div>
  475. <h5 class="decalaration">Declaration</h5>
  476. <div class="codewrapper">
  477. <pre><code class="lang-csharp hljs">public Action Clicked</code></pre>
  478. </div>
  479. <h5 class="fieldValue">Field Value</h5>
  480. <table class="table table-bordered table-striped table-condensed">
  481. <thead>
  482. <tr>
  483. <th>Type</th>
  484. <th>Description</th>
  485. </tr>
  486. </thead>
  487. <tbody>
  488. <tr>
  489. <td><span class="xref">System.Action</span></td>
  490. <td></td>
  491. </tr>
  492. </tbody>
  493. </table>
  494. <h5 id="Terminal_Gui_Button_Clicked_remarks">Remarks</h5>
  495. <div class="markdown level1 remarks">
  496. Client code can hook up to this event, it is
  497. raised when the button is activated either with
  498. the mouse or the keyboard.
  499. </div>
  500. <h3 id="properties">Properties
  501. </h3>
  502. <a id="Terminal_Gui_Button_IsDefault_" data-uid="Terminal.Gui.Button.IsDefault*"></a>
  503. <h4 id="Terminal_Gui_Button_IsDefault" data-uid="Terminal.Gui.Button.IsDefault">IsDefault</h4>
  504. <div class="markdown level1 summary">
  505. Gets or sets whether the <a class="xref" href="Terminal.Gui.Button.html">Button</a> is the default action to activate in a dialog.
  506. </div>
  507. <div class="markdown level1 conceptual"></div>
  508. <h5 class="decalaration">Declaration</h5>
  509. <div class="codewrapper">
  510. <pre><code class="lang-csharp hljs">public bool IsDefault { get; set; }</code></pre>
  511. </div>
  512. <h5 class="propertyValue">Property Value</h5>
  513. <table class="table table-bordered table-striped table-condensed">
  514. <thead>
  515. <tr>
  516. <th>Type</th>
  517. <th>Description</th>
  518. </tr>
  519. </thead>
  520. <tbody>
  521. <tr>
  522. <td><span class="xref">System.Boolean</span></td>
  523. <td><code>true</code> if is default; otherwise, <code>false</code>.</td>
  524. </tr>
  525. </tbody>
  526. </table>
  527. <a id="Terminal_Gui_Button_Text_" data-uid="Terminal.Gui.Button.Text*"></a>
  528. <h4 id="Terminal_Gui_Button_Text" data-uid="Terminal.Gui.Button.Text">Text</h4>
  529. <div class="markdown level1 summary">
  530. The text displayed by this <a class="xref" href="Terminal.Gui.Button.html">Button</a>.
  531. </div>
  532. <div class="markdown level1 conceptual"></div>
  533. <h5 class="decalaration">Declaration</h5>
  534. <div class="codewrapper">
  535. <pre><code class="lang-csharp hljs">public ustring Text { get; set; }</code></pre>
  536. </div>
  537. <h5 class="propertyValue">Property Value</h5>
  538. <table class="table table-bordered table-striped table-condensed">
  539. <thead>
  540. <tr>
  541. <th>Type</th>
  542. <th>Description</th>
  543. </tr>
  544. </thead>
  545. <tbody>
  546. <tr>
  547. <td><span class="xref">NStack.ustring</span></td>
  548. <td></td>
  549. </tr>
  550. </tbody>
  551. </table>
  552. <h3 id="methods">Methods
  553. </h3>
  554. <a id="Terminal_Gui_Button_MouseEvent_" data-uid="Terminal.Gui.Button.MouseEvent*"></a>
  555. <h4 id="Terminal_Gui_Button_MouseEvent_Terminal_Gui_MouseEvent_" data-uid="Terminal.Gui.Button.MouseEvent(Terminal.Gui.MouseEvent)">MouseEvent(MouseEvent)</h4>
  556. <div class="markdown level1 summary">
  557. Method invoked when a mouse event is generated
  558. </div>
  559. <div class="markdown level1 conceptual"></div>
  560. <h5 class="decalaration">Declaration</h5>
  561. <div class="codewrapper">
  562. <pre><code class="lang-csharp hljs">public override bool MouseEvent(MouseEvent me)</code></pre>
  563. </div>
  564. <h5 class="parameters">Parameters</h5>
  565. <table class="table table-bordered table-striped table-condensed">
  566. <thead>
  567. <tr>
  568. <th>Type</th>
  569. <th>Name</th>
  570. <th>Description</th>
  571. </tr>
  572. </thead>
  573. <tbody>
  574. <tr>
  575. <td><a class="xref" href="Terminal.Gui.MouseEvent.html">MouseEvent</a></td>
  576. <td><span class="parametername">me</span></td>
  577. <td></td>
  578. </tr>
  579. </tbody>
  580. </table>
  581. <h5 class="returns">Returns</h5>
  582. <table class="table table-bordered table-striped table-condensed">
  583. <thead>
  584. <tr>
  585. <th>Type</th>
  586. <th>Description</th>
  587. </tr>
  588. </thead>
  589. <tbody>
  590. <tr>
  591. <td><span class="xref">System.Boolean</span></td>
  592. <td><code>true</code>, if the event was handled, <code>false</code> otherwise.</td>
  593. </tr>
  594. </tbody>
  595. </table>
  596. <h5 class="overrides">Overrides</h5>
  597. <div><a class="xref" href="Terminal.Gui.Responder.html#Terminal_Gui_Responder_MouseEvent_Terminal_Gui_MouseEvent_">Responder.MouseEvent(MouseEvent)</a></div>
  598. <a id="Terminal_Gui_Button_PositionCursor_" data-uid="Terminal.Gui.Button.PositionCursor*"></a>
  599. <h4 id="Terminal_Gui_Button_PositionCursor" data-uid="Terminal.Gui.Button.PositionCursor">PositionCursor()</h4>
  600. <div class="markdown level1 summary">
  601. Positions the cursor in the right position based on the currently focused view in the chain.
  602. </div>
  603. <div class="markdown level1 conceptual"></div>
  604. <h5 class="decalaration">Declaration</h5>
  605. <div class="codewrapper">
  606. <pre><code class="lang-csharp hljs">public override void PositionCursor()</code></pre>
  607. </div>
  608. <h5 class="overrides">Overrides</h5>
  609. <div><a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_PositionCursor">View.PositionCursor()</a></div>
  610. <a id="Terminal_Gui_Button_ProcessColdKey_" data-uid="Terminal.Gui.Button.ProcessColdKey*"></a>
  611. <h4 id="Terminal_Gui_Button_ProcessColdKey_Terminal_Gui_KeyEvent_" data-uid="Terminal.Gui.Button.ProcessColdKey(Terminal.Gui.KeyEvent)">ProcessColdKey(KeyEvent)</h4>
  612. <div class="markdown level1 summary">
  613. This method can be overwritten by views that
  614. want to provide accelerator functionality
  615. (Alt-key for example), but without
  616. interefering with normal ProcessKey behavior.
  617. </div>
  618. <div class="markdown level1 conceptual"></div>
  619. <h5 class="decalaration">Declaration</h5>
  620. <div class="codewrapper">
  621. <pre><code class="lang-csharp hljs">public override bool ProcessColdKey(KeyEvent kb)</code></pre>
  622. </div>
  623. <h5 class="parameters">Parameters</h5>
  624. <table class="table table-bordered table-striped table-condensed">
  625. <thead>
  626. <tr>
  627. <th>Type</th>
  628. <th>Name</th>
  629. <th>Description</th>
  630. </tr>
  631. </thead>
  632. <tbody>
  633. <tr>
  634. <td><a class="xref" href="Terminal.Gui.KeyEvent.html">KeyEvent</a></td>
  635. <td><span class="parametername">kb</span></td>
  636. <td></td>
  637. </tr>
  638. </tbody>
  639. </table>
  640. <h5 class="returns">Returns</h5>
  641. <table class="table table-bordered table-striped table-condensed">
  642. <thead>
  643. <tr>
  644. <th>Type</th>
  645. <th>Description</th>
  646. </tr>
  647. </thead>
  648. <tbody>
  649. <tr>
  650. <td><span class="xref">System.Boolean</span></td>
  651. <td></td>
  652. </tr>
  653. </tbody>
  654. </table>
  655. <h5 class="overrides">Overrides</h5>
  656. <div><a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_ProcessColdKey_Terminal_Gui_KeyEvent_">View.ProcessColdKey(KeyEvent)</a></div>
  657. <h5 id="Terminal_Gui_Button_ProcessColdKey_Terminal_Gui_KeyEvent__remarks">Remarks</h5>
  658. <div class="markdown level1 remarks">
  659. <p>
  660. After keys are sent to the subviews on the
  661. current view, all the view are
  662. processed and the key is passed to the views
  663. to allow some of them to process the keystroke
  664. as a cold-key. </p>
  665. <p>
  666. This functionality is used, for example, by
  667. default buttons to act on the enter key.
  668. Processing this as a hot-key would prevent
  669. non-default buttons from consuming the enter
  670. keypress when they have the focus.
  671. </p>
  672. </div>
  673. <a id="Terminal_Gui_Button_ProcessHotKey_" data-uid="Terminal.Gui.Button.ProcessHotKey*"></a>
  674. <h4 id="Terminal_Gui_Button_ProcessHotKey_Terminal_Gui_KeyEvent_" data-uid="Terminal.Gui.Button.ProcessHotKey(Terminal.Gui.KeyEvent)">ProcessHotKey(KeyEvent)</h4>
  675. <div class="markdown level1 summary">
  676. This method can be overwritten by view that
  677. want to provide accelerator functionality
  678. (Alt-key for example).
  679. </div>
  680. <div class="markdown level1 conceptual"></div>
  681. <h5 class="decalaration">Declaration</h5>
  682. <div class="codewrapper">
  683. <pre><code class="lang-csharp hljs">public override bool ProcessHotKey(KeyEvent kb)</code></pre>
  684. </div>
  685. <h5 class="parameters">Parameters</h5>
  686. <table class="table table-bordered table-striped table-condensed">
  687. <thead>
  688. <tr>
  689. <th>Type</th>
  690. <th>Name</th>
  691. <th>Description</th>
  692. </tr>
  693. </thead>
  694. <tbody>
  695. <tr>
  696. <td><a class="xref" href="Terminal.Gui.KeyEvent.html">KeyEvent</a></td>
  697. <td><span class="parametername">kb</span></td>
  698. <td></td>
  699. </tr>
  700. </tbody>
  701. </table>
  702. <h5 class="returns">Returns</h5>
  703. <table class="table table-bordered table-striped table-condensed">
  704. <thead>
  705. <tr>
  706. <th>Type</th>
  707. <th>Description</th>
  708. </tr>
  709. </thead>
  710. <tbody>
  711. <tr>
  712. <td><span class="xref">System.Boolean</span></td>
  713. <td></td>
  714. </tr>
  715. </tbody>
  716. </table>
  717. <h5 class="overrides">Overrides</h5>
  718. <div><a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_ProcessHotKey_Terminal_Gui_KeyEvent_">View.ProcessHotKey(KeyEvent)</a></div>
  719. <h5 id="Terminal_Gui_Button_ProcessHotKey_Terminal_Gui_KeyEvent__remarks">Remarks</h5>
  720. <div class="markdown level1 remarks">
  721. <p>
  722. Before keys are sent to the subview on the
  723. current view, all the views are
  724. processed and the key is passed to the widgets
  725. to allow some of them to process the keystroke
  726. as a hot-key. </p>
  727. <p>
  728. For example, if you implement a button that
  729. has a hotkey ok &quot;o&quot;, you would catch the
  730. combination Alt-o here. If the event is
  731. caught, you must return true to stop the
  732. keystroke from being dispatched to other
  733. views.
  734. </p>
  735. </div>
  736. <a id="Terminal_Gui_Button_ProcessKey_" data-uid="Terminal.Gui.Button.ProcessKey*"></a>
  737. <h4 id="Terminal_Gui_Button_ProcessKey_Terminal_Gui_KeyEvent_" data-uid="Terminal.Gui.Button.ProcessKey(Terminal.Gui.KeyEvent)">ProcessKey(KeyEvent)</h4>
  738. <div class="markdown level1 summary">
  739. If the view is focused, gives the view a
  740. chance to process the keystroke.
  741. </div>
  742. <div class="markdown level1 conceptual"></div>
  743. <h5 class="decalaration">Declaration</h5>
  744. <div class="codewrapper">
  745. <pre><code class="lang-csharp hljs">public override bool ProcessKey(KeyEvent kb)</code></pre>
  746. </div>
  747. <h5 class="parameters">Parameters</h5>
  748. <table class="table table-bordered table-striped table-condensed">
  749. <thead>
  750. <tr>
  751. <th>Type</th>
  752. <th>Name</th>
  753. <th>Description</th>
  754. </tr>
  755. </thead>
  756. <tbody>
  757. <tr>
  758. <td><a class="xref" href="Terminal.Gui.KeyEvent.html">KeyEvent</a></td>
  759. <td><span class="parametername">kb</span></td>
  760. <td></td>
  761. </tr>
  762. </tbody>
  763. </table>
  764. <h5 class="returns">Returns</h5>
  765. <table class="table table-bordered table-striped table-condensed">
  766. <thead>
  767. <tr>
  768. <th>Type</th>
  769. <th>Description</th>
  770. </tr>
  771. </thead>
  772. <tbody>
  773. <tr>
  774. <td><span class="xref">System.Boolean</span></td>
  775. <td></td>
  776. </tr>
  777. </tbody>
  778. </table>
  779. <h5 class="overrides">Overrides</h5>
  780. <div><a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_ProcessKey_Terminal_Gui_KeyEvent_">View.ProcessKey(KeyEvent)</a></div>
  781. <h5 id="Terminal_Gui_Button_ProcessKey_Terminal_Gui_KeyEvent__remarks">Remarks</h5>
  782. <div class="markdown level1 remarks">
  783. <p>
  784. Views can override this method if they are
  785. interested in processing the given keystroke.
  786. If they consume the keystroke, they must
  787. return true to stop the keystroke from being
  788. processed by other widgets or consumed by the
  789. widget engine. If they return false, the
  790. keystroke will be passed using the ProcessColdKey
  791. method to other views to process.
  792. </p>
  793. <p>
  794. The View implementation does nothing but return false,
  795. so it is not necessary to call base.ProcessKey if you
  796. derive directly from View, but you should if you derive
  797. other View subclasses.
  798. </p>
  799. </div>
  800. <a id="Terminal_Gui_Button_Redraw_" data-uid="Terminal.Gui.Button.Redraw*"></a>
  801. <h4 id="Terminal_Gui_Button_Redraw_Terminal_Gui_Rect_" data-uid="Terminal.Gui.Button.Redraw(Terminal.Gui.Rect)">Redraw(Rect)</h4>
  802. <div class="markdown level1 summary">
  803. Redraws this view and its subviews; only redraws the views that have been flagged for a re-display.
  804. </div>
  805. <div class="markdown level1 conceptual"></div>
  806. <h5 class="decalaration">Declaration</h5>
  807. <div class="codewrapper">
  808. <pre><code class="lang-csharp hljs">public override void Redraw(Rect bounds)</code></pre>
  809. </div>
  810. <h5 class="parameters">Parameters</h5>
  811. <table class="table table-bordered table-striped table-condensed">
  812. <thead>
  813. <tr>
  814. <th>Type</th>
  815. <th>Name</th>
  816. <th>Description</th>
  817. </tr>
  818. </thead>
  819. <tbody>
  820. <tr>
  821. <td><a class="xref" href="Terminal.Gui.Rect.html">Rect</a></td>
  822. <td><span class="parametername">bounds</span></td>
  823. <td>The bounds (view-relative region) to redraw.</td>
  824. </tr>
  825. </tbody>
  826. </table>
  827. <h5 class="overrides">Overrides</h5>
  828. <div><a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Redraw_Terminal_Gui_Rect_">View.Redraw(Rect)</a></div>
  829. <h5 id="Terminal_Gui_Button_Redraw_Terminal_Gui_Rect__remarks">Remarks</h5>
  830. <div class="markdown level1 remarks">
  831. <p>
  832. Always use <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Bounds">Bounds</a> (view-relative) when calling <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Redraw_Terminal_Gui_Rect_">Redraw(Rect)</a>, NOT <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Frame">Frame</a> (superview-relative).
  833. </p>
  834. <p>
  835. Views should set the color that they want to use on entry, as otherwise this will inherit
  836. the last color that was set globaly on the driver.
  837. </p>
  838. <p>
  839. Overrides of <a class="xref" href="Terminal.Gui.View.html#Terminal_Gui_View_Redraw_Terminal_Gui_Rect_">Redraw(Rect)</a> must ensure they do not set <code>Driver.Clip</code> to a clip region
  840. larger than the <code>region</code> parameter.
  841. </p>
  842. </div>
  843. <h3 id="implements">Implements</h3>
  844. <div>
  845. <span class="xref">System.Collections.IEnumerable</span>
  846. </div>
  847. </article>
  848. </div>
  849. <div class="hidden-sm col-md-2" role="complementary">
  850. <div class="sideaffix">
  851. <div class="contribution">
  852. <ul class="nav">
  853. </ul>
  854. </div>
  855. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  856. <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
  857. </nav>
  858. </div>
  859. </div>
  860. </div>
  861. </div>
  862. <footer>
  863. <div class="grad-bottom"></div>
  864. <div class="footer">
  865. <div class="container">
  866. <span class="pull-right">
  867. <a href="#top">Back to top</a>
  868. </span>
  869. <span>Generated by <strong>DocFX</strong></span>
  870. </div>
  871. </div>
  872. </footer>
  873. </div>
  874. <script type="text/javascript" src="../../styles/docfx.vendor.js"></script>
  875. <script type="text/javascript" src="../../styles/docfx.js"></script>
  876. <script type="text/javascript" src="../../styles/main.js"></script>
  877. </body>
  878. </html>