<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to APP_MENU</title><link>https://sourceforge.net/p/pirobot/wiki/APP_MENU/</link><description>Recent changes to APP_MENU</description><atom:link href="https://sourceforge.net/p/pirobot/wiki/APP_MENU/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 20 Mar 2024 04:34:09 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/pirobot/wiki/APP_MENU/feed" rel="self" type="application/rss+xml"/><item><title>APP_MENU modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/APP_MENU/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v5
+++ v6
@@ -50,12 +50,8 @@
 - Checks if the mouse is over a button when `ui.isMouseDown` is `True` to select the color-inverted button.
 - Also checks, if `UITools.showMsg` is `True`. It then does nothing except for drawing the buttons.

-####App: def onMouseDown(self)
-- Sets `App.onMouseDown `to `True`.
-
 ####App: def onMouseUp(self)
-- Sets `App.onMouseUp` to `False`
-- Checks, if mouse is over a button and calls the corresponding button function if so.
+- Checks, if mouse is released over a button and calls the corresponding button function then.

 -------

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Wed, 20 Mar 2024 04:34:09 -0000</pubDate><guid>https://sourceforge.net93b28ee32da1673a52cb4ab7b0002aa4616cde9a</guid></item><item><title>APP_MENU modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/APP_MENU/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v4
+++ v5
@@ -57,4 +57,7 @@
 - Sets `App.onMouseUp` to `False`
 - Checks, if mouse is over a button and calls the corresponding button function if so.

+-------
+
 That's all folks. Go back [Home] to have a look on the other Apps.
+
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Wed, 20 Mar 2024 04:33:01 -0000</pubDate><guid>https://sourceforge.netfe3f4badf2e872ae0bfd1caa106cd1bf9ed3d256</guid></item><item><title>APP_MENU modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/APP_MENU/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -2,13 +2,17 @@
 #APP_MENU.py
 Go back [Home]

-A "widely" used menu app with 6 buttons to touch on.
+A "widely" used menu app with a default of 6 buttons to touch on.
 Each button has a name and can call a given function.

 Use the `cMenu` class to create your own menus or set the buttons of the actual selected menu directly.
 A `cMenu` instance will be created at startup automatically and be set to the `CURRENT_MENU`.

 ##Global Variables
+###buttonIndex
+The index of the last button where it was touched on.
+Use it to use the same button function on several buttons. Determine what to do with this index.
+
 ###CURRENT_MENU
 The actual shown and processed `cMenu`-instance.
 Set it directly to another one to change the menu.
@@ -16,34 +20,34 @@
 ------

 ##Functions
-###def nullfunc()
-A function which does absolutely nothing. Used for empty buttons.

-###def setMenuItem(buttonIdx, menuTitle, menuFunc)
+###def setMenuItem(buttonIdx, menuTitle, menuFunc, color)
 Calls `setMenuItem` on the `CURRENT_MENU`-instance.
+See below for further information.

 -------------

 ##Classes
 ###cMenu
-A menu class. It has 6 button items containing the text shown on the button and the function to be called.
+A menu class. It has a default of 6 button items containing the text shown on the button and the function to be called.
+Use x and y on creating the menu to use another button configuration, 
+e.g. `myMenu = APP_MENU.cMenu(4,2)` creates 4 buttons on 2 lines = 8 buttons with index 0 to 7.

-####cMenu: def setMenuItem(self, buttonIdx, menuTitle, menuFunc)
+####cMenu: def setMenuItem(self, buttonIdx, menuTitle, menuFunc, color)
 Set the button with index `buttonIdx` (0 to 5) to the given `menuTitle` and `menuFunc`.

 `buttonIdx` is the index of the button. Ranges from 0 to 5.
 `menuTitle` is the text shown on the corresponding button.
 `menuFunc` is the function that gets called when the button is touched. (Without () )
+`color` is the foreground color of the button. It can be ommitted. Default is `ui.fgcol`.

 ###App(APP_BASE.BaseAppClass)
 The App. See [APP_TEMPLATE] for further information.
-
-####App: mouseIsDown
-Set to `True` when the display is touched and to `False` when it is released.
+Draws the buttons and calls their functions when touched on.

 ####App: def update(self, screen, deltatime)
 - Draws the buttons. If the display is touched, it draws the touched button in inverted colors.
-- Checks if the mouse is over a button when `App.onMouseDown` is `True` to select the color-inverted button.
+- Checks if the mouse is over a button when `ui.isMouseDown` is `True` to select the color-inverted button.
 - Also checks, if `UITools.showMsg` is `True`. It then does nothing except for drawing the buttons.

 ####App: def onMouseDown(self)
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Wed, 20 Mar 2024 04:32:42 -0000</pubDate><guid>https://sourceforge.net083d4fd7bdce3a2b96d048a37b9720d9f2c1d836</guid></item><item><title>APP_MENU modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/APP_MENU/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -1,3 +1,4 @@
+[TOC]
 #APP_MENU.py
 Go back [Home]

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Fri, 08 Mar 2024 21:47:29 -0000</pubDate><guid>https://sourceforge.netb35c05b25dd8f0a2df55e1245302d95a463bf5e7</guid></item><item><title>APP_MENU modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/APP_MENU/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -34,7 +34,6 @@
 `menuTitle` is the text shown on the corresponding button.
 `menuFunc` is the function that gets called when the button is touched. (Without () )

