templeos-info/public/Wb/Demo/DolDoc/Form.HC.HTML

83 lines
6.8 KiB
Plaintext
Raw Normal View History

2024-03-24 21:24:44 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF1>class</span><span class=cF0> FDStruct
<a name="l2"></a>{</span><span class=cF2>//Use &lt;CTRL-l&gt; and sel &quot;Data&quot;, &quot;List&quot; or &quot;Check Box&quot;</span><span class=cF0>
<a name="l3"></a></span><span class=cF2>//to generate the formats.</span><span class=cF0>
<a name="l4"></a> </span><span class=cF1>F64</span><span class=cF0> num1 format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Float 1:%12.8f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l5"></a> </span><span class=cF1>F64</span><span class=cF0> num2 format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Float 2:%12e\&quot;$\n&quot;</span><span class=cF0>;
<a name="l6"></a> </span><span class=cF9>I64</span><span class=cF0> num3 format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Int 1:0x%016X\&quot;$\n&quot;</span><span class=cF0>;
<a name="l7"></a> </span><span class=cF9>I64</span><span class=cF0> num4 format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Int 2:%12d\&quot;$\n&quot;</span><span class=cF0>;
<a name="l8"></a> </span><span class=cF9>I64</span><span class=cF0> type format </span><span class=cF6>&quot;$LS,D=\&quot;ST_PERSON_TYPE\&quot;$\n&quot;</span><span class=cF0>;
<a name="l9"></a> </span><span class=cF1>U8</span><span class=cF0> name[32] format </span><span class=cF6>&quot;$DA-P,A=\&quot;Name :%s\&quot;$\n&quot;</span><span class=cF0>;
<a name="l10"></a> </span><span class=cF1>U8</span><span class=cF0> *address1 format </span><span class=cF6>&quot;$DA+M,A=\&quot;Address:%s\&quot;$\n&quot;</span><span class=cF0>; </span><span class=cF2>//+M is unlimited len U8 *.</span><span class=cF0>
<a name="l11"></a> </span><span class=cF1>U8</span><span class=cF0> *address2 format </span><span class=cF6>&quot;$DA+M,A=\&quot;Address:%s\&quot;$\n&quot;</span><span class=cF0>; </span><span class=cF2>//+M is unlimited len U8 *.</span><span class=cF0>
<a name="l12"></a> </span><span class=cF9>CDate</span><span class=cF0> datetime format </span><span class=cF6>&quot;$DA-TRM,A=\&quot;Date :%8D\&quot;$\n&quot;</span><span class=cF0>;
<a name="l13"></a> </span><span class=cF1>Bool</span><span class=cF0> check format </span><span class=cF6>&quot;$CB,\&quot;Check\&quot;$\n&quot;</span><span class=cF0>;
<a name="l14"></a>};
<a name="l15"></a>
<a name="l16"></a></span><span class=cF1>U0</span><span class=cF0> FormDemo()
<a name="l17"></a>{
<a name="l18"></a> FDStruct fds;
<a name="l19"></a> </span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_PERSON_TYPE&quot;</span><span class=cF0>,</span><span class=cF6>&quot;Child\0Teen\0Adult\0&quot;</span><span class=cF0>);
<a name="l20"></a> fds.num1=12.3e-4; </span><span class=cF2>//Set defaults</span><span class=cF0>
<a name="l21"></a> fds.num2=4.5e3;
<a name="l22"></a> fds.num3=0x1234;
<a name="l23"></a> fds.num4=-567;
<a name="l24"></a> fds.type=1;
<a name="l25"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(&amp;fds.name,</span><span class=cF6>&quot;John&quot;</span><span class=cF0>);
<a name="l26"></a> fds.address1=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>&quot;1234 Pine St.&quot;</span><span class=cF0>);
<a name="l27"></a> fds.address2=</span><span class=cF3>NULL</span><span class=cF0>; </span><span class=cF2>//Init to NULL if empty.</span><span class=cF0>
<a name="l28"></a> fds.datetime=</span><span class=cF5>Now</span><span class=cF0>;
<a name="l29"></a> fds.check=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DocForm</span><span class=cF7>(</span><span class=cF0>&amp;fds</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l31"></a> </span><span class=cF6>&quot;#1\t=%e\n&quot;</span><span class=cF0>,fds.num1;
<a name="l32"></a> </span><span class=cF6>&quot;#2\t=%e\n&quot;</span><span class=cF0>,fds.num2;
<a name="l33"></a> </span><span class=cF6>&quot;#3\t=%d\n&quot;</span><span class=cF0>,fds.num3;
<a name="l34"></a> </span><span class=cF6>&quot;#4\t=%d\n&quot;</span><span class=cF0>,fds.num4;
<a name="l35"></a> </span><span class=cF6>&quot;Type\t=%s\n&quot;</span><span class=cF0>,</span><span class=cF5>DefineSub</span><span class=cF0>(fds.type,</span><span class=cF6>&quot;ST_PERSON_TYPE&quot;</span><span class=cF0>);
<a name="l36"></a> </span><span class=cF6>&quot;Name\t=%s\n&quot;</span><span class=cF0>,fds.name;
<a name="l37"></a> </span><span class=cF6>&quot;Address1=%s\n&quot;</span><span class=cF0>,fds.address1;
<a name="l38"></a> </span><span class=cF6>&quot;Address2=%s\n&quot;</span><span class=cF0>,fds.address2;
<a name="l39"></a> </span><span class=cF6>&quot;Date\t=%D\n&quot;</span><span class=cF0>,fds.datetime;
<a name="l40"></a> </span><span class=cF6>&quot;Check\t=%d\n&quot;</span><span class=cF0>,fds.check;
<a name="l41"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l42"></a> </span><span class=cF6>&quot;Cancel\n&quot;</span><span class=cF0>;
<a name="l43"></a>
<a name="l44"></a> </span><span class=cF6>&quot;\n\nClassRep Example\n&quot;</span><span class=cF0>;
<a name="l45"></a> </span><span class=cF5>ClassRep</span><span class=cF0>(&amp;fds);
<a name="l46"></a> </span><span class=cF5>Free</span><span class=cF0>(fds.address1);
<a name="l47"></a> </span><span class=cF5>Free</span><span class=cF0>(fds.address2);
<a name="l48"></a> </span><span class=cF2>//See also </span><a href="/Wb/Adam/ADbg.HC.HTML#l183"><span class=cF4>ClassRepD</span></a><span class=cF2>().</span><span class=cF0>
<a name="l49"></a>}
<a name="l50"></a>
<a name="l51"></a>FormDemo;
</span></pre></body>
</html>