doc: doButton / doLabel code example

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2231 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blaszijk
2012-01-06 19:35:19 +00:00
parent eab8fe3559
commit 852efcdf25
5 changed files with 40 additions and 44 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -77,6 +77,12 @@
<p>The style flag enables to draw the label in two distinct styles. The first one is default <var>(style = 0)</var> and displays the label simply as text. The alternative <var>(style = 1)</var> displays the label with a frame around it. An example is shown in the following figure.</p> <p>The style flag enables to draw the label in two distinct styles. The first one is default <var>(style = 0)</var> and displays the label simply as text. The alternative <var>(style = 1)</var> displays the label with a frame around it. An example is shown in the following figure.</p>
<img file="label.png"/> <img file="label.png"/>
<p>The <var>Text</var> variable can have multiple lines.</p> <p>The <var>Text</var> variable can have multiple lines.</p>
<p>Example code how to implement a label</p>
<code>none.Rect(0, 0);
ui.beginGroup(GroupFlags_GrowDownFromRight);
ui.doLabel(none, Text);
ui.endGroup;
</code>
</descr> </descr>
</element> </element>
<element name="UIContext.doLabel.r"> <element name="UIContext.doLabel.r">
@ -93,6 +99,15 @@
<descr> <descr>
<p>The button method does only take a text and state variable. This variable is modified if the button is pressed or depressed. When a state change occurs the method function returns <var>True</var>.</p> <p>The button method does only take a text and state variable. This variable is modified if the button is pressed or depressed. When a state change occurs the method function returns <var>True</var>.</p>
<img file="button.png"/> <img file="button.png"/>
<p>Example code how to implement a button</p>
<code>none.Rect(0, 0);
ui.beginGroup(GroupFlags_GrowDownFromRight);
if ui.doButton(none, 'Apply') then
begin
//code to apply your changes
end;
ui.endGroup;
</code>
</descr> </descr>
</element> </element>
<element name="UIContext.doButton.r"> <element name="UIContext.doButton.r">

View File

