[REPORT] problem with choose CMD - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: [REPORT] problem with choose CMD (/thread-7359.html) |
[REPORT] problem with choose CMD - compsystems - 12-03-2016 04:27 PM Hello The logic of the following code fails, because choose must return 1 when [OK/ENTER] is pressed PHP Code: export INPUTtest0() RE: problem with choose CMD - eried - 12-03-2016 04:40 PM Syntax: CHOOSE(var, “title”, “item1”, “item2”,[…"item14"]) or CHOOSE(var,"title",{"item1"..."itemN"}) Displays a choose box with the given "title" and containing items with the strings "item1", etc. If the user chooses an object, var will be updated to contain the number of the selected object (an integer, 1, 2, 3, …); otherwise, stores zero in var if the user exits without choosing. Returns true (non zero) if the user selects an object, otherwise returns false (0). RE: problem with choose CMD - compsystems - 12-03-2016 05:05 PM According to the help this CHOOSE cmd is correct, but it has not utility because the variable of the position returns the place of the selection, the output must be 1/0 as does INPUT CMD Another improvement that must be made is that, it should be labeled up "Z" PHP Code: choose(currentPos,"test choose",{ "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O" }); // OK RE: problem with choose CMD - StephenG1CMZ - 12-03-2016 05:33 PM Compsystems, a few words of explanation of what it is that you are trying to achieve would help greatly. Since you have several inputs but want a 0 or 1 rather than a position... Do you want to enter (a,b,c,d) And see {0,1,0,1} for example...depending on which values the user has entered? Or something else? The fact that your example says it is OK from A to O suggests the difficulty may be related to keyboard mapping..Up to "O" the alphabet is unambiguous and items can be chosen by tapping the relevant key instead of scrolling. . After "O" that is no longer possible as the alphabet begins to overlap the numbers on the HP Prime keypad. RE: problem with choose CMD - eried - 12-03-2016 06:12 PM (12-03-2016 05:33 PM)StephenG1CMZ Wrote: Compsystems, a few words of explanation of what it is that you are trying to achieve would help greatly. I think he wants 1 and 0 for OK and CANCEL instead of VALUE and 0 for OK and CANCEL. CHOOSE is probably using the same variable for both, I don't see the benefit of adding an extra step besides nitpicking something. Just use: Code: IF( choose(var,"title",{something,...}) ) THEN RE: problem with choose CMD - StephenG1CMZ - 12-03-2016 06:27 PM If the only problem is the test If keypress==OK Failing because keypress is N rather than 1 On the HP Prime you can just use If keypress then Any non-zero value will pass the test. A very convenient syntax. RE: problem with choose CMD - Han - 12-04-2016 04:21 AM (12-03-2016 05:33 PM)StephenG1CMZ Wrote: The fact that your example says it is OK from A to O suggests the difficulty may be related to keyboard mapping..Up to "O" the alphabet is unambiguous and items can be chosen by tapping the relevant key instead of scrolling. . After "O" that is no longer possible as the alphabet begins to overlap the numbers on the HP Prime keypad. Use the Alpha modifier key for keys that have both numbers and letters assigned to them. RE: problem with choose CMD - Tim Wessman - 12-05-2016 03:28 PM (12-04-2016 04:21 AM)Han Wrote:(12-03-2016 05:33 PM)StephenG1CMZ Wrote: The fact that your example says it is OK from A to O suggests the difficulty may be related to keyboard mapping..Up to "O" the alphabet is unambiguous and items can be chosen by tapping the relevant key instead of scrolling. . After "O" that is no longer possible as the alphabet begins to overlap the numbers on the HP Prime keypad. Well, but then the alpha search doesn't work... |