HP Forums
Help with INPUT and chekbox - 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: Help with INPUT and chekbox (/thread-3941.html)



Help with INPUT and chekbox - salvomic - 05-22-2015 10:35 AM

hi,
I need to se two checkboxes in INPUT in a program.
This chunk of code doesn't work:
Code:
{flg,2,{85,2, 5}}, {beg,1, {15,1,5}}

if I check flg, is unchecked beg, and vice versa...
I will set two checkbox not two radio buttons...

help Smile

Salvo


RE: Help with INPUT and chekbox - DrD - 05-22-2015 12:04 PM

According to Help Input Form:

{var_name, real, [{pos}]} to create a checkbox control. If real is >1 then this checkbox gets pooled ...

So use the value 0 for real, then your check boxes will be able to get checked independently:

Change this: {flg,2,{85,2, 5}}, {beg,1, {15,1,5}}
to this: {flg,0,{85,2, 5}}, {beg,0, {15,1,5}}


RE: Help with INPUT and chekbox - DrD - 05-22-2015 12:22 PM

In case my previous suggestion doesn't work for your example, here is another working fragment:

Code:

EXPORT test()
BEGIN
local mast,b,c,A;

input({ {mast,[0],{14,10,2}},
        {b,0,{37,10,1}},
        {c,0,{37,10,2}},
        {A,0,{37,10,3}} },
        "Sail Parameters",
        {"Mast","Foot","Luff","Angle"},
        {"Mast eye","Boom eye","Sail Luff","Foot to Luff Included Angle"});
END;



RE: Help with INPUT and chekbox - salvomic - 05-22-2015 01:42 PM

yeah, Dale!
it work well.

I thought that the logic was 0-1, but I had only examples with 1 or 2...

Another question, about INPUT:
I've three fields: day (textbox), month (dropbox), year (textbox):
Code:

...
{dd1,[0],{15,15,1}}, 
{mm1,{"1","2","3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}, {40,15,1}}, 
{yy1,[0],{70,20,1}},
...
Why the cursor shift from dd1 to yy1, passing away mm1?
I thought a sequence like 1-2-3, not 1-3-(2?)...
There are customization to set the correct sequence?

(PS: I'm using input like this one into "Simple Interest" and "Odd period" program, to calc date difference, days for interest, and so on...)

Salvo


RE: Help with INPUT and chekbox - DrD - 05-22-2015 03:04 PM

I'm not sure. Could you post the entire INPUT() line? Most likely it has to do with the position parameters. Perhaps line length gets too long?

Also, I get a syntax error when compiling the odd_period() program (from your other thread), when run on the emulator. Does it run okay for you?


RE: Help with INPUT and chekbox - salvomic - 05-22-2015 03:55 PM

(05-22-2015 03:04 PM)DrD Wrote:  I'm not sure. Could you post the entire INPUT() line? Most likely it has to do with the position parameters. Perhaps line length gets too long?

the long long line is this, but I must reorder some parameters (obviously the dates should be for me, Italian, dd mm yy)...
Code:

input ({ {dd1,[0],{15,15,1}}, 
{mm1,{"1","2","3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}, {40,15,1}}, 
{yy1,[0],{70,15,1}},
{dd2,[0],{15,15,3}}, 
{mm2,{"1","2","3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}, {40,15,3}}, 
{yy2,[0],{70,15,3}},
{pv, [0], {15,15,4}}, 
{n, [0], {40,15,4}},{r,[0],{70,15,4}},
{beg,0, {20,2,5}}, {flg,0,{80,2, 5}}
}, 
"Calc difference days", {"d1", "m1", "y1", "d2", "m2", "y2", 
"PV", "N","r%", "End","Financial"}, 
{"Day 1", "Month 1", "Year 1", "Day 2", "Month 2", "Year 2", 
"Present value", "Yearly pmt n", "Yearly rate%", 
"Begin or End", "Financial year (360)"
}, 
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0}, 
{1, 1, 2015, 1, 1, 2015, 1000, 36, 5, 1, 1} );

Quote:Also, I get a syntax error when compiling the odd_period() program (from your other thread), when run on the emulator. Does it run okay for you?

This morning I copied from my raft here in the Mac...

EDIT: now it should work. I've put in the post the version from the Prime...

Salvo