@ -22,69 +22,44 @@
<td><p><tt><span class="code"> <span class="kw">function</span> <a href="../nvwidgets/uicontext.html">UIContext</a><span class="sym">.</span>doButton<span class="sym">(</span></span></tt></p></td> <td><p><tt><span class="code"> <span class="kw">function</span> <a href="../nvwidgets/uicontext.html">UIContext</a><span class="sym">.</span>doButton<span class="sym">(</span></span></tt></p></td>
</tr> </tr>
<tr> <tr>
<td><p><tt><span class="code">&nbsp;&nbsp;<span class="kw">const </span>r<span class="sym">: </span><a href="../nvwidgets/rect.html">Rect</a><span class="sym">;</span></span></tt></p></td> <td><p><tt><span class="code">&nbsp;&nbsp;<span class="kw">const </span>r<span class="sym">: </span><a href="../nvwidgets/rect.html">Rect</a><span class="sym">;</span><span class="cmt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//optionally provides a location and size for the button</span></span></tt></p></td>
</tr> </tr>
<tr> <tr>
<td><p><tt><span class="code">&nbsp;&nbsp;<span class="kw">const </span>Text<span class="sym">: </span><span class="sym">;</span></span></tt></p></td> <td><p><tt><span class="code">&nbsp;&nbsp;<span class="kw">const </span>Text<span class="sym">: </span><span class="sym">;</span><span class="cmt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//text to display on the button</span></span></tt></p></td>
</tr> </tr>
<tr> <tr>
<td><p><tt><span class="code">&nbsp;&nbsp;<span class="kw">var </span>state<span class="sym">: </span>Boolean<span class="sym">;</span></span></tt></p></td> <td><p><tt><span class="code">&nbsp;&nbsp;<span class="kw">var </span>state<span class="sym">: </span>Boolean<span class="sym">;</span><span class="cmt"> //whether the button is depressed</span></span></tt></p></td>
</tr> </tr>
<tr> <tr>
<td><p><tt><span class="code">&nbsp;&nbsp;style<span class="sym">: </span>Integer <span class="sym">=</span> <span class="num">0</span></span></tt></p></td> <td><p><tt><span class="code">&nbsp;&nbsp;style<span class="sym">: </span>Integer <span class="sym">=</span> <span class="num">0</span></span><span class="cmt"> &nbsp;//optional style flag to modify the look (default = 0)</span></span></tt></p></td>
</tr> </tr>
<tr> <tr>
<td><p><tt><span class="code"><span class="sym">):</span>Boolean<span class="sym">;</span><br><br><span class="kw">function</span> <a href="../nvwidgets/uicontext.html">UIContext</a><span class="sym">.</span>doButton<span class="sym">(</span></span></tt></p></td> <td><p><tt><span class="code"><span class="sym">):</span>Boolean<span class="sym">;</span><span class="cmt"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Boolean result</span><br><br><span class="kw">function</span> <a href="../nvwidgets/uicontext.html">UIContext</a><span class="sym">.</span>doButton<span class="sym">(</span></span></tt></p></td>
</tr> </tr>
<tr> <tr>
<td><p><tt><span class="code">&nbsp;&nbsp;<span class="kw">const </span>r<span class="sym">: </span><a href="../nvwidgets/rect.html">Rect</a><span class="sym">;</span></span></tt></p></td> <td><p><tt><span class="code">&nbsp;&nbsp;<span class="kw">const </span>r<span class="sym">: </span><a href="../nvwidgets/rect.html">Rect</a><span class="sym">;</span><span class="cmt"> &nbsp;&nbsp;&nbsp;&nbsp;//optionally provides a location and size for the button</span></span></tt></p></td>
</tr> </tr>
<tr> <tr>
<td><p><tt><span class="code">&nbsp;&nbsp;<span class="kw">const </span>Text<span class="sym">: </span></span></tt></p></td> <td><p><tt><span class="code">&nbsp;&nbsp;<span class="kw">const </span>Text<span class="sym">: </span><span class="cmt"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //text to display on the button</span></span></tt></p></td>
</tr> </tr>
<tr> <tr>
<td><p><tt><span class="code"><span class="sym">):</span>Boolean<span class="sym">;</span></span></tt></p></td> <td><p><tt><span class="code"><span class="sym">):</span>Integer<span class="sym">;</span><span class="cmt"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Integer result</span></span></tt></p></td>
</tr>
</table>
<h2>Arguments</h2>
<table cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><p><tt><span class="code">r</span></tt></p></td>
<td><p>&nbsp;&nbsp;</p></td>
<td><p class="cmt">optionally provides a location and size for the button</p></td>
</tr>
<tr>
<td valign="top"><p><tt><span class="code">Text</span></tt></p></td>
<td><p>&nbsp;&nbsp;</p></td>
<td><p class="cmt">text to display on the button</p></td>
</tr>
<tr>
<td valign="top"><p><tt><span class="code">state</span></tt></p></td>
<td><p>&nbsp;&nbsp;</p></td>
<td><p class="cmt">whether the button is depressed</p></td>
</tr>
<tr>
<td valign="top"><p><tt><span class="code">style</span></tt></p></td>
<td><p>&nbsp;&nbsp;</p></td>
<td><p class="cmt">optional style flag to modify the look</p></td>
</tr>
</table>
<h2>Arguments</h2>
<table cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><p><tt><span class="code">r</span></tt></p></td>
<td><p>&nbsp;&nbsp;</p></td>
<td><p class="cmt">optionally provides a location and size for the button</p></td>
</tr>
<tr>
<td valign="top"><p><tt><span class="code">Text</span></tt></p></td>
<td><p>&nbsp;&nbsp;</p></td>
<td><p class="cmt">text to display on the button</p></td>
</tr> </tr>
</table> </table>
<h2>Description</h2> <h2>Description</h2>
<p>The button method does only take a text and state variable. This variable is modified if the button is pressed or depressed. When a state change occurs the method function returns <var>True</var>.</p> <p>The button method does only take a text and state variable. This variable is modified if the button is pressed or depressed. When a state change occurs the method function returns <var>True</var>.</p>
<img alt="" src="../images/button.png"> <img alt="" src="../images/button.png">
<p>Example code how to implement a button</p>
<pre>none<span class="sym">.</span>Rect<span class="sym">(</span><span class="num">0</span><span class="sym">,</span> <span class="num">0</span><span class="sym">)</span><span class="sym">;</span>
ui<span class="sym">.</span>beginGroup<span class="sym">(</span>GroupFlags_GrowDownFromRight<span class="sym">)</span><span class="sym">;</span>
<span class="kw">if</span> ui<span class="sym">.</span>doButton<span class="sym">(</span>none<span class="sym">,</span> <span class="str">'Apply'</span><span class="sym">)</span> <span class="kw">then</span>
<span class="kw">begin</span>
<span class="cmt">//code to apply your changes</span>
<span class="kw">end</span><span class="sym">;</span>
ui<span class="sym">.</span>endGroup<span class="sym">;</span>
</pre>
</body> </body>
</html> </html>

View File

@ -58,5 +58,11 @@
<img alt="" src="../images/label.png"> <img alt="" src="../images/label.png">
<p>The <var>Text</var> variable can have multiple lines.</p> <p>The <var>Text</var> variable can have multiple lines.</p>
<p>Example code how to implement a label</p>
<pre>none<span class="sym">.</span>Rect<span class="sym">(</span><span class="num">0</span><span class="sym">,</span> <span class="num">0</span><span class="sym">)</span><span class="sym">;</span>
ui<span class="sym">.</span>beginGroup<span class="sym">(</span>GroupFlags_GrowDownFromRight<span class="sym">)</span><span class="sym">;</span>
ui<span class="sym">.</span>doLabel<span class="sym">(</span>none<span class="sym">,</span> Text<span class="sym">)</span><span class="sym">;</span>
ui<span class="sym">.</span>endGroup<span class="sym">;</span>
</pre>
</body> </body>
</html> </html>