Z Periodic Table (tableau periodique) - StephenG1CMZ - 01-12-2016 12:56 PM
Following last weeks announcement in the media that the discovery of new elements has been confirmed, I thought I would make a simple periodic table. This one fits on one page, unlike some that need scrolling. And it works on the Android emulation.
There is some limited interaction, but the user interface does need more work.
Element names and symbols are case sensitive.
Code:
//PERIODS
//LOCAL APERIODS:={1,3,11,19,37,55,87};
//ELEMENT DATA AND POSITION
//ATOM: 1..118 = LIST POS
//GROUP/COL: 1..18 OR NONE(<0:ARBITRARY FOR DISPLAY ONLY)
//PERIOD/ROW: 1..7
EXPORT Z_ELEMENTS:={
{ 1, 1, 1},
{ 2, 18, 1},
{ 3, 1, 2},
{ 4, 2, 2},
{ 5, 13, 2},
{ 6, 14, 2},
{ 7, 15, 2},
{ 8, 16, 2},
{ 9, 17, 2},
{ 10, 18, 2},
{ 11, 1, 3},
{ 12, 2, 3},
{ 13, 13, 3},
{ 14, 14, 3},
{ 15, 15, 3},
{ 16, 16, 3},
{ 17, 17, 3},
{ 18, 18, 3},
{ 19, 1, 4},
{ 20, 2, 4},
{ 21, 3, 4},
{ 22, 4, 4},
{ 23, 5, 4},
{ 24, 6, 4},
{ 25, 7, 4},
{ 26, 8, 4},
{ 27, 9, 4},
{ 28, 10, 4},
{ 29, 11, 4},
{ 30, 12, 4},
{ 31, 13, 4},
{ 32, 14, 4},
{ 33, 15, 4},
{ 34, 16, 4},
{ 35, 17, 4},
{ 36, 18, 4},
{ 37, 1, 5},
{ 38, 2, 5},
{ 39, 3, 5},
{ 40, 4, 5},
{ 41, 5, 5},
{ 42, 6, 5},
{ 43, 7, 5},
{ 44, 8, 5},
{ 45, 9, 5},
{ 46, 10, 5},
{ 47, 11, 5},
{ 48, 12, 5},
{ 49, 13, 5},
{ 50, 14, 5},
{ 51, 15, 5},
{ 52, 16, 5},
{ 53, 17, 5},
{ 54, 18, 5},
{ 55, 1, 6},
{ 56, 2, 6},
{ 57, −3, 6},
{ 58, −4, 6},
{ 59, −5, 6},
{ 60, −6, 6},
{ 61, −7, 6},
{ 62, −8, 6},
{ 63, −9, 6},
{ 64,−10, 6},
{ 65,−11, 6},
{ 66,−12, 6},
{ 67,−13, 6},
{ 68,−14, 6},
{ 69,−15, 6},
{ 70,−16, 6},
{ 71,−17, 6},
{ 72, 4, 6},
{ 73, 5, 6},
{ 74, 6, 6},
{ 75, 7, 6},
{ 76, 8, 6},
{ 77, 9, 6},
{ 78, 10, 6},
{ 79, 11, 6},
{ 80, 12, 6},
{ 81, 13, 6},
{ 82, 14, 6},
{ 83, 15, 6},
{ 84, 16, 6},
{ 85, 17, 6},
{ 86, 18, 6},
{ 87, 1, 7},
{ 88, 2, 7},
{ 89, −3, 7},
{ 90, −4, 7},
{ 91, −5, 7},
{ 92, −6, 7},
{ 93, −7, 7},
{ 94, −8, 7},
{ 95, −9, 7},
{ 96,−10, 7},
{ 97,−11, 7},
{ 98,−12, 7},
{ 99,−13, 7},
{100,−14, 7},
{101,−15, 7},
{102,−16, 7},
{103,−17, 7},
{104, 4, 7},
{105, 5, 7},
{106, 6, 7},
{107, 7, 7},
{108, 8, 7},
{109, 9, 7},
{110, 10, 7},
{111, 11, 7},
{112, 12, 7},
{113, 13, 7},
{114, 14, 7},
{115, 15, 7},
{116, 16, 7},
{117, 17, 7},
{118, 18, 7}
};
EXPORT Z_ELEMENTNAMES:={
{ 1,"H", "hydrogen"},
{ 2,"He", "helium"},
{ 3,"Li", "lithium"},
{ 4,"Be", "beryllium"},
{ 5,"B", "boron"},
{ 6,"C", "carbon"},
{ 7,"N", "nitrogen"},
{ 8,"O", "oxygen"},
{ 9,"F", "fluorine"},
{ 10,"Ne", "neon"},
{ 11,"Na", "sodium"},
{ 12,"Mg", "magnesium"},
{ 13,"Al", "aluminium"},
{ 14,"Si", "silicon"},
{ 15,"P", "phosphorus"},
{ 16,"S", "sulfur"},
{ 17,"Cl", "chlorine"},
{ 18,"Ar", "argon"},
{ 19,"K", "potassium"},
{ 20,"Ca", "calcium"},
{ 21,"Sc", "scandium"},
{ 22,"Ti", "titanium"},
{ 23,"V", "vanadium"},
{ 24,"Cr", "chromium"},
{ 25,"Mn", "manganese"},
{ 26,"Fe", "iron"},
{ 27,"Co", "cobalt"},
{ 28,"Ni", "nickel"},
{ 29,"Cu", "copper"},
{ 30,"Zn", "zinc"},
{ 31,"Ga", "gallium"},
{ 32,"Ge", "germanium"},
{ 33,"As", "arsenic"},
{ 34,"Se", "selenium"},
{ 35,"Br", "bromine"},
{ 36,"Kr", "krypton"},
{ 37,"Rb", "rubidium"},
{ 38,"Sr", "strontium"},
{ 39,"Y", "yttrium"},
{ 40,"Zr", "zirconium"},
{ 41,"Nb", "niobium"},
{ 42,"Mo", "molybdenum"},
{ 43,"Tc", "technetium"},
{ 44,"Ru", "ruthenium"},
{ 45,"Rh", "rhodium"},
{ 46,"Pd", "palladium"},
{ 47,"Ag", "silver"},
{ 48,"Cd", "cadmium"},
{ 49,"In", "indium"},
{ 50,"Sn", "tin"},
{ 51,"Sb", "antimony"},
{ 52,"Te", "tellurium"},
{ 53,"I", "iodine"},
{ 54,"Xe", "xenon"},
{ 55,"Cs", "caesium"},
{ 56,"Ba", "barium"},
{ 57,"La", "lanthanum"},
{ 58,"Ce", "cerium"},
{ 59,"Pr", "praseodymium"},
{ 60,"Nd", "neodymium"},
{ 61,"Pm", "promethium"},
{ 62,"Sm", "samarium"},
{ 63,"Eu", "europium"},
{ 64,"Gd", "gadolinium"},
{ 65,"Tb", "terbium"},
{ 66,"Dy", "dysprosium"},
{ 67,"Ho", "holmium"},
{ 68,"Er", "erbium"},
{ 69,"Tm", "thulium"},
{ 70,"Yb", "ytterbium"},
{ 71,"Lu", "lutetium"},
{ 72,"Hf", "hafnium"},
{ 73,"Ta", "tantalum"},
{ 74,"W", "tungsten"},
{ 75,"Re", "rhenium"},
{ 76,"Os", "osmium"},
{ 77,"Ir", "iridium"},
{ 78,"Pt", "platinum"},
{ 79,"Au", "gold"},
{ 80,"Hg", "mercury"},
{ 81,"Ti", "thallium"},
{ 82,"Pb", "lead"},
{ 83,"Bi", "bismuth"},
{ 84,"Po", "polonium"},
{ 85,"At", "astatine"},
{ 86,"Rn", "radon"},
{ 87,"Fr", "francium"},
{ 88,"Ra", "radium"},
{ 89,"Ac", "actinium"},
{ 90,"Th", "thorium"},
{ 91,"Pa", "protactinium"},
{ 92,"U", "uranium"},
{ 93,"Np", "neptunium"},
{ 94,"Pu", "plutonium"},
{ 95,"Am", "americium"},
{ 96,"Cm", "curium"},
{ 97,"Bk", "berkelium"},
{ 98,"Cf", "californium"},
{ 99,"Es", "einsteinium"},
{100,"Fm", "fermium"},
{101,"Md", "mendelevium"},
{102,"No", "nobelium"},
{103,"Lr", "lawrencium"},
{104,"Rf", "rutherfordium"},
{105,"Db", "dubnium"},
{106,"Sg", "seaborgium"},
{107,"Bh", "bohrium"},
{108,"Hs", "hassium"},
{109,"Mt", "meitnerium"},
{110,"Ds", "darmstadtium"},
{111,"Rg", "roentgenium"},
{112,"Cn", "copernicium"},
{113,"Uut","ununtrium"},
{114,"Fl", "flerovium"},
{115,"Uue","ununpentium"},
{116,"Lv", "livermorium"},
{117,"Uus","ununseptium"},
{118,"Uuo","ununoctium"}
};
LOCAL SHO_P:=0;
LOCAL NELE:=SIZE(Z_ELEMENTS);
LOCAL NGRPS:=18;//MAX(GROUPS)
LOCAL NPRDS:= 7;//MAX(PERIODS)
LOCAL NCOLS:=NGRPS+SHO_P;
LOCAL NROWS:=NPRDS+2+1;//2 EXTRA ROWS
LOCAL COLSZ:=IP(320/NCOLS);
LOCAL ROWSZ:=IP(220/NROWS/2);//2 LINES PER ROW
LOCAL FONTSZ:=1;//1..7 1..2
LOCAL MNU:={"Symb","Enter","Num"};
LOCAL EL,ELSYM,APRD,DPRD,LGRP,DGRP;
LOCAL II,KK,ML;
LOCAL BOXED;
LOCAL LSYM,LELE;
LOCAL SY:="";
MSNK()
BEGIN
LOCAL SNK:=MOUSE();
END;
DRW_ELE_BOX(LPOS,ONE,TWO)
BEGIN
LOCAL LMG:=6;//
LOCAL LW:=1;//LINEWIDTH:KEEP TEXT OFF BOXLINE
LOCAL DGRP:=MAX(LPOS(1)-1,0);//TRY
LOCAL DPRD:=LPOS(2);
LOCAL XX:=IP(DGRP*COLSZ)+LMG;
LOCAL YY:=IP(2*DPRD*ROWSZ);
//OMIT U ON SMALL SCREENS)
LOCAL THREE:=IFTE(DIM(TWO)==3 AND GROBW_P()<640,MID(TWO,2),TWO);
IF BOXED THEN
RECT_P(XX,YY,XX+COLSZ,YY+2*ROWSZ,#0,#EEEEEE);//BLACK EDGE GREY FILL
END;
//LINES 1 AND 2
TEXTOUT_P(ONE,XX,YY+LW,FONTSZ);
//RECT_P(0,2*8*ROWSZ,2*COLSZ+LMG,240,#0,#FF);
TEXTOUT_P(THREE,XX+LW,IP((2*DPRD+1)*ROWSZ)+LW,FONTSZ);
//AND CORNER BIGGER
RECT_P(LMG,2*8*ROWSZ+LW,2*COLSZ+LMG-LW,GROBH_P()-20);
TEXTOUT_P(ONE,LMG,2*8*ROWSZ+LW,3);
TEXTOUT_P(TWO,LMG,(2*9)*ROWSZ+LW,3);
END;
POS_ELE_BOX(EL)
BEGIN
LOCAL LGRP:=Z_ELEMENTS(EL,2);
LOCAL DGRP:=ABS(LGRP);
LOCAL APRD:=Z_ELEMENTS(EL,3);
LOCAL DPRD:=IFTE(LGRP<0,APRD+2,APRD);//8 AND 9 ARE 2 BELOW W AND 7
RETURN {DGRP,DPRD};
END;
DRWNAME(ST)
BEGIN
TEXTOUT_P(ST,3*COLSZ,3*ROWSZ,7);
END;
EXPORT Z_PERIODIC_TABLE()
BEGIN
RECT();
BOXED:=0;
DRW_ELE_BOX({0,0},"Software by StephenG1CMZ 2016. Any work?","");
FOR II FROM 1 TO NGRPS DO
DRW_ELE_BOX({II,0},"",II);
END;
FOR II FROM 1 TO NPRDS DO
DRW_ELE_BOX({0,II},"","P"+II);
END;
//THESE NAMES WONT BE SEEN WITHOUT ADDING A DELAY OR REPOSITIONING
DRW_ELE_BOX({4,8},"lanthanoids","");
DRW_ELE_BOX({4,9},"actinoids","");
ML:=0;PRINT();
//DIAGNOSTIC:LONGEST NAME FOR DISPLAY SIZING
//FOR II FROM 1 TO NELE DO
// ML:=MAX(ML,DIM(Z_ELEMENTNAMES(II,3)));
//END;
//PRINT("LONGESTNAME LENGTH:"+ML);
//TEXTOUT_P(Z_ELEMENTNAMES(104,3),0,220,FONTSZ);//13CH
DRW_ELE_BOX({3,7}," ⇊","");
BOXED:=1;
FOR EL FROM 1 TO NELE DO
//GETSYMBOL:LONGER NAMES LOSE THE "U" ON SMALL SCREEN
ELSYM:=Z_ELEMENTNAMES(EL,2);
//DRAW
DRW_ELE_BOX(POS_ELE_BOX(EL),EL,ELSYM);
END;
DRAWMENU(MNU);
REPEAT
MSNK();
KK:=WAIT(−1);
IF TYPE(KK)==0 AND 0 THEN //DIAGNOSTIC
MSGBOX({TYPE(KK)+","+KK});//WHAT KEY
END;
MSNK();
CASE
IF TYPE(KK)≠0 THEN
MSGBOX("PLEASE USE KEYPAD");
KK:=0;
END;
IF KK==1 THEN //SYMBOL
LSYM:={};
FOR EL FROM 1 TO NELE DO
LSYM:=CONCAT(LSYM,EL+" "+Z_ELEMENTNAMES(EL,2));
END;
ML:=CHOOSE(EL,"Symb",LSYM);
END;
IF KK==11 THEN //NUM
LSYM:={};
FOR EL FROM 1 TO NELE DO
LSYM:=CONCAT(LSYM,EL+" "+Z_ELEMENTNAMES(EL,2)+" "+Z_ELEMENTNAMES(EL,3))
END;
ML:=CHOOSE(EL,"Num",LSYM);
END;
DEFAULT
END;
IF KK==30 THEN //ENTER
ML:=INPUT(SY,"Enter element name or Symb");
IF ML THEN
FOR EL FROM 1 TO NELE DO
IF SY==Z_ELEMENTNAMES(EL,2) OR SY==Z_ELEMENTNAMES(EL,3) THEN
RECT_P(0,0,320,220);
DRW_ELE_BOX(POS_ELE_BOX(EL),EL,Z_ELEMENTNAMES(EL,2));
DRWNAME(Z_ELEMENTNAMES(EL,3));
WAIT;
END;
END;
END;
END;
IF ML THEN
RECT_P(0,0,320,220);
TEXTOUT_P("More: use keys:",0,0,FONTSZ);
TEXTOUT_P(MNU,320/4,0);
//BOXED:=0;
//TEXTOUT_P(Z_ELEMENTNAMES(EL,3),3*COLSZ,3*ROWSZ,7);
DRWNAME(Z_ELEMENTNAMES(EL,3));
//BOXED:=1;
DRW_ELE_BOX(POS_ELE_BOX(EL),EL,Z_ELEMENTNAMES(EL,2));
//ELSE
END;
UNTIL KK==4;//ESC
//PRINT();
//PRINT("BYE");
FREEZE;
END;
RE: Z Periodic Table - StephenG1CMZ - 04-25-2016 05:59 PM
A guide to the user interface:
The Menu presents 3 options...but these names are just there to act as a Help, to remind you of the available keypresses.
If you tap them you will see "Please use keypad"...
If you tap the screen you will see " please use keypad" (there is no touch interface to select an element).
You will probably need to press On and re-run the program.
Instead, tap the relevant key on the keypad:
Symb: gives a list of symbols (Eg Au)
Num: gives a list of atomic numbers (eg 12)
Enter: let's you search for either an element or its symbol.
Note that the search is case-sensitive
: symbols begin with an Upper case.
: elements are entirely lower case.
: exact matches only
So you can search for "gold" or "Au" but not "go"
Update: Remember - use the keypad, not the Drawmenu.
After you see the "use the keypad" message, the program does not always recover.
Restart the program.
There is much room for improvement...
RE: Z Periodic Table - StephenG1CMZ - 04-26-2016 07:13 AM
It has been reported by Salvomic that the line
"ML:=INPUT(SY," Enter...
does not appear to be working in FW 10077...
Thanks for that, Salvo.
So the program's Num and Symb options are available, but not the Enter option.
I only have the Android emulator here, so cannot yet confirm or look for a workaround myself.
Update: Salvo has confirmed this is new problem in 10077 and previously worked in 8151.
RE: Z Periodic Table - StephenG1CMZ - 04-27-2016 08:17 PM
Version 2 uses the new Input syntax and works on FW8151 FW10077 and Android.
Also fixed a bug with my For loop going 1 beyond the actual number of elements, and some user interface improvements.
Code:
LOCAL VERNUM:=2;
LOCAL PT:="Periodic Table. ";
LOCAL CRID:=PT+" StephenG1CMZ 2016. V"+VERNUM;
LOCAL NL:=CHAR(10);
LOCAL USEKEYPAD:=PT+NL+"USE KEYPAD, NOT MENU OR TOUCHSCREEN";
//PERIODIC TABLE 02
//FW8151 FW10077
//CHANGELOG:
//INPUT UPDATED FOR NEW FW
//BUG IN FOR LOOP FIXED
//CASE SYNTAX CORRECTED
LOCAL HLPTXT:=CRID+NL+"THANKS SALVOMIC AND TYANN";
//PERIODS
//LOCAL APERIODS:={1,3,11,19,37,55,87};
//ELEMENT DATA AND POSITION
//ATOM: 1..118 = LIST POS
//GROUP/COL: 1..18 OR NONE(<0:ARBITRARY FOR DISPLAY ONLY)
//PERIOD/ROW: 1..7
EXPORT Z_ELEMENTS:={
{ 1, 1, 1},
{ 2, 18, 1},
{ 3, 1, 2},
{ 4, 2, 2},
{ 5, 13, 2},
{ 6, 14, 2},
{ 7, 15, 2},
{ 8, 16, 2},
{ 9, 17, 2},
{ 10, 18, 2},
{ 11, 1, 3},
{ 12, 2, 3},
{ 13, 13, 3},
{ 14, 14, 3},
{ 15, 15, 3},
{ 16, 16, 3},
{ 17, 17, 3},
{ 18, 18, 3},
{ 19, 1, 4},
{ 20, 2, 4},
{ 21, 3, 4},
{ 22, 4, 4},
{ 23, 5, 4},
{ 24, 6, 4},
{ 25, 7, 4},
{ 26, 8, 4},
{ 27, 9, 4},
{ 28, 10, 4},
{ 29, 11, 4},
{ 30, 12, 4},
{ 31, 13, 4},
{ 32, 14, 4},
{ 33, 15, 4},
{ 34, 16, 4},
{ 35, 17, 4},
{ 36, 18, 4},
{ 37, 1, 5},
{ 38, 2, 5},
{ 39, 3, 5},
{ 40, 4, 5},
{ 41, 5, 5},
{ 42, 6, 5},
{ 43, 7, 5},
{ 44, 8, 5},
{ 45, 9, 5},
{ 46, 10, 5},
{ 47, 11, 5},
{ 48, 12, 5},
{ 49, 13, 5},
{ 50, 14, 5},
{ 51, 15, 5},
{ 52, 16, 5},
{ 53, 17, 5},
{ 54, 18, 5},
{ 55, 1, 6},
{ 56, 2, 6},
{ 57, −3, 6},
{ 58, −4, 6},
{ 59, −5, 6},
{ 60, −6, 6},
{ 61, −7, 6},
{ 62, −8, 6},
{ 63, −9, 6},
{ 64,−10, 6},
{ 65,−11, 6},
{ 66,−12, 6},
{ 67,−13, 6},
{ 68,−14, 6},
{ 69,−15, 6},
{ 70,−16, 6},
{ 71,−17, 6},
{ 72, 4, 6},
{ 73, 5, 6},
{ 74, 6, 6},
{ 75, 7, 6},
{ 76, 8, 6},
{ 77, 9, 6},
{ 78, 10, 6},
{ 79, 11, 6},
{ 80, 12, 6},
{ 81, 13, 6},
{ 82, 14, 6},
{ 83, 15, 6},
{ 84, 16, 6},
{ 85, 17, 6},
{ 86, 18, 6},
{ 87, 1, 7},
{ 88, 2, 7},
{ 89, −3, 7},
{ 90, −4, 7},
{ 91, −5, 7},
{ 92, −6, 7},
{ 93, −7, 7},
{ 94, −8, 7},
{ 95, −9, 7},
{ 96,−10, 7},
{ 97,−11, 7},
{ 98,−12, 7},
{ 99,−13, 7},
{100,−14, 7},
{101,−15, 7},
{102,−16, 7},
{103,−17, 7},
{104, 4, 7},
{105, 5, 7},
{106, 6, 7},
{107, 7, 7},
{108, 8, 7},
{109, 9, 7},
{110, 10, 7},
{111, 11, 7},
{112, 12, 7},
{113, 13, 7},
{114, 14, 7},
{115, 15, 7},
{116, 16, 7},
{117, 17, 7},
{118, 18, 7}
};
EXPORT Z_ELEMENTNAMES:={
{ 1,"H", "hydrogen"},
{ 2,"He", "helium"},
{ 3,"Li", "lithium"},
{ 4,"Be", "beryllium"},
{ 5,"B", "boron"},
{ 6,"C", "carbon"},
{ 7,"N", "nitrogen"},
{ 8,"O", "oxygen"},
{ 9,"F", "fluorine"},
{ 10,"Ne", "neon"},
{ 11,"Na", "sodium"},
{ 12,"Mg", "magnesium"},
{ 13,"Al", "aluminium"},
{ 14,"Si", "silicon"},
{ 15,"P", "phosphorus"},
{ 16,"S", "sulfur"},
{ 17,"Cl", "chlorine"},
{ 18,"Ar", "argon"},
{ 19,"K", "potassium"},
{ 20,"Ca", "calcium"},
{ 21,"Sc", "scandium"},
{ 22,"Ti", "titanium"},
{ 23,"V", "vanadium"},
{ 24,"Cr", "chromium"},
{ 25,"Mn", "manganese"},
{ 26,"Fe", "iron"},
{ 27,"Co", "cobalt"},
{ 28,"Ni", "nickel"},
{ 29,"Cu", "copper"},
{ 30,"Zn", "zinc"},
{ 31,"Ga", "gallium"},
{ 32,"Ge", "germanium"},
{ 33,"As", "arsenic"},
{ 34,"Se", "selenium"},
{ 35,"Br", "bromine"},
{ 36,"Kr", "krypton"},
{ 37,"Rb", "rubidium"},
{ 38,"Sr", "strontium"},
{ 39,"Y", "yttrium"},
{ 40,"Zr", "zirconium"},
{ 41,"Nb", "niobium"},
{ 42,"Mo", "molybdenum"},
{ 43,"Tc", "technetium"},
{ 44,"Ru", "ruthenium"},
{ 45,"Rh", "rhodium"},
{ 46,"Pd", "palladium"},
{ 47,"Ag", "silver"},
{ 48,"Cd", "cadmium"},
{ 49,"In", "indium"},
{ 50,"Sn", "tin"},
{ 51,"Sb", "antimony"},
{ 52,"Te", "tellurium"},
{ 53,"I", "iodine"},
{ 54,"Xe", "xenon"},
{ 55,"Cs", "caesium"},
{ 56,"Ba", "barium"},
{ 57,"La", "lanthanum"},
{ 58,"Ce", "cerium"},
{ 59,"Pr", "praseodymium"},
{ 60,"Nd", "neodymium"},
{ 61,"Pm", "promethium"},
{ 62,"Sm", "samarium"},
{ 63,"Eu", "europium"},
{ 64,"Gd", "gadolinium"},
{ 65,"Tb", "terbium"},
{ 66,"Dy", "dysprosium"},
{ 67,"Ho", "holmium"},
{ 68,"Er", "erbium"},
{ 69,"Tm", "thulium"},
{ 70,"Yb", "ytterbium"},
{ 71,"Lu", "lutetium"},
{ 72,"Hf", "hafnium"},
{ 73,"Ta", "tantalum"},
{ 74,"W", "tungsten"},
{ 75,"Re", "rhenium"},
{ 76,"Os", "osmium"},
{ 77,"Ir", "iridium"},
{ 78,"Pt", "platinum"},
{ 79,"Au", "gold"},
{ 80,"Hg", "mercury"},
{ 81,"Ti", "thallium"},
{ 82,"Pb", "lead"},
{ 83,"Bi", "bismuth"},
{ 84,"Po", "polonium"},
{ 85,"At", "astatine"},
{ 86,"Rn", "radon"},
{ 87,"Fr", "francium"},
{ 88,"Ra", "radium"},
{ 89,"Ac", "actinium"},
{ 90,"Th", "thorium"},
{ 91,"Pa", "protactinium"},
{ 92,"U", "uranium"},
{ 93,"Np", "neptunium"},
{ 94,"Pu", "plutonium"},
{ 95,"Am", "americium"},
{ 96,"Cm", "curium"},
{ 97,"Bk", "berkelium"},
{ 98,"Cf", "californium"},
{ 99,"Es", "einsteinium"},
{100,"Fm", "fermium"},
{101,"Md", "mendelevium"},
{102,"No", "nobelium"},
{103,"Lr", "lawrencium"},
{104,"Rf", "rutherfordium"},
{105,"Db", "dubnium"},
{106,"Sg", "seaborgium"},
{107,"Bh", "bohrium"},
{108,"Hs", "hassium"},
{109,"Mt", "meitnerium"},
{110,"Ds", "darmstadtium"},
{111,"Rg", "roentgenium"},
{112,"Cn", "copernicium"},
{113,"Uut","ununtrium"},
{114,"Fl", "flerovium"},
{115,"Uue","ununpentium"},
{116,"Lv", "livermorium"},
{117,"Uus","ununseptium"},
{118,"Uuo","ununoctium"}
};
LOCAL SHO_P:=0;
LOCAL NELE:=SIZE(Z_ELEMENTS);
LOCAL NGRPS:=18;//MAX(GROUPS)
LOCAL NPRDS:= 7;//MAX(PERIODS)
LOCAL NCOLS:=NGRPS+SHO_P;
LOCAL NROWS:=NPRDS+2+1;//2 EXTRA ROWS
LOCAL COLSZ:=IP(320/NCOLS);
LOCAL ROWSZ:=IP(220/NROWS/2);//2 LINES PER ROW
LOCAL FONTSZ:=1;//1..7 1..2
LOCAL MNU:={"Symb","Enter","Num","Help"};
LOCAL EL,ELSYM,APRD,DPRD,LGRP,DGRP;
LOCAL II,KK,ML;
LOCAL BOXED;
LOCAL LSYM,LELE;
LOCAL SY:="";
MSNK()
BEGIN
LOCAL SNK:=MOUSE();
END;
DRW_ELE_BOX(LPOS,ONE,TWO)
BEGIN
LOCAL LMG:=6;//
LOCAL LW:=1;//LINEWIDTH:KEEP TEXT OFF BOXLINE
LOCAL DGRP:=MAX(LPOS(1)-1,0);//TRY
LOCAL DPRD:=LPOS(2);
LOCAL XX:=IP(DGRP*COLSZ)+LMG;
LOCAL YY:=IP(2*DPRD*ROWSZ);
//OMIT U ON SMALL SCREENS)
LOCAL THREE:=IFTE(DIM(TWO)==3 AND GROBW_P()<640,MID(TWO,2),TWO);
IF BOXED THEN
RECT_P(XX,YY,XX+COLSZ,YY+2*ROWSZ,#0,#EEEEEE);//BLACK EDGE GREY FILL
END;
//LINES 1 AND 2
TEXTOUT_P(ONE,XX,YY+LW,FONTSZ);
//RECT_P(0,2*8*ROWSZ,2*COLSZ+LMG,240,#0,#FF);
TEXTOUT_P(THREE,XX+LW,IP((2*DPRD+1)*ROWSZ)+LW,FONTSZ);
//AND CORNER BIGGER
RECT_P(LMG,2*8*ROWSZ+LW,2*COLSZ+LMG-LW,GROBH_P()-20);
TEXTOUT_P(ONE,LMG,2*8*ROWSZ+LW,3);
TEXTOUT_P(TWO,LMG,(2*9)*ROWSZ+LW,3);
END;
POS_ELE_BOX(EL)
BEGIN
LOCAL LGRP:=Z_ELEMENTS(EL,2);
LOCAL DGRP:=ABS(LGRP);
LOCAL APRD:=Z_ELEMENTS(EL,3);
LOCAL DPRD:=IFTE(LGRP<0,APRD+2,APRD);//8 AND 9 ARE 2 BELOW W AND 7
RETURN {DGRP,DPRD};
END;
DRWNAME(ST)
BEGIN
TEXTOUT_P(ST,3*COLSZ,3*ROWSZ,7);
END;
HELP()
BEGIN
MSGBOX(HLPTXT);
END;
EXPORT Z_PERIODIC_TABLE_02()
BEGIN
RECT();
BOXED:=0;
DRW_ELE_BOX({0,0},CRID,"");
FOR II FROM 1 TO NGRPS DO
DRW_ELE_BOX({II,0},"",II);
END;
FOR II FROM 1 TO NPRDS DO
DRW_ELE_BOX({0,II},"","P"+II);
END;
//THESE NAMES WONT BE SEEN WITHOUT ADDING A DELAY OR REPOSITIONING
DRW_ELE_BOX({4,8},"lanthanoids","");
DRW_ELE_BOX({4,9},"actinoids","");
ML:=0;PRINT();
//DIAGNOSTIC:LONGEST NAME FOR DISPLAY SIZING
//FOR II FROM 1 TO NELE DO
// ML:=MAX(ML,DIM(Z_ELEMENTNAMES(II,3)));
//END;
//PRINT("LONGESTNAME LENGTH:"+ML);
//TEXTOUT_P(Z_ELEMENTNAMES(104,3),0,220,FONTSZ);//13CH
DRW_ELE_BOX({3,7}," ⇊","");
BOXED:=1;
FOR EL FROM 1 TO NELE DO
//GETSYMBOL:LONGER NAMES LOSE THE "U" ON SMALL SCREEN
ELSYM:=Z_ELEMENTNAMES(EL,2);
//DRAW
DRW_ELE_BOX(POS_ELE_BOX(EL),EL,ELSYM);
END;
DRAWMENU(MNU);
REPEAT
MSNK();
KK:=WAIT(−1);
IF TYPE(KK)==0 AND 0 THEN //DIAGNOSTIC
MSGBOX({TYPE(KK)+","+KK});//WHAT KEY
END;
MSNK();
CASE
IF TYPE(KK)≠0 THEN
MSGBOX(USEKEYPAD);
KK:=0;
END //IFCASE
IF KK==1 THEN //SYMBOL
LSYM:={};
FOR EL FROM 1 TO NELE DO
LSYM:=CONCAT(LSYM,EL+" "+Z_ELEMENTNAMES(EL,2));
END;
ML:=CHOOSE(EL,"Symb",LSYM);
END //IFCASE
IF KK==11 THEN //NUM
LSYM:={};
FOR EL FROM 1 TO NELE DO
LSYM:=CONCAT(LSYM,EL+" "+Z_ELEMENTNAMES(EL,2)+" "+Z_ELEMENTNAMES(EL,3))
END;
ML:=CHOOSE(EL,"Num",LSYM);
END //IFCASE
IF KK==30 THEN //ENTER
ML:=INPUT({{SY,[2]}},"Enter element name or Symb");//FW8151 AND FW10077
// THANKS TYANN AND SALVOMIC. 2==STRINGTYPE
//
IF ML THEN
EL:=1;
WHILE EL≤NELE AND SY≠Z_ELEMENTNAMES(EL,2) AND SY≠Z_ELEMENTNAMES(EL,3) DO
EL:=EL+1;
END;//WHILE
//RECT_P(0,0,320,220);
//DRW_ELE_BOX(POS_ELE_BOX(EL),EL,Z_ELEMENTNAMES(EL,2));
//DRWNAME(Z_ELEMENTNAMES(EL,3));
//WAIT;
//END;
END;//IF
END //IFCASE
IF KK==3 THEN
HELP();
END //CASE
DEFAULT
END;//CASE
IF ML THEN
RECT_P(0,0,320,220);
TEXTOUT_P("More: use keys:",0,0,FONTSZ);
TEXTOUT_P(MNU,320/4,0);
//BOXED:=0;
//TEXTOUT_P(Z_ELEMENTNAMES(EL,3),3*COLSZ,3*ROWSZ,7);
DRWNAME(Z_ELEMENTNAMES(EL,3));
//BOXED:=1;
DRW_ELE_BOX(POS_ELE_BOX(EL),EL,Z_ELEMENTNAMES(EL,2));
//ELSE
END;
UNTIL KK==4;//ESC
//PRINT();
//PRINT("BYE");
//NOTE:THE ALTERNATIVE OF SHOWING 3CHAR SYMBOLS BY
//BLITTING THE LOWERLEFT BOX IS MUCH LESS LEGIBLE THN
//OMITTING THE 1ST U
FREEZE;
END;
RE: Z Periodic Table - StephenG1CMZ - 05-02-2016 11:16 PM
Version 2.1 has been rewritten to use CHOOSE lists rather than keypad menus...
This seems both easier and the program a little more reliable.
The element names are in English, francais and Polskie, but menus have yet to be internationalised.
Code:
LOCAL VERNUM:=2.1;
LOCAL PT:={"Periodic Table V","Okresowy Pierwiastków V","Tableau Périodique V"};
LOCAL SL:=1;
LOCAL LANGS:={"English","Polskie","Français"};
//LOCAL CRID:=PT(SL)+VERNUM+" 2016 StephenG1CMZ ";
LOCAL CRID,PNAME;
LOCAL NL:=CHAR(10);
//LOCAL USEKEYPAD:=PT+NL+"USE KEYPAD, NOT MENU OR TOUCHSCREEN";
//PERIODIC TABLE 02
//FW8151 FW10077
LOCAL HLPTXT;
LOCAL STATNUM:={"Atomic Number","Liczbie atomowe","Les numéro atomique"};
LOCAL STPERIOD:=" P";
LOCAL STGROUP:={"Group","Grupa","Groupe"};
LOCAL STSYMBOL:={"Symbol","symbole","les symboles"};
//PERIODS
//LOCAL APERIODS:={1,3,11,19,37,55,87};
//ELEMENT DATA AND POSITION
//ATOM: 1..118 = LIST POS
//GROUP/COL: 1..18 OR NONE(<0:ARBITRARY FOR DISPLAY ONLY)
//PERIOD/ROW: 1..7
EXPORT Z_ELEMENTS:={
{ 1, 1, 1},
{ 2, 18, 1},
{ 3, 1, 2},
{ 4, 2, 2},
{ 5, 13, 2},
{ 6, 14, 2},
{ 7, 15, 2},
{ 8, 16, 2},
{ 9, 17, 2},
{ 10, 18, 2},
{ 11, 1, 3},
{ 12, 2, 3},
{ 13, 13, 3},
{ 14, 14, 3},
{ 15, 15, 3},
{ 16, 16, 3},
{ 17, 17, 3},
{ 18, 18, 3},
{ 19, 1, 4},
{ 20, 2, 4},
{ 21, 3, 4},
{ 22, 4, 4},
{ 23, 5, 4},
{ 24, 6, 4},
{ 25, 7, 4},
{ 26, 8, 4},
{ 27, 9, 4},
{ 28, 10, 4},
{ 29, 11, 4},
{ 30, 12, 4},
{ 31, 13, 4},
{ 32, 14, 4},
{ 33, 15, 4},
{ 34, 16, 4},
{ 35, 17, 4},
{ 36, 18, 4},
{ 37, 1, 5},
{ 38, 2, 5},
{ 39, 3, 5},
{ 40, 4, 5},
{ 41, 5, 5},
{ 42, 6, 5},
{ 43, 7, 5},
{ 44, 8, 5},
{ 45, 9, 5},
{ 46, 10, 5},
{ 47, 11, 5},
{ 48, 12, 5},
{ 49, 13, 5},
{ 50, 14, 5},
{ 51, 15, 5},
{ 52, 16, 5},
{ 53, 17, 5},
{ 54, 18, 5},
{ 55, 1, 6},
{ 56, 2, 6},
{ 57, −3, 6},
{ 58, −4, 6},
{ 59, −5, 6},
{ 60, −6, 6},
{ 61, −7, 6},
{ 62, −8, 6},
{ 63, −9, 6},
{ 64,−10, 6},
{ 65,−11, 6},
{ 66,−12, 6},
{ 67,−13, 6},
{ 68,−14, 6},
{ 69,−15, 6},
{ 70,−16, 6},
{ 71,−17, 6},
{ 72, 4, 6},
{ 73, 5, 6},
{ 74, 6, 6},
{ 75, 7, 6},
{ 76, 8, 6},
{ 77, 9, 6},
{ 78, 10, 6},
{ 79, 11, 6},
{ 80, 12, 6},
{ 81, 13, 6},
{ 82, 14, 6},
{ 83, 15, 6},
{ 84, 16, 6},
{ 85, 17, 6},
{ 86, 18, 6},
{ 87, 1, 7},
{ 88, 2, 7},
{ 89, −3, 7},
{ 90, −4, 7},
{ 91, −5, 7},
{ 92, −6, 7},
{ 93, −7, 7},
{ 94, −8, 7},
{ 95, −9, 7},
{ 96,−10, 7},
{ 97,−11, 7},
{ 98,−12, 7},
{ 99,−13, 7},
{100,−14, 7},
{101,−15, 7},
{102,−16, 7},
{103,−17, 7},
{104, 4, 7},
{105, 5, 7},
{106, 6, 7},
{107, 7, 7},
{108, 8, 7},
{109, 9, 7},
{110, 10, 7},
{111, 11, 7},
{112, 12, 7},
{113, 13, 7},
{114, 14, 7},
{115, 15, 7},
{116, 16, 7},
{117, 17, 7},
{118, 18, 7},
{119, 3, 3}
};
EXPORT Z_ELEMENTNAMES:={
{ 1,"H", "hydrogen","wodór","hydrogène"},
{ 2,"He", "helium","hel","hélium"},
{ 3,"Li", "lithium","lit","lithium"},
{ 4,"Be", "beryllium","beryl","béryllium"},
{ 5,"B", "boron","bor","boron"},
{ 6,"C", "carbon","węgiel","carbone"},
{ 7,"N", "nitrogen","azot","azote"},
{ 8,"O", "oxygen","tlen","oxygène"},
{ 9,"F", "fluorine","fluor","fluor"},
{ 10,"Ne", "neon","neon","néon"},
{ 11,"Na", "sodium","sód","sodium"},
{ 12,"Mg", "magnesium","magnez","magnésium"},
{ 13,"Al", "aluminium","glin","aluminium"},
{ 14,"Si", "silicon","krzem","silicium"},
{ 15,"P", "phosphorus","fosfor","phosphore"},
{ 16,"S", "sulfur","siarka","soufre"},
{ 17,"Cl", "chlorine","chlore","chlore"},
{ 18,"Ar", "argon","argon","argon"},
{ 19,"K", "potassium","potas","potassium"},
{ 20,"Ca", "calcium","wapń","calcium"},
{ 21,"Sc", "scandium","skand","scandium"},
{ 22,"Ti", "titanium","tytan","titane"},
{ 23,"V", "vanadium","wanad","vanadium"},
{ 24,"Cr", "chromium","chrom","chrome"},
{ 25,"Mn", "manganese","mangan","manganèse"},
{ 26,"Fe", "iron","zelazo","fer"},
{ 27,"Co", "cobalt","kobalt","cobalt"},
{ 28,"Ni", "nickel","nikiel","nickel"},
{ 29,"Cu", "copper","miedź","cuivre"},
{ 30,"Zn", "zinc","cynk","zinc"},
{ 31,"Ga", "gallium","gal","gallium"},
{ 32,"Ge", "germanium","german","germanium"},
{ 33,"As", "arsenic","arsen","arsenic"},
{ 34,"Se", "selenium","selen","sélénium"},
{ 35,"Br", "bromine","brom","brome"},
{ 36,"Kr", "krypton","krypton","krypton"},
{ 37,"Rb", "rubidium","rubid","rubidium"},
{ 38,"Sr", "strontium","stront","strontium"},
{ 39,"Y", "yttrium","itr","yttrium"},
{ 40,"Zr", "zirconium","cyrkon","zirconium"},
{ 41,"Nb", "niobium","niob","niobium"},
{ 42,"Mo", "molybdenum","molibden","molybd=ne"},
{ 43,"Tc", "technetium","technet","technétium"},
{ 44,"Ru", "ruthenium","ruten","ruthénium"},
{ 45,"Rh", "rhodium","rod","rhodium"},
{ 46,"Pd", "palladium","pallad","palladium"},
{ 47,"Ag", "silver","srebro","argent"},
{ 48,"Cd", "cadmium","kadm","cadmium"},
{ 49,"In", "indium","ind","indium"},
{ 50,"Sn", "tin","cyna","étain"},
{ 51,"Sb", "antimony","antymon","antimoine"},
{ 52,"Te", "tellurium","tellur","tellure"},
{ 53,"I", "iodine","jod","iode"},
{ 54,"Xe", "xenon","ksenon","xénon"},
{ 55,"Cs", "caesium","cez","césium"},
{ 56,"Ba", "barium","bar","baryum"},
{ 57,"La", "lanthanum","lantan","lanthane"},
{ 58,"Ce", "cerium","cer","cérium"},
{ 59,"Pr", "praseodymium","prazeodym","praséodyne"},
{ 60,"Nd", "neodymium","neodym","néodyme"},
{ 61,"Pm", "promethium","promet","prométhium"},
{ 62,"Sm", "samarium","samar","samarium"},
{ 63,"Eu", "europium","europ","europium"},
{ 64,"Gd", "gadolinium","gadolin","gadolinium"},
{ 65,"Tb", "terbium","terb","terbium"},
{ 66,"Dy", "dysprosium","dyspoz","dysprosium"},
{ 67,"Ho", "holmium","holm","holmium"},
{ 68,"Er", "erbium","erb","erbium"},
{ 69,"Tm", "thulium","tul","thulium"},
{ 70,"Yb", "ytterbium","iterb","ytterbium"},
{ 71,"Lu", "lutetium","lutet","lutécium"},
{ 72,"Hf", "hafnium","hafn","hafnium"},
{ 73,"Ta", "tantalum","tantal","tantale"},
{ 74,"W", "tungsten","wolfram","tungstène"},
{ 75,"Re", "rhenium","ren","rhénium"},
{ 76,"Os", "osmium","osm","osmium"},
{ 77,"Ir", "iridium","iryd","iridium"},
{ 78,"Pt", "platinum","platyna","platine"},
{ 79,"Au", "gold","zloto","or"},
{ 80,"Hg", "mercury","rtęć","mercure"},
{ 81,"Ti", "thallium","tal","thallium"},
{ 82,"Pb", "lead","ołów","plomb"},
{ 83,"Bi", "bismuth","bizmut","bismuth"},
{ 84,"Po", "polonium","polon","polonium"},
{ 85,"At", "astatine","astat","astate"},
{ 86,"Rn", "radon","radon","radon"},
{ 87,"Fr", "francium","frans","francium"},
{ 88,"Ra", "radium","rad","radium"},
{ 89,"Ac", "actinium","aktyn","actinium"},
{ 90,"Th", "thorium","tor","thorium"},
{ 91,"Pa", "protactinium","proaktyn","protactinium"},
{ 92,"U", "uranium","uran","uranium"},
{ 93,"Np", "neptunium","neptun","neptunium"},
{ 94,"Pu", "plutonium","pluton","plutonium"},
{ 95,"Am", "americium","ameryk","américum"},
{ 96,"Cm", "curium","kiur","curium"},
{ 97,"Bk", "berkelium","bekerel","berkélium"},
{ 98,"Cf", "californium","kaliforn","californium"},
{ 99,"Es", "einsteinium","einstein","einsteinium"},
{100,"Fm", "fermium","ferm","fermium"},
{101,"Md", "mendelevium","mendelew","mendélévium"},
{102,"No", "nobelium","nobel","nobelium"},
{103,"Lr", "lawrencium","lorens","lawrencium"},
{104,"Rf", "rutherfordium","rutherford","rutherforium"},
{105,"Db", "dubnium","dubn","dubnium"},
{106,"Sg", "seaborgium","seaborg","seaborgium"},
{107,"Bh", "bohrium","bohr","bohrium"},
{108,"Hs", "hassium","has","hassium"},
{109,"Mt", "meitnerium","meitner","meitnérium"},
{110,"Ds", "darmstadtium","darmsztadt","darmstadtium"},
{111,"Rg", "roentgenium","roentgen","roentgenium"},
{112,"Cn", "copernicium","kopernik","copernicium"},
{113,"Uut","ununtrium","ununtrium","ununtrium"},
{114,"Fl", "flerovium","flerovium","flerovium"},
{115,"Uue","ununpentium","ununpentium","ununpentium"},
{116,"Lv", "livermorium","livermorium","livermorium"},
{117,"Uus","ununseptium","ununseptium","ununseptium"},
{118,"Uuo","ununoctium","ununoctium","ununoctium"},
{119,"**", "NOT FOUND","nie znaleziono","PAS TROUVÉ"}
};
LOCAL OFFSETL:=2;
LOCAL SHO_P:=0;
LOCAL NELE:=SIZE(Z_ELEMENTS)-1;
LOCAL NGRPS:=18;//MAX(GROUPS)
LOCAL NPRDS:= 7;//MAX(PERIODS)
LOCAL NCOLS:=NGRPS+SHO_P;
LOCAL NROWS:=NPRDS+2+1;//2 EXTRA ROWS
LOCAL COLSZ:=IP(320/NCOLS);
LOCAL ROWSZ:=IP(220/NROWS/2);//2 LINES PER ROW
LOCAL FONTSZ:=1;//1..7 1..2
LOCAL MNUTXT,MNUACT;
LOCAL EL,ELSYM,APRD,DPRD,LGRP,DGRP;
LOCAL II,KK,ML,LOC;
LOCAL BOXED;
LOCAL LSYM,LELE;
LOCAL SY:="";
LOCAL CHS;
MSNK()
BEGIN
LOCAL SNK:=MOUSE();
END;//NOT IN USE
DRW_ELE_BOX(LPOS,ONE,TWO)
BEGIN
LOCAL LMG:=6;//
LOCAL LW:=1;//LINEWIDTH:KEEP TEXT OFF BOXLINE
LOCAL DGRP:=MAX(LPOS(1)-1,0);//TRY
LOCAL DPRD:=LPOS(2);
LOCAL XX:=IP(DGRP*COLSZ)+LMG;
LOCAL YY:=IP(2*DPRD*ROWSZ);
//OMIT U ON SMALL SCREENS)
LOCAL THREE:=IFTE(DIM(TWO)==3 AND GROBW_P()<640,MID(TWO,2),TWO);
IF BOXED THEN
RECT_P(XX,YY,XX+COLSZ,YY+2*ROWSZ,#0,#EEEEEE);//BLACK EDGE GREY FILL
END;
//LINES 1 AND 2
TEXTOUT_P(ONE,XX,YY+LW,FONTSZ);
//RECT_P(0,2*8*ROWSZ,2*COLSZ+LMG,240,#0,#FF);
TEXTOUT_P(THREE,XX+LW,IP((2*DPRD+1)*ROWSZ)+LW,FONTSZ);
//AND CORNER BIGGER
RECT_P(LMG,2*8*ROWSZ+LW,2*COLSZ+LMG-LW,GROBH_P()-20);
TEXTOUT_P(ONE,LMG,2*8*ROWSZ+LW,3);
TEXTOUT_P(TWO,LMG,(2*9)*ROWSZ+LW,3);///THIS
END;
POS_ELE_BOX(EL)
BEGIN
LOCAL LGRP:=Z_ELEMENTS(EL,2);
LOCAL DGRP:=ABS(LGRP);
LOCAL APRD:=Z_ELEMENTS(EL,3);
LOCAL DPRD:=IFTE(LGRP<0,APRD+2,APRD);//8 AND 9 ARE 2 BELOW W AND 7
RETURN {DGRP,DPRD};
END;
DRWNAME(ST)
BEGIN
TEXTOUT_P(ST,2*COLSZ,2*ROWSZ,7);
END;
DrawPeriodicTable()
BEGIN
RECT();
BOXED:=0;
TEXTOUT_P(PNAME+CRID,5,2,FONTSZ);//DRW_ELE_BOX({0,0},CRID,"");
FOR II FROM 1 TO NGRPS DO
DRW_ELE_BOX({II,0},"",II);
END;
FOR II FROM 1 TO NPRDS DO
DRW_ELE_BOX({0,II},"","P"+II);
END;
//THESE NAMES WONT BE SEEN WITHOUT ADDING A DELAY OR REPOSITIONING
DRW_ELE_BOX({4,8},"lanthanoids","");
DRW_ELE_BOX({4,9},"actinoids","");
ML:=0;PRINT();
DRW_ELE_BOX({3,7}," ⇊","");
BOXED:=1;
FOR EL FROM 1 TO NELE DO
//GETSYMBOL:LONGER NAMES LOSE THE "U" ON SMALL SCREEN
ELSYM:=Z_ELEMENTNAMES(EL,2);
//DRAW
DRW_ELE_BOX(POS_ELE_BOX(EL),EL,ELSYM);
END;
END;
DRAW_AN_ELE()
BEGIN
//IF ML THEN
RECT_P(0,0,320,220);
//IF ML THEN
//TEXTOUT_P("More: use keys:",0,0,FONTSZ);
//TEXTOUT_P(MNU,320/4,0);
IF ML THEN
//BOXED:=0;
//TEXTOUT_P(Z_ELEMENTNAMES(EL,3),3*COLSZ,3*ROWSZ,7);
//BOXED:=1;
LOC:="";
IF EL≤NELE THEN //IF FOUND
LOC:=STPERIOD+Z_ELEMENTS(EL,3);
LOC:=IFTE(Z_ELEMENTS(EL,2)>0,STGROUP(SL)+Z_ELEMENTS(EL,2)+","+LOC,LOC);
LOC:="("+LOC+")";
DRW_ELE_BOX(POS_ELE_BOX(EL),EL,Z_ELEMENTNAMES(EL,2));
END;
DRWNAME(Z_ELEMENTNAMES(EL,OFFSETL+SL)+LOC);
ELSE
DRWNAME(Z_ELEMENTNAMES(NELE+1,OFFSETL+SL));
END;
END;
ENTER_ELE_SYM()
BEGIN
ML:=INPUT({{SY,[2]}},"Enter element name or Symbol");//FW8151 AND FW10077
// THANKS TYANN AND SALVOMIC. 2==STRINGTYPE
//
IF ML THEN
EL:=1;
WHILE EL≤NELE AND SY≠Z_ELEMENTNAMES(EL,2) AND SY≠Z_ELEMENTNAMES(EL,OFFSETL+SL) DO
EL:=EL+1;
END;//WHILE
//RECT_P(0,0,320,220);
//DRW_ELE_BOX(POS_ELE_BOX(EL),EL,Z_ELEMENTNAMES(EL,2));
//DRWNAME(Z_ELEMENTNAMES(EL,3));
//WAIT;
//END;
DRAW_AN_ELE();
END;//IF
END;
ListSymbols()
BEGIN
LSYM:={};
FOR EL FROM 1 TO NELE DO
LSYM:=CONCAT(LSYM,EL+" "+Z_ELEMENTNAMES(EL,2));
END;
EL:=1;
ML:=CHOOSE(EL,STSYMBOL(SL),LSYM);
DRAW_AN_ELE();
END;
ListAtomicNumbers()
BEGIN
LSYM:={};
FOR EL FROM 1 TO NELE DO
LSYM:=CONCAT(LSYM,EL+" "+Z_ELEMENTNAMES(EL,2)+" "+Z_ELEMENTNAMES(EL,OFFSETL+SL));
END;
EL:=1;
ML:=CHOOSE(EL,STATNUM(SL),LSYM);
DRAW_AN_ELE();
END;
LITTLE()
BEGIN
//PRINT();
//DIAGNOSTIC:LONGEST NAME FOR DISPLAY SIZING
ML:=0;
FOR II FROM 1 TO NELE DO
ML:=MAX(ML,DIM(Z_ELEMENTNAMES(II,2+SL)));
END;
MSGBOX("LONGEST NAME LENGTH:"+ML);
FOR II FROM 1 TO NELE DO
IF ML==SIZE(Z_ELEMENTNAMES(II,2+SL)) THEN
//PRINT(Z_ELEMENTNAMES(II,2+SL));
EL:=II;
DRAW_AN_ELE();
END;
END;
//TEXTOUT_P(Z_ELEMENTNAMES(104,3),0,220,FONTSZ);//13CH
WAIT;
END;
TITLES()
BEGIN
PNAME:=PT(SL)+VERNUM;
CRID:=" 2016 StephenG1CMZ";
HLPTXT:=PNAME+NL+CRID+NL+"THANKS SALVOMIC AND TYANN";
END;
Lang()
BEGIN
ML:=CHOOSE(SL,STRING(LANGS),LANGS);
IF ML THEN
MSGBOX(LANGS(SL));
END;
END;
INTRO()
BEGIN
DrawPeriodicTable();
//TEXTOUT_P("ANY",0,320-20,2);
WAIT;
END;
CHOOSER()
BEGIN
LOCAL TTL;
LOCAL MNU:={"HELP()","DrawPeriodicTable()","ENTER_ELE_SYM()","ListAtomicNumbers()","ListSymbols()","LITTLE()","Lang()"};
LOCAL MNUACT:=MNU;
LOCAL MNUTXT:=MNU;
REPEAT
TITLES();
TTL:=PNAME;
ML:=CHOOSE(CHS,TTL,MNUTXT);
IF ML THEN
EXPR(MNUACT(CHS));
WAIT;
END;
UNTIL ML==0;
END;
HELP()
BEGIN
MSGBOX(HLPTXT);
END;
EXPORT Z_PERIODIC_TABLE02_1()
BEGIN
TITLES();
INTRO();
CHOOSER();
//DRAWMENU(MNU);
//PRINT("BYE");
//NOTE:THE ALTERNATIVE OF SHOWING 3CHAR SYMBOLS BY
//BLITTING THE LOWERLEFT BOX IS MUCH LESS LEGIBLE THN
//OMITTING THE 1ST U
FREEZE;
// TBD
// LIST BY ELEMENT NAME
// LIST SEARCH IN ANY LANG NOT 1BY1
// PARTIAL MATCHES
END;
|