LibMenu : a simple toolbox for easy menu handling
|
11-11-2016, 06:51 PM
(This post was last modified: 09-03-2017 05:47 PM by primer.)
Post: #1
|
|||
|
|||
LibMenu : a simple toolbox for easy menu handling
Hi,
Here is a small Lib I made to handle menu in a simple way. If you needed to use DRAWMENU(), you know that you have to handle yourself MOUSE events to trigger actions, this lib cover the whole process. API : - LibMenu.reset() : prepare for a (new) menu, call it first. - LibMenu.entry(pos, label, action) : register a menu entry, at given position (1 to 6). action is a string with function name that will be triggered. - LibMenu.draw() : draw the menu (like the buildin DRAWMENU) - LibMenu.events() : check if user has clicked on a menu entry and trigger actions. it does not stop program execution, to be used in your program loop. How to use : Code: EXPORT funct1() BEGIN ... END; // define function that will be called on menu click. Obviously, you had to define your own actions in func1() and funct2() functions. Important : if your functions are not public (no EXPORT), you have to provide the full qualified name (with your program name), like this : Code: funct1() //without EXPORT Download v1.1 : LibMenu.hpprgm (Size: 3.19 KB / Downloads: 29) Changelog 1.1 : fixed : don't multi call function until finger is not released. ===> Jump to version 2.1 * click here * - with a video. ===> Jump to version 3 * click here * Note : This version 1 is very simple (next versions provide enhanced features) primer |
|||
11-17-2016, 04:54 PM
(This post was last modified: 11-17-2016 05:02 PM by compsystems.)
Post: #2
|
|||
|
|||
RE: LibMenu : a simple toolbox for easy menu handling
Hello, some questions and others
1: I Remove some apparently unnecessary EXPORT 2: The local variables p,t,ar (if they are in lowercase) of the function entryMenu(p,t,ar) must be defined as local in the header (Why?) 3: The variable STAY is not working, when a subfunction f1() is called stay->0, why? LIBRARY FILE: PHP Code: //FILE:=LibMenu; TEST FILE PHP Code: //FILE:=LibMenuTest; |
|||
11-22-2016, 10:32 PM
(This post was last modified: 11-22-2016 10:50 PM by primer.)
Post: #3
|
|||
|
|||
RE: LibMenu : a simple toolbox for easy menu handling
(11-17-2016 04:54 PM)compsystems Wrote: 1: I Remove some apparently unnecessary EXPORTYes, you are right, we don't need the EXPORT, I'll removed them later. (11-17-2016 04:54 PM)compsystems Wrote: 2: The local variables p,t,ar (if they are in lowercase) of the function entryMenu(p,t,ar) must be defined as local in the header (Why?)I don't understand... these variables are not lowercase, I defined them uppercase. Code: EXPORT entry(P,T,A) (11-17-2016 04:54 PM)compsystems Wrote: 3: The variable STAY is not working, when a subfunction f1() is called stay->0, why?that's because you touch the 6th menu to end the msgbox (you press the "OK") then your finger is still on that menu and then it catch your exit... That's an issue I've already seen : if you let your finger on the screen, functions are continuously called. I'm working on a fix for that. edit : it's now fixed, see version 1.1 on first post. primer |
|||
11-27-2016, 10:58 AM
(This post was last modified: 11-27-2016 06:32 PM by primer.)
Post: #4
|
|||
|
|||
RE: LibMenu : a simple toolbox for easy menu handling
Version 2.1 :
Changelog : - added a new entry type : toggle button. - can now display up to 10 menu entries (on two screens, automatically set "next"/"prev") Added API : - LibMenu.entrytoggle(pos,label) : add entry <pos> as a toggle button. - LibMenu.gettoggle(pos) : return toggle status for entry number <pos>. Download : LibMenu.hpprgm (Size: 6 KB / Downloads: 32) Demonstration : video the program to test LibMenu used in the video : tstLibM.hpprgm (Size: 3.95 KB / Downloads: 40) primer |
|||
11-28-2016, 01:24 PM
(This post was last modified: 12-18-2016 03:35 AM by compsystems.)
Post: #5
|
|||
|
|||
RE: LibMenu : a simple toolbox for easy menu handling
Works very well
Ideas 1: Make the [menu] key hide or re-display the menu bar 2: to be able to add an icon to each menu, I think you should use the manipulation of graphics and no longer the function DRAWMENU Thanks |
|||
11-28-2016, 10:04 PM
Post: #6
|
|||
|
|||
RE: LibMenu : a simple toolbox for easy menu handling
(11-28-2016 01:24 PM)compsystems Wrote: 2: to be able to add an icon to each menu, I think you should use the manipulation of graphics and no longer the function DRAWMENU hey, I have a very good news for you... you can already use icon for menu entries (but not toggle ones) Look at this example : DIMGROB_P(G5,60,22,#83E0h); // blue DIMGROB_P(G6,60,22,#FC00h); //green TRIANGLE_P(G6,0,4,40,0,50,18,#83E0h,#FF0000h,#D5AD35h); LibMenu.entry(1,G5,"tstLibM.f1()"); // *** 1 *** LibMenu.entry(2,G6,"tstLibM.f2()"); // *** 2 *** primer |
|||
12-11-2016, 01:20 PM
Post: #7
|
|||
|
|||
RE: LibMenu : a simple toolbox for easy menu handling
Version 3 :
Changelog : - added a new entry type : tab button. - can now change toggle flag - removed EXPORT from methods, you must prefix method with LibMenu. Added API : - LibMenu.deftab(pos1,pos2,active) : each entries are now tab entries. (from pos1 to pos2) - LibMenu.chgflag(pos) : change toggle flag. Tab usage example : Code: LibMenu.entry(1,"tab1","tstLibM.f1()"); // define action : f1() download LibMenu.hpprgm (Size: 7.47 KB / Downloads: 100) primer |
|||
12-11-2016, 03:51 PM
(This post was last modified: 01-26-2017 12:53 AM by compsystems.)
Post: #8
|
|||
|
|||
RE: LibMenu : a simple toolbox for easy menu handling
.
Idea: a function is required to determine the number of menus, currently works maximum with 12 =( n:=# entryMenus( n ); m:={"","","","","","","","","","","",""}; // => m:=MAKELIST("",X,1,n) a:={"","","","","","","","","","","",""}; // => a:=MAKELIST("",X,1,n) f:={0,0,0,0,0,0,0,0,0,0,0,0}; // => f:=MAKELIST(0,X,1,n) |
|||
12-29-2016, 01:37 PM
Post: #9
|
|||
|
|||
RE: LibMenu : a simple toolbox for easy menu handling
Hello Primer,
thank you very much for porting the menus to the Prime. It works very well for me. I had an older version without the next/prev soft buttons... Congrats also for the code which is very elegant. Thanks Giancarlo from Italy |
|||
05-07-2018, 05:55 AM
(This post was last modified: 05-07-2018 08:59 AM by tcab.)
Post: #10
|
|||
|
|||
RE: LibMenu : a simple toolbox for easy menu handling
Thanks for this library of menu related functions - arguably this should be built into the Prime!
A few questions and tips:
Code:
|
|||
10-05-2018, 02:08 PM
Post: #11
|
|||
|
|||
RE: LibMenu : a simple toolbox for easy menu handling
An idea, inspired by the calculators casio, please make each menu, have three options one with the key [alpha] (left side), another with the key [shift] (center), and the third option (right side) from the menu.
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)