-
 ###App(APP_BASE.BaseAppClass)
 The App. See [APP_TEMPLATE] for further information.

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Fri, 08 Mar 2024 21:35:43 -0000</pubDate><guid>https://sourceforge.net82e15f9e8d4403bdb2eebb27875ee880940f7477</guid></item><item><title>APP_MENU modified by Benedict Jäggi</title><link>https://sourceforge.net/p/pirobot/wiki/APP_MENU/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="app_menupy"&gt;APP_MENU.py&lt;/h1&gt;
&lt;p&gt;Go back &lt;a class="alink" href="/p/pirobot/wiki/Home/"&gt;[Home]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A "widely" used menu app with 6 buttons to touch on.&lt;br/&gt;
Each button has a name and can call a given function.&lt;/p&gt;
&lt;p&gt;Use the &lt;code&gt;cMenu&lt;/code&gt; class to create your own menus or set the buttons of the actual selected menu directly.&lt;br/&gt;
A &lt;code&gt;cMenu&lt;/code&gt; instance will be created at startup automatically and be set to the &lt;code&gt;CURRENT_MENU&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="global-variables"&gt;Global Variables&lt;/h2&gt;
&lt;h3 id="current_menu"&gt;CURRENT_MENU&lt;/h3&gt;
&lt;p&gt;The actual shown and processed &lt;code&gt;cMenu&lt;/code&gt;-instance.&lt;br/&gt;
Set it directly to another one to change the menu.&lt;/p&gt;
&lt;hr/&gt;
&lt;h2 id="functions"&gt;Functions&lt;/h2&gt;
&lt;h3 id="def-nullfunc"&gt;def nullfunc()&lt;/h3&gt;
&lt;p&gt;A function which does absolutely nothing. Used for empty buttons.&lt;/p&gt;
&lt;h3 id="def-setmenuitembuttonidx-menutitle-menufunc"&gt;def setMenuItem(buttonIdx, menuTitle, menuFunc)&lt;/h3&gt;
&lt;p&gt;Calls &lt;code&gt;setMenuItem&lt;/code&gt; on the &lt;code&gt;CURRENT_MENU&lt;/code&gt;-instance.&lt;/p&gt;
&lt;hr/&gt;
&lt;h2 id="classes"&gt;Classes&lt;/h2&gt;
&lt;h3 id="cmenu"&gt;cMenu&lt;/h3&gt;
&lt;p&gt;A menu class. It has 6 button items containing the text shown on the button and the function to be called.&lt;/p&gt;
&lt;h4 id="cmenu-def-setmenuitemself-buttonidx-menutitle-menufunc"&gt;cMenu: def setMenuItem(self, buttonIdx, menuTitle, menuFunc)&lt;/h4&gt;
&lt;p&gt;Set the button with index &lt;code&gt;buttonIdx&lt;/code&gt; (0 to 5) to the given &lt;code&gt;menuTitle&lt;/code&gt; and &lt;code&gt;menuFunc&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;buttonIdx&lt;/code&gt; is the index of the button. Ranges from 0 to 5.&lt;br/&gt;
&lt;code&gt;menuTitle&lt;/code&gt; is the text shown on the corresponding button.&lt;br/&gt;
&lt;code&gt;menuFunc&lt;/code&gt; is the function that gets called when the button is touched. (Without () )&lt;/p&gt;
&lt;h3 id="appapp_basebaseappclass"&gt;App(APP_BASE.BaseAppClass)&lt;/h3&gt;
&lt;p&gt;The App. See &lt;a class="alink" href="/p/pirobot/wiki/APP_TEMPLATE/"&gt;[APP_TEMPLATE]&lt;/a&gt; for further information.&lt;/p&gt;
&lt;h4 id="app-mouseisdown"&gt;App: mouseIsDown&lt;/h4&gt;
&lt;p&gt;Set to &lt;code&gt;True&lt;/code&gt; when the display is touched and to &lt;code&gt;False&lt;/code&gt; when it is released.&lt;/p&gt;
&lt;h4 id="app-def-updateself-screen-deltatime"&gt;App: def update(self, screen, deltatime)&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Draws the buttons. If the display is touched, it draws the touched button in inverted colors.&lt;/li&gt;
&lt;li&gt;Checks if the mouse is over a button when &lt;code&gt;App.onMouseDown&lt;/code&gt; is &lt;code&gt;True&lt;/code&gt; to select the color-inverted button.&lt;/li&gt;
&lt;li&gt;Also checks, if &lt;code&gt;UITools.showMsg&lt;/code&gt; is &lt;code&gt;True&lt;/code&gt;. It then does nothing except for drawing the buttons.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="app-def-onmousedownself"&gt;App: def onMouseDown(self)&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Sets &lt;code&gt;App.onMouseDown&lt;/code&gt;to &lt;code&gt;True&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="app-def-onmouseupself"&gt;App: def onMouseUp(self)&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Sets &lt;code&gt;App.onMouseUp&lt;/code&gt; to &lt;code&gt;False&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Checks, if mouse is over a button and calls the corresponding button function if so.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That's all folks. Go back &lt;a class="alink" href="/p/pirobot/wiki/Home/"&gt;[Home]&lt;/a&gt; to have a look on the other Apps.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Fri, 08 Mar 2024 21:34:52 -0000</pubDate><guid>https://sourceforge.net32383f6b1a632f100162b069d8ac7ba869c712c4</guid></item></channel></rss>