hschumann2/TempleOS-Source-Code
0847
1 2/*$DA is the data widget.3 -TRM flag is for var4 width fields with a terminator5 character.6 +RD refreshes the data.7 +UD updates the val when you edit it.8 9 -P Means it is a string var, basically.10 11 ,32 sets the tag string width.12 See Data Tag Width.13 14 ,RT=I16 means the val is 2 bytes.15 See DocDataFmt() and DocDataScan().16*/17 18I16 i=0;19U8 buf[8];20 21U0 UpdateGlblTask(I64)22{23 while (TRUE) {24 i++;25 Sleep(1);26 }27}28 29U0 DataDemo()30{31 CDocEntry *doc_e;32 33 //This is the command line document.34 CDoc *doc=DocPut;35 36 //We do this to prevent access to37 //doc_e->data before it is set.38 Bool unlock=DocLock(doc);39 40 //You might set the DOCF_FORM flag.41 // doc->flags|=DOCF_FORM42 //if you wish.43 44 Spawn(&UpdateGlblTask,NULL,"Update Glbl",,Fs);45 46 "Enter editor overstrike mode\n"47 "and you can modify the val.\n"48 "However, changes happen immediately,\n"49 "so it's tricky.\n\n";50//Use <CTRL-l> for the $DA...$ format.51 doc_e=DocPrint(doc,"$DA-TRM+RD+UD,RT=I16,A=\"%%7d\"$\n");52 doc_e->data=&i;53 54 StrCpy(buf,"Terry");55 doc_e=DocPrint(doc,"$DA-P+RD+UD,LEN=7,A=\"Str:%%s\"$\n");56 doc_e->data=buf;57 58 if (unlock)59 DocUnlock(doc);60}61 62DataDemo;63 64//See PopUpExtents().65 