Hello everyone
*****
Link to image files has been fixed, sorry for the inconvenience.
*****
I've made many unit conversion programs for fx-5800P (and fx-9860GII). For example temp unit Fahrenheit
Anyway, when I think of good display design for unit conversion program, I believe it's important that all the numbers in different units can be seen at one view all the time without scrolling. So I should control location and length of input number. I hope to have an input command just like Edit Box control used for Windows programming.
I've been dreaming Casio Basic new command, LocInput which allows me to set coordinate and length of input, also I want to edit my input.
So I made 'Input Box' for Casio Basic. It's called from main program and runs as sub-routine.
With this program, simply set coordinate X and Y, max digits and select indicator type to prompt fix input value, then call Input Box, you can edit within the set maximum digits, after fixing your input by
key then it returns the input value;
4->X:3->Y:8->D:2->E
Prog "IN"
Z->A
'IN' is file name of the Input Box. Z is returned by the Input Box and the return is substituted to any variable A.
If you use Casio Basic input command ?->, instead of the above 3 lines code,
it's so simple like...
" K"?->K
but you have to allow scrolling. I do not like this.
So, let me show you how the Input Box is making your program better.
Here is an example where I use the Input Box 'Temperature Conversion' Program;
Press
to input absolute temp...
The Input Box appears where exactly I want with max 8 digits as I set.
Then input 77 that is liquid Nitrogen temp;
You can edit your input, add more digits or delete by
key.Press
to enter the input, then...
I have my answer; converted temp of liquid Nitrogen.
Using Input Box, you see no scrolling and you see 3 values in one view. Now I hope you see what is about the Input Box and how it works on Casio Basic.
Just for your quick review, please try TempConv program for fx-9860GII.
Download: TEMPCONV (1gm file)
======
I made 3 versions for Input Box for each of fx-5800P and fx-9860GII (total 6 versions);
1. File Name: IN
This version allows you to input decimal number.
Download source;
- For fx-9860GII: IN ver 2.1G (g1m file)
- For fx-5800P: IN ver 2.0 (jpg file)
2. File Name: INP
This version allows you to input positive decimal number and 0 (zero).
Download source;
- For fx-9860GII: INP ver 2.1G (g1m file)
- For fx-5800P: INP ver 2.0 (jpg file)
3. File Name: INPI
This version allows you to input natural number (positive integer) and 0 (zero).
Download source;
- For fx-9880GII: INPI ver 2.1G (g1m file)
- For fx-5800P: INPI ver 2.1 (jpg file)
=====
Usage of Input Box;
[X coord]->X
[Y coord]->Y
[max digits]->D
[indicator type]->E
Prog "IN" [ or "INP" or "INPI"]
Z->[variable]
Indicator appears in the bottom line of LCD.
Indicator types;
- E=2; Large Indicator, <EXE>:ENTER
- E=1; Small Indicator, ▸E
- E = other than 2 and 1
No indicator appears.
Important notice to use Input Box;
Please especially take care of variables you use in your main program which call Input Box as sub-routine. Because Casio Basic is ultimate global variables system.
Input Box uses following variables;
- X, Y, D, E for settings of Input Box
- C, I and F(this is used in IN and INP, not in INPI)
- Array variable Z[ ]
Please do not use array variable Z[ ] in your main program.
You can use other variables, but substituted value of those are changed during functioning of Input Box, so use those variables in your main program taking this into account.
With slow fx-5800P, Input Box works properly (I should say acceptable in its response speed). Actually the first version was so slow, then changed its logic to get current speed.
=====
Here is test program of Input Box;
File Name: INTEST
- For fx-9860GII: INTEST (g1m file)
- For fx-5800P
0->S:0->T:0->U:0->Z Locate 1,1,"1:" Locate 1,2,"2:" Locate 1,3,"3:" While 1 -1->M Do:Getkey->K LpWhile K=0 K=36=>1->M K=36=>2->M K=37=>3->M Locate 1,4," " If M=1:Then 3->X:1->Y:10->D:2->E Prog "INPI":Z->S Else If M=2 Then 3->X:2->Y:10->D:1->E Prog "INP":Z->T Else If M=3 Then 3->X:3->Y:10->D:1->E Prog "IN":Z->U IfEnd:IfEnd IfEnd Locate 1,4,"Z=" Locate 3,4,Z WhileEnd
Input Box has been originally developed for fx-5800P which dose not have string functions in Casio Basic. So this Input Box handles only number input. And this has been simply ported to fx-9860GII Casio Basic.
I will probably introduce some programs using Input Box as examples.
Edited by Krtyski, 15 July 2015 - 06:24 AM.