summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpgen <p.gen.progs@gmail.com>2019-03-14 22:52:10 +0100
committerpgen <p.gen.progs@gmail.com>2019-03-17 20:54:28 +0100
commitdd67a61831a69059b6bf1e249a2153712e0a613d (patch)
treea0c3f9690be6970edc4e2ee233d20af960d9e958
parenta6c52c745432db01b8b4f66f4bdf6d0dc320f9f7 (diff)
Improve the simple_menu example
The .eraseafter and .centered directives are now set to yes by default. The message (title) is enhanced.
-rw-r--r--examples/simple_menu/main.mnu2
-rwxr-xr-xexamples/simple_menu/simple_menu.sh11
-rw-r--r--examples/simple_menu/sub1.mnu1
3 files changed, 6 insertions, 8 deletions
diff --git a/examples/simple_menu/main.mnu b/examples/simple_menu/main.mnu
index fe3e363..92c517c 100644
--- a/examples/simple_menu/main.mnu
+++ b/examples/simple_menu/main.mnu
@@ -5,8 +5,6 @@
# .title: The menu tittle
.columns 2
-.centered yes
-.eraseafter yes
.title Simple menu
ITEM1 First item
diff --git a/examples/simple_menu/simple_menu.sh b/examples/simple_menu/simple_menu.sh
index 2092478..e5b0280 100755
--- a/examples/simple_menu/simple_menu.sh
+++ b/examples/simple_menu/simple_menu.sh
@@ -47,9 +47,9 @@ USER_PROGRAM=$2
# ======================================================================= #
function process_menu
{
- TITLE="[ENTER: select, q: abort]"$'\n' # Untitled by default
- CENTERING= # Is the menu centered in the screen ?
- ERASE= # Destroy the selection window after use
+ TITLE=$'\n'"[ENTER: select, q: abort]" # Untitled by default
+ CENTERING="-M" # Is the menu centered in the screen ?, defaults to yes
+ ERASE="-d" # Destroy the selection window after use. Defaults to yes
MENU_FILE=$1
MENU= # Make sure the working area is empty
@@ -72,11 +72,11 @@ function process_menu
;;
.centered) # Is the menu centered?
- [[ $VALUE == yes ]] && CENTERING="-M"
+ [[ $VALUE == no ]] && CENTERING=""
;;
.eraseafter) # Will the space used by the menu be reclaimed?
- [[ $VALUE == yes ]] && ERASE="-d"
+ [[ $VALUE == no ]] && ERASE=""
;;
.title) # The menu title
@@ -145,6 +145,7 @@ function process_menu
-N \
-F -D o:10 i:0 n:2 \
-n \
+ -a m:0/6 \
-m "$TITLE" \
-t $COL \
-S'/@@@/ /' \
diff --git a/examples/simple_menu/sub1.mnu b/examples/simple_menu/sub1.mnu
index 5015142..d654a9e 100644
--- a/examples/simple_menu/sub1.mnu
+++ b/examples/simple_menu/sub1.mnu
@@ -1,6 +1,5 @@
.columns 1
.title First submenu
-.eraseafter yes
SUB1ITEM1 First item of the first submenu
SUB1ITEM2 Second item of the first submenu
===