program XTX1,1.0(117) ! test/demo AUI_TEXTEDIT !-------------------------------------------------------------------- ! XTX1.BAS ! ! Demonstrate/test AUI_TEXTEDIT text editing control !-------------------------------------------------------------------- !EDIT HISTORY ![100] February 14, 2006 04:02 PM Edited by Jack ! Created ![101] February 28, 2006 04:02 PM Edited by Jack ! Add TXF_TAB to default flags; fix buf in ...CHUNKS: ! routine in which it duplicated the first 1000 bytes; ![102] March 1, 2006 02:02 PM Edited by Jack ! Add a help message for wrapwidth; TXF_POSCUR, help button ! for txc'xrow; change the 'view' icon to 'edit' for ! popping up dialogs to edit flags; enable search, add ! txc'sflags (requires updated xtext.map, ashell.def); ! fix txc'toolbarmask xtree display (was showing values ! instead of symbol names) ![103] March 3, 2006 01:55 PM ! XTREE dialogs were updating flags even when cancelled; ! change txc'fmapctl and txc'fmapapp to hex fields ![104] March 29, 2006 05:55 PM Edited by joaquin ! Fix txc'protrows wasn't allowing negatives; change message ! on return from XTEXT to recognize EXITCODE 1 & 10 as aborts. ![105] April 03, 2006 09:16 AM Edited by joaquin ! Set the &h02000000 flags (TFLAG_SHOW_BREAKS) bit in the ! txc'flags1 field to show page breaks even in read-only mode; ! set &h00000200 (TFLAG2_VERT_THUMB_TRACK) in txc'flags2 for ! smooth vertical scroll; ! chg TXF_CTRLC to TXF_NOCLICKOUT; if TXF_POPUP option, ! specify popup coordinates in raw pixels (1,1-400,600); ! save/restore all fields on exit/start of program /jdm ![106] April 04, 2006 03:49 PM Edited by joaquin ! Add TXF_DLGNOCREEP; adjust exitcode msg to not suggest that ! text was output if EXITCODE # 0; txc'flagmask logic updated ![107] July 26, 2006 11:51 AM Edited by joaquin ! Add TXC_TIMEOUT ![108] August 06, 2006 05:44 PM Edited by joaquin ! Convert all PRINT statements (previously going to the main ! window as a sort of debug window, to DEBUG.PRINT !{Edit History} ! 08-05-2008 --- 117 --- Jack McGregor ! New fields added ! 07-05-2008 --- 116 --- Jack McGregor ! Start adding HTML stuff ! 28-04-2008 --- 115 --- Jack McGregor ! Add TXF_MENU, allow -1 in ctlno field ! 21-12-2007 --- 114 --- Jack McGregor ! Set AUXDATA param in all cases now. (Tests 998.7 enhancement to show it on the popup save confirmation dialog) ! ! 01-09-2007 --- 113 --- Jack McGregor ! Minor cosmetic fixes ! ! 13-03-2007 --- 112 --- Jack McGregor ! Add option to scale dialog by adjusting dialog grid ! ! 20-02-2007 --- 111 --- Jack McGregor ! Add animation option ! ! 28-12-2006 --- 110 --- Jack McGregor ! Assign control names to INFLD and GB controls (using new INFLD V support in 977-6+) ! Also assign name to XTEXT control (requires updated XTEXT.MAP) ! ! 15-11-2006 --- 109 --- Jack McGregor ! Change label style back to regular static (remove MBF_FRAME) ! !-------------------------------------------------------------------- !NOTES ! This program allows you to experiment with most of the XTEXT ! parameters, to see how XTREE responds. This is very handy at ! one level, but suffers from the fact that 95% of the code in this ! program is all user-interface oriented and not necessarily relevant ! to XTEXT itself. If you just want to see the source code which ! sets up the parameters and calls XTEXT, see DO'XTEXT: ! ! Aside from XTEXT, this program may also be of interest as an ! example of one model of "standard GUI" programming, which involves ! the following routines/techniques/concepts: ! ! 1. Parameterized field definitions (loaded here from DATA statements) ! 2. EVENTWAIT to manage focus, flow of control ! 3. INFLD (edit, combo, multi-line mode edit) ! 4. XTREE (with editable checkboxes to display/edit bit-oriented flags) ! 5. Buttons with icons on them ! 6. Pop-up dialogs ! 7. MSGBOX and EVTMSG (for displaying messages) ! !PROGRAM DESIGN NOTES: ! ! The general idea here is to group all of the field information into ! a series of arrays and structures, which is operated on by fairly ! standardized logic. The main arrays and structures are: ! ! INFLD'ARRAY() - an element for every INFLD field; data includes most ! of the params neede for INFLD, and even including the standard ! field prompt, but does not include row/col position. ! ! GENCTL'ARRAY() - same idea as INFLD'ARRAY but for other control types ! (mainly buttons in this program); fields are mainly the params to ! xcall AUI,AUI_CONTROL. ! ! The above arrays are intended to span multiple dialogs if necessary ! (i.e. one each per program). Each field (or control) has a string ! ID (name) which can be used to reference the field without knowing ! its position, although we also use direct cross-referencing between ! arrays using the numeric index. ! ! Remaining arrays/structures are dialog-specific and have xxxxxx' prefixes ! where xxxxxx is the name of the form or dialog to avoid naming conflicts ! when multiple dialogs are added to the the program. ! ! Here, the main dialog is called "xtdlg", so we have many ! xtdlg'xxxx structures: ! ! xtdlg'GROUPBOXES() - Groupbox definitions for xtdlg ! ! xtdlg'CX'ARRAY() - Main control array for xtdlg. This references the ! existing INFLD'ARRAY() and GENCTL'ARRAY() fields and mainly serves ! to establish position and order for all the fields in a dialog that ! the user may want to move around. ! ! xtdlg'PARAMS - Misc non-array params for the xtdlg dialog ! !EVENTWAIT/FLOW OF CONTROL NOTES: ! The routine that loads the field data establishes sequential EXITCODE ! values, and we rely primarily on these in EVENTWAIT (with EVW_EXCDFOCUS ! and EVW_EXCDINOUT flags). We can translate from the EXITCODE returned ! from EVENTWAIT into the field number (cx) and from there we can call ! the "field-level" routine for each field. The "field-level" routines ! are mainly responsible for binding the field variables (in this case, ! T'xxxxx and TXC'xxxxxx) to and from INF'ENTRY for editing and display. ! Any special customization logic can also be added directly to these ! routines. The field-level routines are not meant to know their position ! relative to others; if they want to jump to another field, or cause ! other fields to be output or edited, they can do so by field ID (name). ! For an example of that, see xtdlg'DOCFMT'SRC (which may cause the ! T'SRC parameter/field to change from a standard edit to a multiline edit ! and also change its prompt.) Or xtdlg'BTN'TFLAGS which calls a ! pop-up dialog to display/edit the flags bits and then updates the ! T'FLAGS parameter/field on exit. (Setting the dialog variable ! xxxxx'NEXT'FIELD'NAME will cause the main dialog loop to reset the ! focus to that field on the next eventwait operation.) ! !DEBUGGING NOTES: ! Because the main dialog covers the main window, and because regular ! PRINT statements would go to the main window (unless AUTOTPRINT is ! on, in which case this program will go haywire), we just output a ! bunch of debugging text to the main window. If you want to look at ! it, just slide the dialog out of the way. (In a real program, if ! you wanted to use this debugging technique, you might want to hide ! the main window.) ! !------------------------------------------------------------------------- ++pragma ERROR_IF_NOT_MAPPED "ON" ! (avoid stupid unmapped symbol errors) significance 11 !{Include zone} ++include ashinc:xtext.map ++include ashinc:xtext.def ! [116] ++include ashinc:ashell.def ++include ashinc:xtree.map ++include ashinc:xtree.def ++include ashinc:evtmsg.def !{Misc Defs zone} define MAX_INFCTLS = 40 ! max infld controls define MAX_GENCTLS = 15 ! max general AUI_CONTROL controls define xtdlg_MAX_GB = 4 ! max groups define xtdlg_MAX_CTLS = 60 ! max ctls in dialog xtdlg ! Note: for EVW_EXCDINOUT to work, all field exitcodes must be 100 or above (abs) define xtdlg_FKEY_BASE = 200 ! base field exitcode for xtdlg define txfdlg_FKEY_BASE = 300 ! base field exitcode for txfdlg define tbxdlg_FKEY_BASE = 320 ! base field exitcode for tbxdlg define sfxdlg_FKEY_BASE = 450 ! [102] base field exitcode for sfxdlg !{Map zone start} ! The 'CX'ARRAY identifies, positions and sequences all of the controls ! in a form or dialog. The details of the fields themselves are referenced ! via links to the INFLD and CONTROL arrays, using the FTYP$ and IDX fields. !Main dialog "text1": map1 xtdlg'CX'ARRAY(xtdlg_MAX_CTLS) ! master control array for dialog text1 map2 xtdlg'CX'GRP,B,1 map2 xtdlg'CX'ID$,S,16 ! field ID (links to INFLD,other arrays) map2 xtdlg'CX'SROW,B,1 map2 xtdlg'CX'SCOL,B,1 map2 xtdlg'CX'FTYP$,S,1 ! field type: I=INFLD, C=Control, X=Xtree, T=Text map2 xtdlg'CX'IDX,B,1 ! index into array for field type map2 xtdlg'CX'TABNO,B,2 ! tab # (0 if not a tab-stop control) map2 xtdlg'CX'BITS,B,4 ! misc options bits (0x0001 = disable) map2 xtdlg'CX'CTLID,B,2 ! control id # map1 xtdlg'DLG'PARAMS ! other params relating to the text1 dlg map2 xtdlg'CTLCNT,B,2 ! actual # of controls in dlg CX array map2 xtdlg'DLGID,B,2 ! dialog control id # map2 xtdlg'CTLID,B,2 ! working var used in EVENTWAIT map2 xtdlg'EXIT,B,1 ! Set to 1 to cause exit from EVENTWAIT map2 xtdlg'EXITCODE,F,6 ! Local dialog copy of exitcode map2 xtdlg'EXITCODE'FIRST,F,6 ! First exitcode for dialog (event loop) map2 xtdlg'EXITCODE'LAST,F,6 ! Last exitcode for dialog map2 xtdlg'EXITCODE'THIS,F,6 ! Exitcode we get for this ctl map2 xtdlg'EXITCODE'PREV,F,6 ! Prev exitcode (prior to last eventwait) map2 xtdlg'EVOP,B,4 ! Eventwait opcode map2 xtdlg'NEXT'FIELD'NAME,S,16 ! If set, forces jump to specified field !Auxiliary array of groupboxes (per form/dialog); Referenced by !number in the CX array map1 xtdlg'GROUBOXES(xtdlg_MAX_GB) ! groupbox params map2 xtdlg'GB'SROW,B,1 map2 xtdlg'GB'SCOL,B,1 map2 xtdlg'GB'EROW,B,1 map2 xtdlg'GB'ECOL,B,1 map2 xtdlg'GB'TITLE,S,30 map2 xtdlg'GB'ID,B,2 map2 xtdlg'GB'ID$,S,24 ! [110] name version of groupbox id map1 xtdlg'GBCNT,B,2 ! actual # of groupboxes map1 txfdlg'DLG'PARAMS ! other params relating to the txfdlg dlg map2 txfdlg'CTLCNT,B,2 ! actual # of controls in dlg CX array map2 txfdlg'DLGID,B,2 ! dialog control id # map2 txfdlg'CTLID,B,2 ! working var used in EVENTWAIT map2 txfdlg'EXIT,B,1 ! Set to 1 to cause exit from EVENTWAIT map2 txfdlg'EXITCODE,F,6 ! Local dialog copy of exitcode map2 txfdlg'EXITCODE'FIRST,F,6 ! First exitcode for dialog (event loop) map2 txfdlg'EXITCODE'LAST,F,6 ! Last exitcode for dialog map1 tbxdlg'DLG'PARAMS ! other params relating to the tbxdlg dlg map2 tbxdlg'CTLCNT,B,2 ! actual # of controls in dlg CX array map2 tbxdlg'DLGID,B,2 ! dialog control id # map2 tbxdlg'CTLID,B,2 ! working var used in EVENTWAIT map2 tbxdlg'EXIT,B,1 ! Set to 1 to cause exit from EVENTWAIT map2 tbxdlg'EXITCODE,F,6 ! Local dialog copy of exitcode map2 tbxdlg'EXITCODE'FIRST,F,6 ! First exitcode for dialog (event loop) map2 tbxdlg'EXITCODE'LAST,F,6 ! Last exitcode for dialog map1 sfxdlg'DLG'PARAMS ! other params relating to the sfxdlg dlg map2 sfxdlg'CTLCNT,B,2 ! actual # of controls in dlg CX array map2 sfxdlg'DLGID,B,2 ! dialog control id # map2 sfxdlg'CTLID,B,2 ! working var used in EVENTWAIT map2 sfxdlg'EXIT,B,1 ! Set to 1 to cause exit from EVENTWAIT map2 sfxdlg'EXITCODE,F,6 ! Local dialog copy of exitcode map2 sfxdlg'EXITCODE'FIRST,F,6 ! First exitcode for dialog (event loop) map2 sfxdlg'EXITCODE'LAST,F,6 ! Last exitcode for dialog !Master array of all INFLD controls used in program. These are linked !dynamically to 'CX'ARRAY items by the ID$ (name) field, which is !located as the 'CX'ARRAY is loaded and then turned into a numeric link. map1 INFLD'ARRAY(MAX_INFCTLS) ! INFLD controls map2 IX'ID$,S,16 ! field ID (links to ID$ in CX array) map2 IX'XMAX,B,1 map2 IX'XMIN,B,1 map2 IX'TYPE$,S,50 map2 IX'PROMPT$,S,30 map2 IX'TOOLTIP$,S,100 !Master array of all general controls (AUI_CONTROL) used in program. !This is analogous to the INFLD'ARRAY except is used for other control !types (besides INFLD, XTEXT, XTREE) map1 GENCTL'ARRAY(MAX_GENCTLS) ! AUI_CONTROL map2 GX'ID$,S,126 ! field ID (links to ID$ in CX array) map2 GX'HEIGHT,B,1 map2 GX'WIDTH,B,1 map2 GX'TEXT$,S,60 map2 GX'CTYPE,B,4 map2 GX'TOOLTIP$,S,100 map1 T'PARAMS ! Main arguments to XTEXT map2 T'OPCODE,B,2 map2 T'FLAGS,B,4 map2 T'SRC,S,5000 map2 T'SRC'X,X,5000,@T'SRC map2 T'DST,S,5000 map2 T'SROW,F,6 ! [105] was B,1 map2 T'SCOL,F,6 map2 T'EROW,F,6 map2 T'ECOL,F,6 map2 T'AUXTXT,S,500 map2 T'EXITCODE,F ! (also, TXTCTL params mapped in TXTCTL.MAP as TXC'xxx) map1 INFLD'PARAMS map2 INF'ROW,B,1 map2 INF'COL,B,1 map2 INF'XMAX,B,1 map2 INF'XMIN,B,1 map2 INF'TYPE,S,50 map2 INF'ENTRY,S,1000 map2 INF'INXCTL,F map2 INF'V,S,50 ! [110] "parentname:ctlname" map2 INF'VF,F ! [110] old numeric version (for testing) map2 INF'OPCODE,B,2 map2 INF'CMDFLG,F map2 INF'TIMER,F map2 INF'FUNMAP,B,4,-1 map2 INF'MAXPT,B,2,-1 map2 INF'DEFPT,B,2,-1 map2 INF'HLPIDX,S,160 map2 INF'SETDEF,S,200 map2 INF'MAXCHRS,B,2 map1 INFCLR ! This only applies if Themes not active map2 DFCLR,B,1,0 ! display fg (blk) map2 DBCLR,B,1,1 ! display bg (wht) map2 EFCLR,B,1,0 ! editing fg (blk) map2 EBCLR,B,1,1 ! editing bg (wht) map2 NFCLR,B,1,5 ! negatives fg (red) map2 NBCLR,B,1,1 ! negatives bg (wht) map2 UFCLR,B,1,0 ! update fg (blk) map2 UBCLR,B,1,1 ! update bg (wht) map2 MFCLR,B,1,3 ! messages fg (mag) map2 MBCLR,B,1,0 ! messages bg (grey) map2 OFCLR,B,1,2 ! original messages fg map2 OBCLR,B,1,0 ! original messages bg map2 FFCLR,B,1,-1 ! forms fg map2 FBCLR,B,1,-1 ! forms bg map1 MISC map2 MRC,B,2 ! MSGBOX return code map2 I,F ! map2 F,F map2 J,F map2 X,F map2 B4,B,4 map2 STATUS,F map2 EXITCODE,F map2 FTYP$,S,5 map2 GRP,F,6 map2 ID$,S,16 map2 TB$,S,10 map2 TABNO,B,2 map2 HEXON,B,1 ! set if we set hex mode map2 HEX$,S,20 ! map2 MSG$,S,1024 ! [105] was 512 map2 CTLID,B,2 map2 CTEXT$,S,80 map2 CRLF$,S,2,chr(13)+chr(10) map2 save'docfmt,B,2 map2 save'width,B,2 map2 XTEXT'CLICKCODE,F ! click (exit) code for XTEXT map2 ermsg$,S,80 map2 count,F map2 INIFMT,B,2 map2 PLINE,S,1024 map2 TESTDLG'ID,B,2 map1 MISC'SUB'PARAMS ! used mainly within or between subroutines map2 ix,F,6 ! used as index into IX array map2 cx,F,6 ! used as index into CX array map2 gx,F,6 ! used as index into GX array map2 iop,B,1 ! used to convey INF'OPCODE map2 row,B,1 ! temp row map2 col,B,2 ! temp col map2 scol,F,6 ! temp col (need F to detect negative) map2 fldid$,S,16 ! used for locating field by id in CX array map2 i,F,6 map2 save'exitcode,F,6 map2 save'cx,F,6 map2 save'ctlid,B,2 ! following params are used by XTREE dialog for t'flags define MAX_XFPFLAGS = 32 map1 XTREE'FLAGS'PARAMS map2 XFP'FLGARY(MAX_XFPFLAGS) map3 XFP'SYMBOL,S,15 ! symbol name map3 XFP'VALUE,S,11 ! dec value map3 XFP'CB,S,1 ! checkbox column map3 XFP'DESCR,S,80 ! description map2 XFP'ANSWERX map3 XFP'ANSARY(MAX_XFPFLAGS) map4 XFP'CBX,S,1 ! 1 if option set map2 XFP'MAXSEL,F,6 map2 XFP'COLDEF,S,100 map2 XFP'FLAGS,F map2 XFP'SROW,B,1 map2 XFP'SCOL,B,1 map2 XFP'EROW,B,1 map2 XFP'ECOL,B,1 map2 XFP'DLGID,B,2 map2 XFP'OKID,B,2 ! following params are used by XTREE dialog for txc'toolbarmask define MAX_XTBMASK = 32 map1 XTREE'TBMASK'PARAMS map2 XTB'FLGARY(MAX_XTBMASK) map3 XTB'SYMBOL,S,15 ! symbol name map3 XTB'VALUE,S,11 ! dec value map3 XTB'CB,S,1 ! checkbox column map3 XTB'DESCR,S,80 ! description map2 XTB'ANSWERX map3 XTB'ANSARY(MAX_XTBMASK) map4 XTB'CBX,S,1 ! 1 if option set map2 XTB'MAXSEL,F,6 map2 XTB'COLDEF,S,100 map2 XTB'FLAGS,F map2 XTB'SROW,B,1 map2 XTB'SCOL,B,1 map2 XTB'EROW,B,1 map2 XTB'ECOL,B,1 map2 XTB'DLGID,B,2 map2 XTB'OKID,B,2 ! following params are used by XTREE dialog for txc'sflags [102] define MAX_XTSFLAGS = 10 map1 XTREE'SFLAGS'PARAMS map2 XTS'FLGARY(MAX_XTSFLAGS) map3 XTS'SYMBOL,S,15 ! symbol name map3 XTS'VALUE,S,11 ! dec value map3 XTS'CB,S,1 ! checkbox column map3 XTS'DESCR,S,80 ! description map2 XTS'ANSWERX map3 XTS'ANSARY(MAX_XTSFLAGS) map4 XTS'CBX,S,1 ! 1 if option set map2 XTS'MAXSEL,F,6 map2 XTS'COLDEF,S,100 map2 XTS'FLAGS,F map2 XTS'SROW,B,1 map2 XTS'SCOL,B,1 map2 XTS'EROW,B,1 map2 XTS'ECOL,B,1 map2 XTS'DLGID,B,2 map2 XTS'OKID,B,2 !Of following colors, only TFCLR/TBCLR (text) and PFCLR/PBCLR (prompt/titles) !are relevant !Colors: 0=blk,1=wht,2=blu,3=mag,4=red,5=yel,6=grn,7=cyan map1 MMOCLR ! HELP memo colors map2 BFCLR,B,1,3 ! border fg map2 BBCLR,B,1,2 ! border bg map2 TFCLR,B,1,0 ! text fg (black text) map2 TBCLR,B,1,1 ! text bg (white bg) map2 AFCLR,B,1,3 ! arrows fg map2 ABCLR,B,1,2 ! arrows bg map2 PFCLR,B,1,-1 ! prompt fg (column titles) (dfltclrs) map2 PBCLR,B,1,-1 ! prompt bg map2 WFCLR,B,1,5 ! warnings & messages fg map2 WBCLR,B,1,0 ! " " " bg map2 SFCLR,B,1,-1 ! orig. status line fg map2 SBCLR,B,1,-1 ! orig. status line bg map2 RFCLR,B,1,-1 ! ruler/reserved fg map2 RBCLR,B,1,-1 ! ruler/reserved bg map1 AUI'PARAMS map2 AUI'OPCODE,B,2 map2 AUI'CTLID,B,2 map2 AUI'CTEXT$,S,80 map2 AUI'CSTATE,B,2 map2 AUI'CTYPE,B,4 map2 AUI'CMD$,S,80 map2 AUI'FUNC$,S,80 map2 AUI'CSTATUS,F,6 map2 AUI'SROW,B,2 map2 AUI'SCOL,B,2 map2 AUI'EROW,B,2 map2 AUI'ECOL,B,2 map2 AUI'FGC,B,2 map2 AUI'BGC,B,2 map2 AUI'FONTATTR,B,4 map2 AUI'FONTSCALE,B,2 map2 AUI'FONTFACE$,S,32 map2 AUI'TOOLTIP$,S,80 map2 AUI'PARENTID,B,2 map2 AUI'WINCLASS$,S,32 map2 AUI'WINSTYLE,B,4 map2 AUI'WINSTYLEX,B,4 map2 auiop,B,2 map1 AVI'STUFF map2 AVI'DLG'ID,B,2 ! [111] ID of AVI/animation dialog map2 AVI'ID,B,2 ! [111] ID of AVI control map2 AVI'SPEC$,S,200,"FlyPaper.avi" map2 AVI'FLAG$,S,1 ! [111] Y/N whether to show AVI !{Map zone end} !-------------------------------------------------------------------------------------- on error goto TRAP call LOAD'FIELD'DATA ! load field defs from DATA statements !{Main program body} MAIN: call xtdlg'MAIN ! create, process xtdlg dialog goto ENDIT End TRAP: Debug.print "$# $T Error "+err(0) xcall DERR, ermsg$, err(0) ! get the basic error description xcall EVTMSG,EVL_ERROR,"Basic error #%d (%s) in line %d (location counter %x)", & err(0),ermsg$,err(1),err(8) ! ENDIT: if (xtdlg'DLGID) then & xcall AUI,AUI_CONTROL,CTLOP_DEL,xtdlg'DLGID ? tab(-5,24);tab(-6,80); ! [112] Reset main window grid (in case changed) End ABORT: goto ENDIT End !----------------------------------------------------------------- ! xtdlg Main body ! Inputs: ! xtdlg'GROUBOXES() ! xtdlg'CX'ARRAY() ! xtdlg'PARAMS ! INFLD'ARRAY() ! GENCTL'ARRAY() ! Outputs: ! xtdlg'EXIT ! Destroys/uses locally: ! cx,iop, ! Notes: ! This is the main dialog of the program. It allows the user ! to experiment with different XTEXT parameter settings, ! calling the XTEXT control on demand and seeing the results. !----------------------------------------------------------------- xtdlg'MAIN: ! [112] Add option here to test/demo effect of changing dialog ! [112] font scale (doesn't affect dialog overall size; just ! [112] affects font size and height of combos, possibly ! [112] of edit boxes too. ? "Test changing Dialog Sizing parameters (hit ENTER for no change)" xcall MIAMEX,MX_WINSETTINGS,MXOP_GET,AWS_DLGFONTSCALE,i ? "Enter dialog font scale % [";str(i);"]: "; input "",i xcall MIAMEX,MX_WINSETTINGS,MXOP_SET,AWS_DLGFONTSCALE,i ! Grid height and width affect dialog size if MBF_ALTPOS xcall MIAMEX,MX_WINSETTINGS,MXOP_GET,AWS_DLGGRIDHEIGHT,i ? "Enter dialog grid height %[";str(i);"]: "; input "",i xcall MIAMEX,MX_WINSETTINGS,MXOP_SET,AWS_DLGGRIDHEIGHT,i xcall MIAMEX,MX_WINSETTINGS,MXOP_GET,AWS_DLGGRIDWIDTH,i ? "Enter dialog grid width %[";str(i);"]: "; input "",i xcall MIAMEX,MX_WINSETTINGS,MXOP_SET,AWS_DLGGRIDWIDTH,i ! try changing the main window grid size i = 0 ? "These options only affect dialog if dialog based on the main window grid:" input "Enter main window rows: [24] ",i if i = 0 then i = 24 ? tab(-5,i); i = 0 input "Enter main window cols: [80] ",i if i = 0 then i = 80 ? tab(-6,i); ! Start by creating the dialog. For all practical purposes, ! it replaces (covers) the main window (but allows us to use the main ! window for debug output) !print 5/0 ! test forced error xcall AUI,AUI_CONTROL,CTLOP_ADD,xtdlg'DLGID,"XTX1 (XTEXT Tester)", & MBST_ENABLE+MBST_POS, & MBF_DIALOG+MBF_SYSMENU+MBF_MODELESS+MBF_ALTPOS+MBF_MAXBUTTON, & "VK_xF"+str(xtdlg_FKEY_BASE),"",STATUS,0,1,32,92 ! NUL_FGC,NUL_BGC,NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & ! NUL_TOOLTIP$,NUL_PARENTID,NUL_WINCLASS$,WS_MAXIMIZEBOX ! add WS_MAXIMIZEBOX ! now force it to be maximized ! xcall AUI,AUI_WINDOW,SW_SHOWMAXIMIZED,0,0,0,0,0,0,0,0,xtdlg'DLGID ! display the dialog groupboxes... [110] use names for ID for I = 1 to xtdlg'GBCNT xcall AUI,AUI_CONTROL,CTLOP_ADD,xtdlg'GB'ID$(I),xtdlg'GB'TITLE(I), & MBST_ENABLE,MBF_GROUPBOX,NUL_CMD$,NUL_FUNC$,STATUS, & xtdlg'GB'SROW(I),xtdlg'GB'SCOL(I),xtdlg'GB'EROW(I),xtdlg'GB'ECOL(I), & NUL_FGC,NUL_BGC,NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & NUL_TOOLTIP$,xtdlg'DLGID xtdlg'GB'ID(I) = STATUS ! [110] save numeric id also next I ! init XTEXT params to suitable values... call INIT'XTEXT'PARAMS ! now create the fields by displaying them... call xtdlg'DISPLAY'FIELDS xtdlg'EXIT = 0 ! we exit when this gets set ! Note that in this program model, the logic below doesn't have an ! explicit reference to specific exitcodes. It's job is just to call ! the individual field routines until one of them sets xtdlg'EXIT. ! It relies heavily on control information already loaded into the ! xtdlg'*** fields, as well as the INFLD'ARRAY and GENCTL'ARRAY. !{Eventwait} EXITCODE = 99 ! Outer loop uses AUI_EVENTWAIT to allow user to move freely among ! controls. It exits when user clicks on something. EVW_EXCDFOCUS ! causes it to key off of exitcodes rather than control IDs, so the ! xtdlg'CTLID param isn't of much interest. do ! if EXITCODE out of range, get us started at beginning of dialog if EXITCODE >= 90 EXITCODE = xtdlg'EXITCODE'FIRST ! start with focus on first field xtdlg'EVOP = EVW_EXCDFOCUS+EVW_INFLD+EVW_DESCEND+EVW_EXCDINOUT endif DEBUG.PRINT "$# $T Before eventwait xtdlg'CTLID=["+xtdlg'CTLID+"] EXITCODE=["+EXITCODE+"] xtdlg'EVOP=["+xtdlg'EVOP+"] " xcall AUI,AUI_EVENTWAIT,xtdlg'DLGID,xtdlg'CTLID,EXITCODE,xtdlg'EVOP Debug.print "$# $T After eventwait: "+EXITCODE+" ,ctlid "+xtdlg'CTLID ! call field corresponding to EXITCODE cx = abs(EXITCODE - xtdlg'EXITCODE'FIRST) + 1 if cx > 0 and cx <= xtdlg'CTLCNT then iop = INFOP_PRELOAD call xtdlg'GET'FIELD'PARAMS'BY'FLDNUM ! get field params for field #cx call xtdlg'DO'FIELD Debug.print "$# $T After do'field: "+EXITCODE+" ,ctlid "+xtdlg'CTLID endif ! let ESC and ^C also trigger an exit if EXITCODE = EXC_ESC or EXITCODE = EXC_CTRLC or xtdlg'EXIT # 0 then xcall MSGBOX,"Exit program and save settings?" + CRLF$ & + " Yes = Exit & Save" + CRLF$ + & + " No = Exit Without Saving" + CRLF$ + & + " Cancel = Don't exit", "XTX1 Sample Program", & MBTN_YES_NO_CANCEL,MBICON_QUESTION,MBMISC_TASKMODAL,MRC ![105] if MRC = MBRC_YES or MRC = MBRC_NO then if MRC = MBRC_YES then call SAVE'XTEXT'PARAMS ! [105] endif exit else EXITCODE = 99 ! [105] avoid infinite loop endif endif ! Check for special exitcodes that are not in the normal ! range (not a part of the main form). In this case, we ! allowed the user to change the TXF'KBDSTR for XTEXT) if EXITCODE = XTEXT'CLICKCODE then ! see xtdlg'TXF'KBDSTR ! treat click on modeless XTEXT ctl same as on btn fldid$ = "btn'xtext" Debug.print "$# $T EXITCODE="+EXITCODE+" XTEXT'CLICKCODE="+XTEXT'CLICKCODE call xtdlg'DO'FIELD'BY'NAME endif if (EXITCODE = 99) then if xtdlg'EXITCODE'PREV = 99 then exit Debug.print "$# $T Resetting EXITCODE from "+EXITCODE+" to 0" EXITCODE = 0 endif ! allow lower level routines to jump to a new field out ! of sequence by setting the field name if xtdlg'NEXT'FIELD'NAME # "" then Debug.print "$# $T Next field name: "+xtdlg'NEXT'FIELD'NAME fldid$ = xtdlg'NEXT'FIELD'NAME call xtdlg'GET'FIELD'PARAMS'BY'FLDNAME ! get cx xtdlg'CTLID = xtdlg'CX'CTLID(cx) ! set EVENTWAIT ctl EXITCODE = xtdlg'EXITCODE'THIS ! params xtdlg'NEXT'FIELD'NAME = "" ! clr flag endif xtdlg'EXITCODE'PREV = EXITCODE ! save for posterity loop ! delete the dialog xcall AUI,AUI_CONTROL,CTLOP_DEL,xtdlg'DLGID return !----------------------------------------------------------------- ! Call an individual field in the xtdlg based on the cx ! Inputs: ! cx = index to field in xtdlg'CX array ! iop = infld opcode (2=display, 1=preload/edit) ! xtdlg'CX array ! Outputs: ! EXITCODE ! Destroys/uses locally: ! Notes: ! When adding a new field to the dialog, you have to: ! 1. Add it to the data list of INFLD or general controls ! (see data "INFLD" or data "GENCTL") ! 2. Add it to the list of fields for xtdlg (data "xtdlg-MAIN") ! 3. Create a field-level routine for it (xtdlg'xxxxxx) ! 4. Insert the call to the field-level routine in the proper ! place here. ! !----------------------------------------------------------------- xtdlg'DO'FIELD: on cx call xtdlg'OPCODE,xtdlg'FLAGS,xtdlg'BTN'TFLAGS,xtdlg'SRC, & xtdlg'AVI'FLAG, & ! [111] xtdlg'BTN'XTEXT,xtdlg'BTN'EXIT, & xtdlg'CTLNO,xtdlg'KBDSTR,xtdlg'DLGID,xtdlg'WRAPWIDTH, & xtdlg'DOCFMT'SRC,xtdlg'BTN'DOCFMT'SRC, & xtdlg'DOCFMT'DST,xtdlg'BTN'DOCFMT'DST, & xtdlg'OUTBYTES,xtdlg'OUTLINES, & xtdlg'SAVEOFFSET,xtdlg'OVERFLOW,xtdlg'MODIFIED,xtdlg'FONTFACE, & xtdlg'FONTSIZE,xtdlg'FONTATTR, & xtdlg'XROW,xtdlg'BTN'XROW,xtdlg'XCOL,xtdlg'XCURPOS, & xtdlg'SRCHKEY,xtdlg'BTN'SRCHKEY, & xtdlg'SFLAGS,xtdlg'BTN'SFLAGS, & xtdlg'FMAPCTL,xtdlg'FMAPAPP, & xtdlg'TOOLBARMASK,xtdlg'BTN'TOOLBARMASK, & xtdlg'FCOLOR,xtdlg'BTN'FCOLOR, & xtdlg'BCOLOR,xtdlg'BTN'BCOLOR, & xtdlg'FPROTCLR,xtdlg'BTN'FPROTCLR, & xtdlg'BPROTCLR,xtdlg'BTN'BPROTCLR, & xtdlg'PROTROWS,xtdlg'TIMEOUT, & xtdlg'MENUMASK1,xtdlg'MENUMASK2, & xtdlg'HFLAGMASK,xtdlg'HFLAGS1,xtdlg'HFLAGS2, & xtdlg'EXITCODE,xtdlg'DST,xtdlg'BTN'XFERDST return !----------------------------------------------------------------- ! Display all xtdlg' fields ! Inputs: ! T'xxxx = field storage variables for fields in form, and which ! are used to XCALL AUI_XTEXT ! TXC'xxxx = similar to T'xxx but for sub-fields in TXTCTL block ! Outputs: ! Destroys/uses locally: ! cx ! Notes: !----------------------------------------------------------------- xtdlg'DISPLAY'FIELDS: iop = INFOP_DISPLAY for cx = 1 to xtdlg'CTLCNT call xtdlg'GET'FIELD'PARAMS'BY'FLDNUM ! get field params for field #cx ! If the field is an INFLD field and has an associated prompt ! display that now call xtdlg'DISPLAY'INFLD'PROMPT call xtdlg'DO'FIELD next cx return !----------------------------------------------------------------- ! Individual field handling routines. ! Inputs: ! cx = index into CX array for this field ! T'xxxx = field storage variables for fields in form, and which ! are used to XCALL AUI_XTEXT ! TXC'xxxx = similar to T'xxx but for sub-fields in TXTCTL block ! iop = INFLD opcode (1=preload+edit, 2=display) ! All of the field params have been loaded (INF'xxx or AUI'xxx) ! Outputs: ! updated T'xxxxx or TXC'xxxxx field ! EXITCODE ! Notes: ! Each tabstop field must have an entry here because it will be ! called by EVENTWAIT handler. For simple INFLD fields, the ! format may be generic as all the details are handled by the ! CX and IX arrays, the
'PRESET'INFLD'PARAMS routine, and ! the INFLD routine. For more complicated fields, this is where ! you customize field handling. !----------------------------------------------------------------- xtdlg'OPCODE: INF'ENTRY = T'OPCODE ! load field contents !handle any other customization or pre-edit processing here... INF'SETDEF = ",1=create,2=reedit,3=delete,4=display,5=save,," if EXITCODE = xtdlg'EXITCODE'PREV then ! must have clicked on us INF'CMDFLG = INFCF_DROPDOWN ! so go right into dropdown endif call X'INFLD !handle any special post-edit processing here... T'OPCODE = INF'ENTRY return xtdlg'FLAGS: !handle any other customization or pre-edit processing here... !trace.print "tflags before ocvt: "+T'FLAGS xcall MIAMEX,MX_OCVT,T'FLAGS,8,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD !handle any special post-edit processing here... xcall MIAMEX,MX_GTOCT,INF'ENTRY,T'FLAGS ! convert back to decimal !trace.print "tflags after ocvt: "+T'FLAGS return xtdlg'BTN'TFLAGS: ! button to display flags dialog !xcall EVTMSG,EVL_DEBUG,"BTN'FLAGS: cx=%d",cx if iop=INFOP_DISPLAY then ! just create the button call DO'AUI'CONTROL'ANON else if EXITCODE = xtdlg'EXITCODE'THIS then ! must have clicked on us call txfdlg'MAIN ! do txfdlg dialog ! redisplay the updated t'flags field value fldid$ = "t'flags" : call xtdlg'DISPLAY'FIELD'BY'NAME endif endif return xtdlg'SRC: INF'ENTRY = T'SRC ! load field contents !Handle any other customization or pre-edit processing here... !(depending on whether source is text of a file, change prompt ! and field style) !Start by getting the ctl id of the field so we can change it xcall AUI,AUI_CONTROL,CTLOP_GETID,CTLID,"",0, & 0,NUL_CMD$,NUL_FUNC$,STATUS, & xtdlg'CX'SROW(cx),1,xtdlg'CX'SROW(cx),xtdlg'CX'SCOL(cx)-2, & NUL_FGC,NUL_BGC,NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & NUL_TOOLTIP$,xtdlg'GB'ID$(xtdlg'CX'GRP(cx)) ! [110] use GB'ID$ if STATUS <= 0 then xcall EVTMSG,EVL_ERROR,"Unable to locate src prompt control" else CTLID = STATUS if TXC'DOCFMT'SRC and TXFF_FILE then CTEXT$ = "Src (filespec):" else CTEXT$ = "Src (text):" INF'TYPE = INF'TYPE + "||M" ! multiline input INF'DEFPT = 3 ! height of box INF'MAXCHRS = 1000 ! max # chars endif ! update the prompt xcall AUI,AUI_CONTROL,CTLOP_CHG,CTLID,CTEXT$, & MBST_CHANGE+MBST_TEXTONLY,0,NUL_CMD$,NUL_FUNC$,STATUS !XCALL EVTMSG,EVL_DEBUG,"Updated ctl %d with '%s', status=%d",CTLID,CTEXT$,STATUS call X'INFLD !handle any special post-edit processing here... endif T'SRC = INF'ENTRY return xtdlg'AVI'FLAG: ! [111] checkbox to show AVI during loading INF'SETDEF = "Show AVI dialog?" INF'ENTRY = AVI'FLAG$ call X'INFLD AVI'FLAG$ = INF'ENTRY return xtdlg'BTN'XTEXT: ! button to XCALL XTEXT Debug.print "$# $T xtdlg'BTN'XTEXT: iop="+iop+" EXITCODE: "+EXITCODE+"=?"+xtdlg'EXITCODE'THIS+" or "+XTEXT'CLICKCODE if iop=INFOP_DISPLAY then ! just create the button call DO'AUI'CONTROL'ANON else if EXITCODE = xtdlg'EXITCODE'THIS & or EXITCODE = XTEXT'CLICKCODE then ! must have clicked on us or ctl ! check that dst looks like a valid fspec if outputting to file if (((T'FLAGS and TXF_DEFERSAVE)=0) or (T'OPCODE=TXOP_SAVE)) & and ((TXC'DOCFMT'DST and TXFF_FILE)#0) then if T'DST = "" or instr(1,T'DST,chr(13))>0 & or instr(1,T'DST,".")<2 then xcall MSGBOX,"Warning: You are set to output to a file " & + "(Txc'Docfmt'Dst contains TXFF_FILE flag), but " & + "the Dst parameter does not look like a valid filespec." & + "Are you sure you want to continue? ", & + "Dst format warning",MBTN_OK_CANCEL,MBICON_QUESTION, & MBMISC_TASKMODAL,MRC if MRC # MBRC_OK then ! put focus on dst field if then didn't click ok xtdlg'NEXT'FIELD'NAME = "t'dst" return endif endif endif save'exitcode = EXITCODE call DO'XTEXT ! Display a messagebox with information about the output ! since it may not be very obvious what happened MRC = MBRC_OK ! (See test below) MSG$ = "Exitcode = " + str(T'EXITCODE) if (T'EXITCODE >= 90) then & call XTEXT'ERR'MSG & else if T'EXITCODE = 1 then & MSG$ = MSG$ + " (ESC)" ! [102] Display helpful information relating to the result ! [102] of a search operation (but only if search immediately ! [102] exits; otherwise normal exit rules apply.) if ((TXC'SRCHKEY # "") and ((TXC'SFLAGS and TXSF_EXIT)#0)) then if (T'EXITCODE = 0) then & MSG$ = MSG$ + " (Search found at position now in txc'xcol, txc'xrow & txc'xcuroffset)" & else if (T'EXITCODE = -49) then & MSG$ = MSG$ + " (Search failed)" & else & MSG$ = MSG$ + " (Undefined return value from search)" if (T'EXITCODE = 0) then MSG$ = MSG$ + CRLF$ + CRLF$ + "To search for the next (or prev) " & + "occurrence, make sure the TXF_POSCUR flag is set and then " & + "adjust the txc'xrow / txc'xcol up (or down) and repeat the search." endif if ((T'FLAGS and TXF_DEFERSAVE) = 0) then MSG$ = MSG$ + CRLF$ + CRLF$ & + "Warning: You might want to set TXF_DEFERSAVE flag " & + "since there may not be a point in saving the text " & + "after a search." endif else ! (non search operation results) MSG$ = MSG$ + chr(13) +chr(13) if (T'EXITCODE < 90) then ! above this would be an error ! For delete and display, exitcode is enough if (T'OPCODE = TXOP_DISPLAY) then MSG$ = MSG$ + "(End of display operation)" else if (T'OPCODE = TXOP_DELETE) then MSG$ = MSG$ + "(End of delete operation)" else ![106] if ((T'FLAGS and TXF_READONLY)#0) & ![106] and ((T'FLAGS and TXF_DEFERSAVE)=0) THEN ![106] MSG$ = MSG$ + "Although you selected readonly (TXF_READONLY), " & ![106] + "the (unchanged) text was output anyway because you didn't " & ![106] + "also select the TXF_DEFERSAVE flag. " + CRLF$ ![106] endif if (T'OPCODE#TXOP_SAVE) & and (((T'FLAGS and TXF_DEFERSAVE)#0) & or (T'EXITCODE > 0 and T'EXITCODE # 11)) then ! [106][107] MSG$ = MSG$ + "No text output " ! [106] if (T'EXITCODE > 0) then ! [106] MSG$ = MSG$ + "(No changes made or changes were discarded by user) " else if (T'FLAGS and TXF_READONLY) then MSG$ = MSG$ + "(TXF_READONLY)" else MSG$ = MSG$ + "(TXF_DEFERSAVE: you can " & + "retrieve it from the control " & + "and save it using opcode 5)" endif endif else if T'EXITCODE=1 or T'EXITCODE=10 then MSG$ = MSG$ + "Changes (if any) were discarded." else if T'EXITCODE = 11 then ! [107] MSG$ = MSG$ + "(Time out) " endif MSG$ = MSG$ + "Updated text was output to " if (TXC'DOCFMT'DST and TXFF_FILE) then MSG$ = MSG$ + "file specified by contents of Dst parameter." else ! if output didn't all fit; give option to ! loop automatically to retrieve the rest. if (EXITCODE < 90 and TXC'SAVEOFFSET > 0) then MSG$ = MSG$ + "Dst parameter, but it didn't all fit. " & + "You can retrieve the remaining text, one chunk at a time, "& + "by using Opcode 5 (save) until Txc'Saveoffset becomes 0. " & + "This demo program also has a routine to do that automatically " & + "(illustrating how a 'real' app might do it). Do you want to " & + "execute that routine now, (writing the buffers out to XTEXT.BUF)?" xcall MSGBOX,MSG$,"Return from XTEXT.SBR", & MBTN_YES_NO,MBICON_QUESTION,MBMISC_TASKMODAL,MRC if MRC = MBRC_YES then call XTEXT'RETRIEVE'BUFFER'CHUNKS endif else MSG$ = MSG$ + "Dst parameter (which may not be fully " & + "displayed in the form; use the button " & + "'Copy Dst to Src' and then click " & + "xcall XTEXT button again to verify that it " & + "can be re-edited)." endif endif endif endif endif endif endif endif if (MRC = MBRC_OK) then ! (would fail if we already called MSGBOX above) xcall MSGBOX,MSG$,"Return from XTEXT.SBR", & MBTN_OK,MBICON_ICON,MBMISC_TASKMODAL,MRC endif EXITCODE = save'exitcode ! put focus back on the button endif endif return xtdlg'BTN'EXIT: ! button to display flags dialog if iop=INFOP_DISPLAY then ! just create the button call DO'AUI'CONTROL'ANON else if EXITCODE = -xtdlg_FKEY_BASE - cx then ! must have clicked on us xtdlg'EXIT = 1 endif endif return xtdlg'CTLNO: if TXC'CTLNO < 128 then ! [115] INF'ENTRY = TXC'CTLNO else INF'ENTRY = TXC'CTLNO-256 ![115] endif call X'INFLD TXC'CTLNO = INF'ENTRY return xtdlg'KBDSTR: INF'ENTRY = TXC'KBDSTR call X'INFLD TXC'KBDSTR = INF'ENTRY X = instr(1,TXC'KBDSTR,"VK_xF") if X > 0 then XTEXT'CLICKCODE = -val(TXC'KBDSTR[X+5,-1]) else XTEXT'CLICKCODE = 0 endif return xtdlg'DLGID: INF'ENTRY = TXC'PARENTID call X'INFLD TXC'PARENTID = INF'ENTRY return xtdlg'WRAPWIDTH: save'width = TXC'WRAPWIDTH INF'ENTRY = TXC'WRAPWIDTH call X'INFLD TXC'WRAPWIDTH = INF'ENTRY ! [101] Display warning message if changing wrapwidth to nonzero ! [101] and flags are not compatible. if (TXC'WRAPWIDTH # 0) and (TXC'WRAPWIDTH # save'width) then if ( ((T'FLAGS and TXF_WRAP)=0) & or ((T'FLAGS and TXF_FITVIEW)#0) & or ((T'FLAGS and TXF_PRINTVIEW)#0) ) then ! use a simple message box instead of a real dialog xcall MSGBOX, & "Warning: In order for the Txc'wrapwidth option to have an effect, " & + "the following flags must be set as follows: " + CRLF$ + & + CRLF$ + " TXF_WRAP must be set" & + CRLF$ + " TXF_FITVIEW must NOT be set" & + CRLF$ + " TXF_PRINTVIEW must NOT be set", & "txc'wrapwidth Info",MBTN_OK,MBICON_ICON,MBMISC_TASKMODAL,MRC endif endif return xtdlg'DOCFMT'SRC: save'docfmt = TXC'DOCFMT'SRC !handle any other customization or pre-edit processing here... xcall MIAMEX,MX_OCVT,TXC'DOCFMT'SRC,4,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD !handle any special post-edit processing here... xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'DOCFMT'SRC ! convert back to decimal ! redisplay src field if change in format if TXC'DOCFMT'SRC # save'docfmt then fldid$ = "t'src" : call xtdlg'DISPLAY'FIELD'BY'NAME endif return xtdlg'BTN'DOCFMT'SRC: if iop=INFOP_DISPLAY then ! just create the button call DO'AUI'CONTROL'ANON else if EXITCODE = xtdlg'EXITCODE'THIS then ! must have clicked on us ! use a simple message box instead of a real dialog xcall MSGBOX, & "Combine zero or more of the following (hex) to determine src format:" & + CRLF$ + & + CRLF$ + " 100 = (TXFF_FILE) File else string buffer" & + CRLF$ + " 000 = (TXFF_TEXT) Text " & + CRLF$ + " 002 = (TXFF_RTF) RTF", & "txc'docfmt'src Info",MBTN_OK,MBICON_ICON,MBMISC_TASKMODAL,MRC endif endif return xtdlg'DOCFMT'DST: save'docfmt = TXC'DOCFMT'DST !handle any other customization or pre-edit processing here... xcall MIAMEX,MX_OCVT,TXC'DOCFMT'DST,4,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD !handle any special post-edit processing here... xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'DOCFMT'DST ! convert back to decimal ! redisplay src field if change in format if TXC'DOCFMT'DST # save'docfmt then fldid$ = "t'dst" : call xtdlg'DISPLAY'FIELD'BY'NAME endif return xtdlg'BTN'DOCFMT'DST: if iop=INFOP_DISPLAY then ! just create the button call DO'AUI'CONTROL'ANON else if EXITCODE = xtdlg'EXITCODE'THIS then ! must have clicked on us ! use a simple message box instead of a real dialog xcall MSGBOX, & "Combine zero or more of the following (hex) to determine dst format:" & + CRLF$ + & + CRLF$ + " 100 = (TXFF_FILE) File else string buffer" & + CRLF$ + " 000 = (TXFF_TEXT) Text " & + CRLF$ + " 001 = (TXFF_TEXT_LINES) Text with line breaks (TXFF_TEXT_LINES)" & + CRLF$ + " 002 = (TXFF_RTF) RTF", & "txc'docfmt'dst Info",MBTN_OK,MBICON_ICON,MBMISC_TASKMODAL,MRC endif endif return xtdlg'OUTBYTES: INF'ENTRY = TXC'OUTBYTES call X'INFLD TXC'OUTBYTES = INF'ENTRY return xtdlg'OUTLINES: INF'ENTRY = TXC'OUTLINES call X'INFLD TXC'OUTLINES = INF'ENTRY return xtdlg'SAVEOFFSET: INF'ENTRY = TXC'SAVEOFFSET call X'INFLD TXC'SAVEOFFSET = INF'ENTRY return xtdlg'OVERFLOW: INF'ENTRY = TXC'OVERFLOW call X'INFLD TXC'OVERFLOW = INF'ENTRY return xtdlg'MODIFIED: INF'ENTRY = TXC'MODIFIED call X'INFLD TXC'MODIFIED = INF'ENTRY return xtdlg'FONTFACE: INF'ENTRY = TXC'FONTFACE call X'INFLD TXC'FONTFACE = INF'ENTRY return xtdlg'FONTSIZE: INF'ENTRY = TXC'FONTSIZE call X'INFLD TXC'FONTSIZE = INF'ENTRY return xtdlg'FONTATTR: INF'ENTRY = TXC'FONTATTR call X'INFLD TXC'FONTATTR = INF'ENTRY return xtdlg'XROW: INF'ENTRY = TXC'XROW call X'INFLD TXC'XROW = INF'ENTRY return xtdlg'BTN'XROW: ! [102] help for xrow/xcol/xcuroffset if iop=INFOP_DISPLAY then ! just create the button call DO'AUI'CONTROL'ANON else if EXITCODE = xtdlg'EXITCODE'THIS then ! must have clicked on us ! use a simple message box instead of a real dialog xcall MSGBOX, & "The txc'xrow, txc'xcol and txc'xcuroffset fields are updated " & + "after each editing operation. The first two are 'base 1' " & + "(first position is row 1, col 1), while the cursoffset is 'base 0'. " & + CRLF$ + CRLF$ + "To use these fields to set the initial cursor position " & + "at the start of an editing operation, set the TXF_POSCUR flag (and clear " & + "the TXF_EOT flag). The xrow/xcol fields normally take precedence, but " & + "if either is 0, the xcuroffset field will determine the cursor position.", & "txc'xrow Info",MBTN_OK,MBICON_ICON,MBMISC_TASKMODAL,MRC endif endif return xtdlg'XCOL: INF'ENTRY = TXC'XCOL call X'INFLD TXC'XCOL = INF'ENTRY return xtdlg'XCURPOS: INF'ENTRY = TXC'XCUROFFSET call X'INFLD TXC'XCUROFFSET = INF'ENTRY return xtdlg'SRCHKEY: INF'ENTRY = TXC'SRCHKEY INF'MAXCHRS = 30 ! allow horiz scrolling call X'INFLD TXC'SRCHKEY = INF'ENTRY return xtdlg'BTN'SRCHKEY: ! [102] if iop=INFOP_DISPLAY then ! just create the button call DO'AUI'CONTROL'ANON else if EXITCODE = xtdlg'EXITCODE'THIS then ! must have clicked on us ! use a simple message box instead of a real dialog xcall MSGBOX, & "If txc'srchkey field is not blank, opcodes 1 and 2 will " & + "start by searching for the specified string. Search options " & + "are set by the txc'sflags field (below; use button to see flag breakdown). " & + "Search starts in same position cursor would start, based on " & + "TXF_EOT, TXF_POSCUR, txc'xrow, txc'xcol, txc'xcuroffset. " & + "Set the TXSF_EXIT search flag to exit immediately after the search, " & + "in which case t'exitcode will return 0 if the search is successful " & + "or -49 if not. On success, the txc'xcol, txc'xrow, and txc'xcuroffset " & + "fields will be updated to indicate the position of the found text. " & + "To continue search (next/prev), adjust the txc'xcol / txc'xrow up (or down) "& + "and repeat the search from the new position. (Make sure the TXF_POSCUR t'flag " & + "is set and TXF_EOT is not set, or else search will always start at beginning (or end). " & + "If the TXSF_EXIT search flag is not set, then the editing session will simply start " & + "at the location of the first match, if any." & + CRLF$ + CRLF$ + "Note: when using TXSF_EXIT, you probably should set " & + "the TXF_DEFERSAVE flag since saving the text is probably not applicable.", & "txc'srchkey Info",MBTN_OK,MBICON_ICON,MBMISC_TASKMODAL,MRC endif endif return xtdlg'SFLAGS: ! [102] !handle any other customization or pre-edit processing here... xcall MIAMEX,MX_OCVT,TXC'SFLAGS,4,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD !handle any special post-edit processing here... xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'SFLAGS ! convert back to decimal return xtdlg'BTN'SFLAGS: ! [102] display sflags dialog if iop=INFOP_DISPLAY then ! just create the button call DO'AUI'CONTROL'ANON else if EXITCODE = xtdlg'EXITCODE'THIS then ! must have clicked on us call sfxdlg'MAIN ! do sfxdlg dialog fldid$ = "txc'sflags" : call xtdlg'DISPLAY'FIELD'BY'NAME endif endif return xtdlg'FMAPCTL: ! [103] convert to/from hex xcall MIAMEX,MX_OCVT,TXC'FMAPCTL,8,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD !handle any special post-edit processing here... xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'FMAPCTL ! convert back to decimal return xtdlg'FMAPAPP: ! [103] convert to/from hex xcall MIAMEX,MX_OCVT,TXC'FMAPAPP,8,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD !handle any special post-edit processing here... xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'FMAPAPP ! convert back to decimal return xtdlg'TOOLBARMASK: !handle any other customization or pre-edit processing here... xcall MIAMEX,MX_OCVT,TXC'TOOLBARMASK,8,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD !handle any special post-edit processing here... xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'TOOLBARMASK ! convert back to decimal return xtdlg'BTN'TOOLBARMASK: ! button to display toolbarmask dialog if iop=INFOP_DISPLAY then ! just create the button call DO'AUI'CONTROL'ANON else if EXITCODE = xtdlg'EXITCODE'THIS then ! must have clicked on us call tbxdlg'MAIN ! do tbxdlg dialog fldid$ = "txc'toolbarmask" : call xtdlg'DISPLAY'FIELD'BY'NAME endif endif return xtdlg'FCOLOR: !handle any other customization or pre-edit processing here... xcall MIAMEX,MX_OCVT,TXC'FCOLOR,6,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD !handle any special post-edit processing here... xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'FCOLOR ! convert back to decimal return xtdlg'BTN'FCOLOR: ! Help button for TXC'FCOLOR if iop=INFOP_DISPLAY then ! If display mode, call DO'AUI'CONTROL'ANON ! just create button else Debug.print "$# $T FCOLOR: EXITCODE="+EXITCODE+" THIS: "+xtdlg'EXITCODE'THIS if EXITCODE = xtdlg'EXITCODE'THIS then ! must have clicked on us ! use a simple message box instead of a real dialog xcall MSGBOX, & "Foreground (text) color in BBGGRR format, where " & + "bb, gg, and rr are the Blue, Green and Red values " & + "ranging from 00 (min) to FF (max). Examples: " & + CRLF$ + & + CRLF$ + " 000000 = Back (default)" & + CRLF$ + " FF0000 = Intense blue" & + CRLF$ + " D8D8D8 = Light gray" & + CRLF$ + " 0080FF = Orange", & "txt'fcolor Info",MBTN_OK,MBICON_ICON,MBMISC_TASKMODAL,MRC endif endif return xtdlg'BCOLOR: !handle any other customization or pre-edit processing here... xcall MIAMEX,MX_OCVT,TXC'BCOLOR,6,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD !handle any special post-edit processing here... xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'BCOLOR ! convert back to decimal return xtdlg'BTN'BCOLOR: ! Help button for TXC'BCOLOR if iop=INFOP_DISPLAY then ! If display mode, call DO'AUI'CONTROL'ANON ! just create button else if EXITCODE = xtdlg'EXITCODE'THIS then ! must have clicked on us ! use a simple message box instead of a real dialog xcall MSGBOX, & "Foreground (text) color in BBGGRR format, where " & + "bb, gg, and rr are the Blue, Green and Red values " & + "ranging from 00 (min) to FF (max). Examples: " & + CRLF$ + & + CRLF$ + " 000000 = Back (default)" & + CRLF$ + " FF0000 = Intense blue" & + CRLF$ + " D8D8D8 = Light gray" & + CRLF$ + " 0080FF = Orange", & "txt'fcolor Info",MBTN_OK,MBICON_ICON,MBMISC_TASKMODAL,MRC endif endif return xtdlg'FPROTCLR: !handle any other customization or pre-edit processing here... xcall MIAMEX,MX_OCVT,TXC'FPROTCLR,6,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD !handle any special post-edit processing here... xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'FPROTCLR ! convert back to decimal return xtdlg'BTN'FPROTCLR: ! Help button for TXC'FPROTCLR if iop=INFOP_DISPLAY then ! If display mode, call DO'AUI'CONTROL'ANON ! just create button else if EXITCODE = xtdlg'EXITCODE'THIS then ! must have clicked on us ! use a simple message box instead of a real dialog xcall MSGBOX, & "Foreground (text) color for protected text in BBGGRR format, where " & + "bb, gg, and rr are the Blue, Green and Red values " & + "ranging from 00 (min) to FF (max). Examples: " & + CRLF$ + & + CRLF$ + " 000000 = Back (default)" & + CRLF$ + " FF0000 = Intense blue" & + CRLF$ + " D8D8D8 = Light gray" & + CRLF$ + " 0080FF = Orange", & "txt'fcolor Info",MBTN_OK,MBICON_ICON,MBMISC_TASKMODAL,MRC endif endif return xtdlg'BPROTCLR: !handle any other customization or pre-edit processing here... xcall MIAMEX,MX_OCVT,TXC'BPROTCLR,6,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD !handle any special post-edit processing here... xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'BPROTCLR ! convert back to decimal return xtdlg'BTN'BPROTCLR: ! Help button for TXC'BPROTCLR if iop=INFOP_DISPLAY then ! if display mode, call DO'AUI'CONTROL'ANON ! just create the button else Debug.print "$# $T BPROTCLR: EXITCODE="+EXITCODE+" THIS: "+xtdlg'EXITCODE'THIS if EXITCODE = xtdlg'EXITCODE'THIS then ! must have clicked on us ! use a simple message box instead of a real dialog xcall MSGBOX, & "Background color for protected text in BBGGRR format, where " & + "bb, gg, and rr are the Blue, Green and Red values " & + "ranging from 00 (min) to FF (max). Examples: " & + CRLF$ + & + CRLF$ + " 000000 = Back (default)" & + CRLF$ + " FF0000 = Intense blue" & + CRLF$ + " D8D8D8 = Light gray" & + CRLF$ + " 0080FF = Orange", & "txt'bprotclr Info",MBTN_OK,MBICON_ICON,MBMISC_TASKMODAL,MRC endif endif return xtdlg'PROTROWS: INF'ENTRY = TXC'PROTROWS call X'INFLD TXC'PROTROWS = INF'ENTRY return xtdlg'TIMEOUT: ! [107] INF'ENTRY = TXC'TIMEOUT call X'INFLD TXC'TIMEOUT = INF'ENTRY return xtdlg'MENUMASK1: ! [117] xcall MIAMEX,MX_OCVT,TXC'MENUMASK1,8,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'MENUMASK1 ! convert back to decimal return xtdlg'MENUMASK2: ! [117] xcall MIAMEX,MX_OCVT,TXC'MENUMASK2,8,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'MENUMASK2 ! convert back to decimal return xtdlg'HFLAGMASK: ! [117] xcall MIAMEX,MX_OCVT,TXC'HFLAGMASK,4,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'HFLAGMASK ! convert back to decimal return xtdlg'HFLAGS1: ! [117] xcall MIAMEX,MX_OCVT,TXC'HFLAGS1,8,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'HFLAGS1 ! convert back to decimal return xtdlg'HFLAGS2: ! [117] xcall MIAMEX,MX_OCVT,TXC'HFLAGS2,8,OT_MEM,INF'ENTRY ! convert to hex string call X'INFLD xcall MIAMEX,MX_GTOCT,INF'ENTRY,TXC'HFLAGS2 ! convert back to decimal return xtdlg'EXITCODE: INF'ENTRY = T'EXITCODE call X'INFLD T'EXITCODE = INF'ENTRY return xtdlg'DST: INF'ENTRY = T'DST !(depending on whether source is text of a file, change prompt ! and field style) !Start by getting the ctl id of the field so we can change it xcall AUI,AUI_CONTROL,CTLOP_GETID,CTLID,"",0, & 0,NUL_CMD$,NUL_FUNC$,STATUS, & xtdlg'CX'SROW(cx),1,xtdlg'CX'SROW(cx),xtdlg'CX'SCOL(cx)-2, & NUL_FGC,NUL_BGC,NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & NUL_TOOLTIP$,xtdlg'GB'ID$(xtdlg'CX'GRP(cx)) ! [110] use GB'ID$ if STATUS <= 0 then xcall EVTMSG,EVL_ERROR,"Unable to locate dst prompt control" else CTLID = STATUS if TXC'DOCFMT'DST and TXFF_FILE then CTEXT$ = "Dst (filespec):" else CTEXT$ = "Dst (text):" INF'TYPE = INF'TYPE + "||M" ! multiline input INF'DEFPT = 3 ! height of box INF'MAXCHRS = 1000 ! max # chars endif ! update the prompt xcall AUI,AUI_CONTROL,CTLOP_CHG,CTLID,CTEXT$, & MBST_CHANGE+MBST_TEXTONLY,0,NUL_CMD$,NUL_FUNC$,STATUS !XCALL EVTMSG,EVL_DEBUG,"Updated ctl %d with '%s', status=%d",CTLID,CTEXT$,STATUS endif call X'INFLD T'DST = INF'ENTRY return xtdlg'BTN'XFERDST: if iop=INFOP_DISPLAY then ! just create the button call DO'AUI'CONTROL'ANON else if EXITCODE = -xtdlg_FKEY_BASE - cx then ! must have clicked on us T'SRC = T'DST ! fldid$ = "t'src" : call xtdlg'DISPLAY'FIELD'BY'NAME ! xcall MSGBOX,"Dst transferred to Src","Debug", & ! MBTN_OK,MBICON_ICON,MBMISC_TASKMODAL,MRC ! force next focus back to t'src field xtdlg'NEXT'FIELD'NAME = "t'src" endif endif return !----------------------------------------------------------------- ! Preset INFLD params for text1 dialog ! Inputs: ! cx = index into xtdlg'CX'xxx() ! iop = INFLD opcode ! Outputs: ! INF'xxxx params for calling INFLD ! Internal vars destroyed: ! ix ! Notes: ! This routine transfers basic INFLD info from the CX and IX ! control arrays into the INF' params used by INFLD. The ! calling routine can then customize these further to deal ! with things that the CX and IX arrays don't handle !-DLG CX array params... ! map2 xtdlg'CX'GRP,B,1 ! map2 xtdlg'CX'ID$,S,16 ! field ID (links to INFLD,other arrays) ! map2 xtdlg'CX'SROW,B,1 ! map2 xtdlg'CX'SCOL,B,1 ! map2 xtdlg'CX'FTYP$,S,1 ! field type: I=INFLD, C=Control, X=Xtree, T=Text ! map2 xtdlg'CX'IDX,B,1 ! index into array for field type ! map2 xtdlg'CX'TABNO,B,2 ! tab # (0 if not a tab-stop control) ! map2 xtdlg'CX'BITS,B,4 ! misc options bits (0x0001 = disable) ! map2 xtdlg'CX'CTLID,B,2 ! control id # !-INFLD array params... ! map2 IX'ID$,S,16 ! field ID (links to ID$ in CX array) ! map2 IX'XMAX,B,1 ! map2 IX'XMIN,B,1 ! map2 IX'TYPE$,S,50 ! map2 IX'PROMPT$,S,30 ! map2 IX'TOOLTIP$,S,100 ! !----------------------------------------------------------------- xtdlg'PRESET'INFLD'PARAMS: ix = xtdlg'CX'IDX(cx) INF'ROW = xtdlg'CX'SROW(cx) INF'COL = xtdlg'CX'SCOL(cx) INF'XMAX = IX'XMAX(ix) INF'XMIN = IX'XMIN(ix) INF'TYPE = IX'TYPE$(ix) + "]|G||C135T||Tg" ![110] INF'V = 1 + xtdlg'GB'ID(xtdlg'CX'GRP(cx)) ![110] INF'VF = 1 + xtdlg'GB'ID(xtdlg'CX'GRP(cx)) ![110] INF'V = INF'VF ! to avoid string concat INF'V = xtdlg'GB'ID$(xtdlg'CX'GRP(cx)) +">" + IX'ID$(ix) ! [110] INF'OPCODE = iop INF'TIMER = 0 INF'DEFPT = -1 INF'MAXPT = -1 INF'FUNMAP = -1 INF'HLPIDX = ">"+IX'TOOLTIP$(ix)+"~VK_xF"+str(xtdlg_FKEY_BASE+cx) INF'SETDEF = "" INF'MAXCHRS = 0 if xtdlg'CX'BITS(cx) and MBST_DISABLE then INF'CMDFLG = INFCF_DISABLE else INF'CMDFLG = 0 endif ! as a convenience, if in display mode, call the routine that ! displays the INFLD prompt if iop=INFOP_DISPLAY call xtdlg'DISPLAY'INFLD'PROMPT ! display prompt return !----------------------------------------------------------------- ! Display prompt which goes with and INFLD field ! Inputs: ! cx = index into xtdlg'CX'xxx() ! Outputs: ! prompt displayed ! Internal vars destroyed: ! ! Notes: ! Combining the prompt string with the INFLD param data is just a ! nicety, and for simplicity, in this mode we right justify the ! prompt just to the left of the field. ! The other alternative is to leave that field blank in ! the INFLD definition and use a standard AUI_CONTROL to create ! the prompt independent of the field ! !----------------------------------------------------------------- xtdlg'DISPLAY'INFLD'PROMPT: if xtdlg'CX'FTYP$(cx)="I" then ! if INFLD field... ix = xtdlg'CX'IDX(cx) if ix > MAX_INFCTLS then xcall EVTMSG,EVL_ERROR, & "Invalid idx into INFLD array in xtdlg'DISPLAY'PROMPT: ix=%d, cx=%d", & ix,cx else if (IX'PROMPT$(ix)#"") then ! if prompt not blank.. row = xtdlg'CX'SROW(cx) col = xtdlg'CX'SCOL(cx) scol = col-len(IX'PROMPT$(ix))-2 if scol < 4 then scol = 4 xcall AUI,AUI_CONTROL,CTLOP_ADD,0,IX'PROMPT$(ix),MBST_ENABLE, & MBF_STATIC+MBF_RTJUST,NUL_CMD$,NUL_FUNC$,NUL_CSTATUS, & row,scol,row,col-2, & NUL_FGC,NUL_BGC,NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & NUL_TOOLTIP$,xtdlg'GB'ID$(xtdlg'CX'GRP(cx)) ! [110] GB'ID$ ![109] remove MBF_FRAME from above endif endif endif return !----------------------------------------------------------------- ! Preset General Control Params ! Inputs: ! cx = index into xtdlg'CX'xxx() ! Outputs: !` AUI'xxx ! Internal vars destroyed: ! ix ! Notes: ! This routine is analogous to PRESET'INFLD'PARAMS except for ! general controls. !-DLG CX array params... ! map2 xtdlg'CX'GRP,B,1 ! map2 xtdlg'CX'ID$,S,12 ! field ID (links to INFLD,other arrays) ! map2 xtdlg'CX'SROW,B,1 ! map2 xtdlg'CX'SCOL,B,1 ! map2 xtdlg'CX'FTYP$,S,1 ! field type: I=INFLD, C=Control, X=Xtree, T=Text ! map2 xtdlg'CX'IDX,B,1 ! index into array for field type ! map2 xtdlg'CX'TABNO,B,2 ! tab # (0 if not a tab-stop control) ! map2 xtdlg'CX'BITS,B,4 ! misc options bits (0x0001 = disable) ! map2 xtdlg'CX'CTLID,B,2 ! control id # !-GENCTL array params... ! map2 GX'ID$,S,12 ! field ID (links to ID$ in CX array) ! map2 GX'HEIGHT,B,1 ! map2 GX'WIDTH,B,1 ! map2 GX'TEXT$,S,60 ! MAP2 GX'CTYPE,B,4 ! map2 GX'TOOLTIP$,S,100 !----------------------------------------------------------------- xtdlg'PRESET'GENCTL'PARAMS: gx = xtdlg'CX'IDX(cx) AUI'OPCODE = CTLOP_ADD AUI'SROW = xtdlg'CX'SROW(cx) AUI'SCOL = xtdlg'CX'SCOL(cx) AUI'EROW = AUI'SROW + GX'HEIGHT(gx) - 1 AUI'ECOL = AUI'SCOL + GX'WIDTH(gx) - 1 AUI'CSTATE = xtdlg'CX'BITS(cx) and &h0FF AUI'CTYPE = GX'CTYPE(gx) AUI'CTEXT$ = GX'TEXT$(gx) AUI'CMD$ = "VK_xF" + str(xtdlg_FKEY_BASE+cx) AUI'FUNC$ = NUL_FUNC$ AUI'FGC = NUL_FGC AUI'BGC = NUL_BGC AUI'FONTATTR = NUL_FONTATTR AUI'FONTSCALE = NUL_FONTSCALE AUI'FONTFACE$ = NUL_FONTFACE$ AUI'TOOLTIP$ = GX'TOOLTIP$(gx) AUI'PARENTID = xtdlg'GB'ID(xtdlg'CX'GRP(cx)) AUI'WINCLASS$ = NUL_WINCLASS$ AUI'WINSTYLE = NUL_WINSTYLE AUI'WINSTYLEX = NUL_WINSTYLEX return !----------------------------------------------------------------- ! DO'AUI'CONTROL'ANON - create or operate on an anonymous control ! (where we will never know the ID unless we use CTLOP_GETID) ! Inputs: ! AUI'xxx params ! auiop = opcode ! Outputs: !` AUI'CTLID (only if auiop = CTLOP_GETID) ! AUI'STATUS (not for auiop = CTLOP_ADD) ! Internal vars destroyed: ! ix ! Notes: !----------------------------------------------------------------- DO'AUI'CONTROL'ANON: Debug.print "$# $T AUI_CONTROL: "+AUI'OPCODE+","+AUI'CTEXT$+"," & +AUI'SROW+","+AUI'SCOL+","+AUI'EROW+","+AUI'ECOL if auiop = CTLOP_ADD then ! version with no return status xcall AUI, AUI_CONTROL, AUI'OPCODE, 0, AUI'CTEXT$, AUI'CSTATE, & AUI'CTYPE, AUI'CMD$, AUI'FUNC$, NUL_CSTATUS, & AUI'SROW, AUI'SCOL, AUI'EROW, AUI'ECOL, & AUI'FGC, AUI'BGC, AUI'FONTATTR, AUI'FONTSCALE, AUI'FONTFACE$, & AUI'TOOLTIP$, AUI'PARENTID, AUI'WINCLASS$, AUI'WINSTYLE, AUI'WINSTYLEX else xcall AUI, AUI_CONTROL, AUI'OPCODE, AUI'CTLID, AUI'CTEXT$, AUI'CSTATE, & AUI'CTYPE, AUI'CMD$, AUI'FUNC$, AUI'CSTATUS, & AUI'SROW, AUI'SCOL, AUI'EROW, AUI'ECOL, & AUI'FGC, AUI'BGC, AUI'FONTATTR, AUI'FONTSCALE, AUI'FONTFACE$, & AUI'TOOLTIP$, AUI'PARENTID, AUI'WINCLASS$, AUI'WINSTYLE, AUI'WINSTYLEX endif !stop return !----------------------------------------------------------------- ! Wrapper for all INFLD.SBR calls ! Inputs: ! INF'xxx ! Outputs: ! EXITCODE !----------------------------------------------------------------- X'INFLD: INF'OPCODE = iop if (INF'OPCODE < 2) then Debug.print "$# $T X'INFLD: "+INF'ROW+","+INF'COL+"," & +INF'ENTRY+","+"OPCODE: "+INF'OPCODE+","+INFOP_DISPLAY endif xcall INFLD,INF'ROW,INF'COL,INF'XMAX,INF'XMIN,INF'TYPE, & INF'ENTRY,INF'INXCTL,INF'V,INF'OPCODE,EXITCODE, & INF'TIMER,INF'CMDFLG,INF'DEFPT,INF'MAXPT,INF'FUNMAP, & INF'SETDEF,INFCLR,INF'HLPIDX,INF'MAXCHRS if (INF'OPCODE < 2) Debug.print "$# $T infld exitcode: "+EXITCODE return !--------------------------------------------------------------------------------- ! txfdlg'MAIN ! Supplementary dialog for editing flags bits. Just for kicks, we use ! XTREE with checkboxes instead of a traditional set of checkboxes ! Inputs: T'FLAGS, xtdlg'DLGID ! Outputs: T'FLAGS ! Locals: ! Notes: ! This dialog is so small that I didn't bother with the business of ! defining the fields in the various arrays, although we do make ! some use of the txfdlg'DLG'PARAMS. Note that we use a local version ! of EXITCODE to avoid conflicting with main xtdlg !---------------------------------------------------------------------------------- txfdlg'MAIN: xcall AUI,AUI_CONTROL,CTLOP_ADD,txfdlg'DLGID,"XTEXT FLAGS Bits", & MBST_ENABLE,MBF_DIALOG+MBF_SYSMENU, & NUL_CMD$,NUL_FUNC$,STATUS,5000,13,20500,58,NUL_FGC,NUL_BGC, & NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$,NUL_TOOLTIP$,xtdlg'DLGID if txfdlg'DLGID < 1 then xcall EVTMSG,EVL_ERROR,"Unable to create xtfdlg dialog - status = %d",STATUS return endif ! draw a line across bottom xcall AUI,AUI_CONTROL,CTLOP_ADD,NUL_CTLID,NUL_CTEXT$,MBST_ENABLE, & NUL_CTYPE,NUL_CMD$,NUL_FUNC$,NUL_CSTATUS,13,1,13,45, & NUL_FGC,NUL_BGC,NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & NUL_TOOLTIP$,txfdlg'DLGID, & "STATIC", SS_BLACKRECT+SS_SUNKEN ! create a couple of buttons (OK/CANCEL with icons) xcall AUI,AUI_CONTROL,CTLOP_ADD,XFP'OKID,"check2::ashico1.dll", & MBST_ENABLE,MBF_BUTTON+MBF_ICON+MBF_KBD, & "VK_xF"+str(txfdlg_FKEY_BASE+1),NUL_FUNC$, & STATUS,14,39,14,41 xcall AUI,AUI_CONTROL,CTLOP_ADD,XFP'OKID,"delete2::ashico1.dll", & MBST_ENABLE,MBF_BUTTON+MBF_ICON+MBF_KBD, & "VK_ESCAPE",NUL_FUNC$, & STATUS,14,42,14,44 ! [103] use VK_ESCAPE ! Set up the XTREE parameters XFP'FLAGS = 0 XFP'FLAGS = XFP'FLAGS or XTF_XYXY ! alt coords (srow,scol,erow,ecol) XFP'FLAGS = XFP'FLAGS or XTF_COLDFX ! complex syntax in COLDEF XFP'FLAGS = XFP'FLAGS or XTF_EDITABLE ! needed for editable cb or text XFP'FLAGS = XFP'FLAGS or XTF_FKEY ! Allow F1-F16 XFP'FLAGS = XFP'FLAGS or XTF_TAB ! TAB (Exitcode -44) XFP'FLAGS = XFP'FLAGS or XTF_SORT ! Allow column sorting XFP'FLAGS = XFP'FLAGS or XTF_REORD ! Allow reordering of columns ! Set up XTRCTL options... XTR'ITEMLINES = 1 ! (max) # lines per row to show (see XTF_VARY) XTR'SHOWGRID = 1 ! show grid lines XTR'GRIDSTYLE = 2 ! solid vertical & horizontal ! 0=vert solid, 1=horz solid, 2=both, ! 3=vert dotted, 4=horz dotted, 5=both XTR'SELECTAREA = XTRSEL_AREA_CELL1T + XTRSEL_STY_CELL1T ! click celltext only, highlight first cell XTR'SCROLLTIPS = 1 ! show scroll tips XTR'FLYBY = 1 ! show flyby highlighting XTR'TRUNCATED = 1 ! show truncation indicators XTR'SHOW3D = 0 XTR'SHOW3D = 0 XTR'OPCODE = XTROP_CREATE XTR'HIDEHEADER = 0 XTR'SHOWBUTTONS0 = 0 ! show exp/collapse buttons (level 0) XTR'SHOWBUTTONS = 0 ! show exp/collapse buttons (level 1+) XTR'USETHEMES = 1 ! set up coordinates XFP'SROW = 2 XFP'SCOL = 2 XFP'EROW = 12 XFP'ECOL = 44 ! define columns (symbol - checkbox - description) ! map3 XFP'SYMBOL,S,15 ! symbol name ! map3 XFP'VALUE,S,11 ! dec value ! map3 XFP'CB,S,1 ! checkbox column ! map3 XFP'DESCR,S,60 ! description XFP'COLDEF = "1~15~Flag Symbol~S~Dspwid=10~~16~11~V~H~~27~1~ ~T~~28~80~Description~S~~" !initialize checkboxes by parsing the input T'FLAGS field... for I = 1 to XFP'MAXSEL ! first retrieve the value from the value column B4 = XFP'VALUE(I) if T'FLAGS and B4 then XFP'CB(I) = "1" else XFP'CB(I) = "0" endif next I ! initialize CB answer array for I = 1 to XFP'MAXSEL XFP'CBX(I) = XFP'CB(I) next I xcall XTREE,XFP'SROW,XFP'SCOL,XFP'ANSWERX,XFP'FLGARY(1),XFP'MAXSEL, & XFP'COLDEF,txfdlg'EXITCODE,XFP'EROW,XFP'ECOL,XFP'FLAGS,"",MMOCLR,XTRCTL if txfdlg'EXITCODE # 1 and txfdlg'EXITCODE # -(txfdlg_FKEY_BASE+2) then ! update T'FLAGS based on new checkbox values ! (these are returned in the CBX array in XFP'ANSWERX) ! otherwise retrieve the updated flags T'FLAGS = 0 for I = 1 to XFP'MAXSEL if XFP'CBX(I) = "1" then B4 = XFP'VALUE(I) T'FLAGS = T'FLAGS or B4 endif next I endif xcall AUI,AUI_CONTROL,CTLOP_DEL,txfdlg'DLGID ! delete dialog return !--------------------------------------------------------------------------------- ! tbxdlg'MAIN ! Supplementary dialog for editing txf'toolbarmask bits. Just for kicks, ! we use XTREE with checkboxes instead of a traditional set of checkboxes ! Inputs: T'FLAGS, xtdlg'DLGID ! Outputs: T'FLAGS ! Locals: ! Notes: ! This dialog is so small that I didn't bother with the business of ! defining the fields in the various arrays, although we do make ! some use of the txfdlg'DLG'PARAMS. Note that we use our own local ! copy of EXITCODE to avoid conflicts with main dialog !---------------------------------------------------------------------------------- tbxdlg'MAIN: xcall AUI,AUI_CONTROL,CTLOP_ADD,tbxdlg'DLGID,"XTEXT TXC'TOOLBARMASK Bits", & MBST_ENABLE,MBF_DIALOG+MBF_SYSMENU, & NUL_CMD$,NUL_FUNC$,STATUS,8000,13,20500,58,NUL_FGC,NUL_BGC, & NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$,NUL_TOOLTIP$,xtdlg'DLGID if tbxdlg'DLGID < 1 then xcall EVTMSG,EVL_ERROR,"Unable to create tbxdlg dialog - status = %d",STATUS return endif ! draw a line across bottom xcall AUI,AUI_CONTROL,CTLOP_ADD,NUL_CTLID,NUL_CTEXT$,MBST_ENABLE, & NUL_CTYPE,NUL_CMD$,NUL_FUNC$,NUL_CSTATUS,10,1,10,45, & NUL_FGC,NUL_BGC,NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & NUL_TOOLTIP$,tbxdlg'DLGID, & "STATIC", SS_BLACKRECT+SS_SUNKEN ! create a couple of buttons (OK/CANCEL with icons) xcall AUI,AUI_CONTROL,CTLOP_ADD,XTB'OKID,"check2::ashico1.dll", & MBST_ENABLE,MBF_BUTTON+MBF_ICON+MBF_KBD, & "VK_xF"+str(tbxdlg_FKEY_BASE+1),NUL_FUNC$, & STATUS,11,39,11,41 xcall AUI,AUI_CONTROL,CTLOP_ADD,XTB'OKID,"delete2::ashico1.dll", & MBST_ENABLE,MBF_BUTTON+MBF_ICON+MBF_KBD, & "VK_ESCAPE",NUL_FUNC$, & STATUS,11,42,11,44 ! [103] use VK_ESCAPE ! Set up the XTREE parameters XTB'FLAGS = 0 XTB'FLAGS = XTB'FLAGS or XTF_XYXY ! alt coords (srow,scol,erow,ecol) XTB'FLAGS = XTB'FLAGS or XTF_COLDFX ! complex syntax in COLDEF XTB'FLAGS = XTB'FLAGS or XTF_EDITABLE ! needed for editable cb or text XTB'FLAGS = XTB'FLAGS or XTF_FKEY ! Allow F1-F16 XTB'FLAGS = XTB'FLAGS or XTF_TAB ! TAB (Exitcode -44) XTB'FLAGS = XTB'FLAGS or XTF_SORT ! Allow column sorting XTB'FLAGS = XTB'FLAGS or XTF_REORD ! Allow reordering of columns ! Set up XTRCTL options... XTR'ITEMLINES = 1 ! (max) # lines per row to show (see XTF_VARY) XTR'SHOWGRID = 1 ! show grid lines XTR'GRIDSTYLE = 2 ! solid vertical & horizontal ! 0=vert solid, 1=horz solid, 2=both, ! 3=vert dotted, 4=horz dotted, 5=both XTR'SELECTAREA = XTRSEL_AREA_CELL1T + XTRSEL_STY_CELL1T ! click celltext only, highlight first cell XTR'SCROLLTIPS = 1 ! show scroll tips XTR'FLYBY = 1 ! show flyby highlighting XTR'TRUNCATED = 1 ! show truncation indicators XTR'SHOW3D = 0 XTR'SHOW3D = 0 XTR'OPCODE = XTROP_CREATE XTR'HIDEHEADER = 0 XTR'SHOWBUTTONS0 = 0 ! show exp/collapse buttons (level 0) XTR'SHOWBUTTONS = 0 ! show exp/collapse buttons (level 1+) ! set up coordinates XTB'SROW = 2 XTB'SCOL = 2 XTB'EROW = 9 XTB'ECOL = 44 ! define columns (symbol - checkbox - description) ! map3 XTB'SYMBOL,S,15 ! symbol name ! map3 XTB'VALUE,S,11 ! dec value ! map3 XTB'CB,S,1 ! checkbox column ! map3 XTB'DESCR,S,60 ! description XTB'COLDEF = "1~15~Flag Symbol~S~~16~11~V~H~~27~1~ ~T~~28~80~Description~S~~" !? "toolbarmask: ";TXC'TOOLBARMASK !initialize checkboxes by parsing the input TXC'TOOLBARMASK field... for I = 1 to XTB'MAXSEL ! first retrieve the value from the value column B4 = XTB'VALUE(I) if TXC'TOOLBARMASK and B4 then XTB'CB(I) = "1" !? " ";B4 else XTB'CB(I) = "0" endif next I !STOP ! initialize CB answer array for I = 1 to XTB'MAXSEL XTB'CBX(I) = XTB'CB(I) next I xcall XTREE,XTB'SROW,XTB'SCOL,XTB'ANSWERX,XTB'FLGARY(1),XTB'MAXSEL, & XTB'COLDEF,tbxdlg'EXITCODE,XTB'EROW,XTB'ECOL,XTB'FLAGS,"",MMOCLR,XTRCTL if tbxdlg'EXITCODE # 1 and tbxdlg'EXITCODE # -(txfdlg_FKEY_BASE+2) then ! update TXC'TOOLBARMASK based on new checkbox values ! (these are returned in the CBX array in XTB'ANSWERX) ! otherwise retrieve the updated flags TXC'TOOLBARMASK = 0 for I = 1 to XTB'MAXSEL if XTB'CBX(I) = "1" then TXC'TOOLBARMASK = TXC'TOOLBARMASK or XTB'VALUE(I) endif next I endif xcall AUI,AUI_CONTROL,CTLOP_DEL,tbxdlg'DLGID ! delete dialog return !--------------------------------------------------------------------------------- ! sfxdlg'MAIN ! Supplementary dialog for editing txf'sflags bits. Just for kicks, ! we use XTREE with checkboxes instead of a traditional set of checkboxes ! Inputs: T'FLAGS, xtdlg'DLGID ! Outputs: T'FLAGS ! Locals: ! Notes: ! This dialog is so small that I didn't bother with the business of ! defining the fields in the various arrays, although we do make ! some use of the sfxdlg'PARAMS. Note that we use our own local ! copy of EXITCODE to avoid conflicts with main dialog !---------------------------------------------------------------------------------- sfxdlg'MAIN: xcall AUI,AUI_CONTROL,CTLOP_ADD,sfxdlg'DLGID,"XTEXT TXC'SFLAGS Bits", & MBST_ENABLE,MBF_DIALOG+MBF_SYSMENU, & NUL_CMD$,NUL_FUNC$,STATUS,8000,13,17500,58,NUL_FGC,NUL_BGC, & NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$,NUL_TOOLTIP$,xtdlg'DLGID if sfxdlg'DLGID < 1 then xcall EVTMSG,EVL_ERROR,"Unable to create sfxdlg dialog - status = %d",STATUS return endif ! draw a line across bottom xcall AUI,AUI_CONTROL,CTLOP_ADD,NUL_CTLID,NUL_CTEXT$,MBST_ENABLE, & NUL_CTYPE,NUL_CMD$,NUL_FUNC$,NUL_CSTATUS,7,1,7,45, & NUL_FGC,NUL_BGC,NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & NUL_TOOLTIP$,sfxdlg'DLGID, & "STATIC", SS_BLACKRECT+SS_SUNKEN ! create a couple of buttons (OK/CANCEL with icons) xcall AUI,AUI_CONTROL,CTLOP_ADD,XTB'OKID,"check2::ashico1.dll", & MBST_ENABLE,MBF_BUTTON+MBF_ICON+MBF_KBD, & "VK_xF"+str(tbxdlg_FKEY_BASE+1),NUL_FUNC$, & STATUS,8,39,8,41 xcall AUI,AUI_CONTROL,CTLOP_ADD,XTB'OKID,"delete2::ashico1.dll", & MBST_ENABLE,MBF_BUTTON+MBF_ICON+MBF_KBD, & "VK_ESCAPE",NUL_FUNC$, & STATUS,8,42,8,44 ! [103] use VK_ESCAPE ! Set up the XTREE parameters XTS'FLAGS = 0 XTS'FLAGS = XTS'FLAGS or XTF_XYXY ! alt coords (srow,scol,erow,ecol) XTS'FLAGS = XTS'FLAGS or XTF_COLDFX ! complex syntax in COLDEF XTS'FLAGS = XTS'FLAGS or XTF_EDITABLE ! needed for editable cb or text XTS'FLAGS = XTS'FLAGS or XTF_FKEY ! Allow F1-F16 XTS'FLAGS = XTS'FLAGS or XTF_TAB ! TAB (Exitcode -44) XTS'FLAGS = XTS'FLAGS or XTF_SORT ! Allow column sorting XTS'FLAGS = XTS'FLAGS or XTF_REORD ! Allow reordering of columns ! Set up XTRCTL options... XTR'ITEMLINES = 1 ! (max) # lines per row to show (see XTF_VARY) XTR'SHOWGRID = 1 ! show grid lines XTR'GRIDSTYLE = 2 ! solid vertical & horizontal ! 0=vert solid, 1=horz solid, 2=both, ! 3=vert dotted, 4=horz dotted, 5=both XTR'SELECTAREA = XTRSEL_AREA_CELL1T + XTRSEL_STY_CELL1T ! click celltext only, highlight first cell XTR'SCROLLTIPS = 1 ! show scroll tips XTR'FLYBY = 1 ! show flyby highlighting XTR'TRUNCATED = 1 ! show truncation indicators XTR'SHOW3D = 0 XTR'SHOW3D = 0 XTR'OPCODE = XTROP_CREATE XTR'HIDEHEADER = 0 XTR'SHOWBUTTONS0 = 0 ! show exp/collapse buttons (level 0) XTR'SHOWBUTTONS = 0 ! show exp/collapse buttons (level 1+) ! set up coordinates XTS'SROW = 2 XTS'SCOL = 2 XTS'EROW = 5 XTS'ECOL = 44 ! define columns (symbol - checkbox - description) ! map3 XTB'SYMBOL,S,15 ! symbol name ! map3 XTB'VALUE,S,11 ! dec value ! map3 XTB'CB,S,1 ! checkbox column ! map3 XTB'DESCR,S,60 ! description XTS'COLDEF = "1~15~Flag Symbol~S~Dspwid=8~~16~11~V~H~~27~1~ ~T~~28~80~Description~S~~" !initialize checkboxes by parsing the input TXC'TOOLBARMASK field... for I = 1 to XTS'MAXSEL ! first retrieve the value from the value column B4 = XTS'VALUE(I) if TXC'SFLAGS and B4 then XTS'CB(I) = "1" else XTS'CB(I) = "0" endif next I ! initialize CB answer array for I = 1 to XTS'MAXSEL XTS'CBX(I) = XTS'CB(I) next I xcall XTREE,XTS'SROW,XTS'SCOL,XTS'ANSWERX,XTS'FLGARY(1),XTS'MAXSEL, & XTS'COLDEF,sfxdlg'EXITCODE,XTS'EROW,XTS'ECOL,XTS'FLAGS,"",MMOCLR,XTRCTL if sfxdlg'EXITCODE # 1 and sfxdlg'EXITCODE # -(sfxdlg_FKEY_BASE+2) then ! update TXC'SFLAGS based on new checkbox values ! (these are returned in the CBX array in XTS'ANSWERX) ! otherwise retrieve the updated flags TXC'SFLAGS = 0 for I = 1 to XTS'MAXSEL if XTS'CBX(I) = "1" then TXC'SFLAGS = TXC'SFLAGS or XTS'VALUE(I) endif next I endif xcall AUI,AUI_CONTROL,CTLOP_DEL,sfxdlg'DLGID ! delete dialog return !----------------------------------------------------------------------- ! DO'XTEXT ! Call the XTEXT control ! Inputs: T'XXXX, TXC'xxxx ! Outputs: T'XXXX, TXC'xxxx ! Locals: !----------------------------------------------------------------------- !{XTEXT Call} DO'XTEXT: Debug.print "$# $T xcall XTEXT..." ! (Debug message to main window) ![114] T'AUXTXT set elsewhere now ! if (T'FLAGS and TXF_POPUP) then ! if popup window, set title ! T'AUXTXT = "Popup Text Editor" ! else ! T'AUXTXT = "" ! endif ! [105] if popup & parent=0, then put in upper left corner of screen ! if (((T'FLAGS and TXF_POPUP) # 0)) then ! and TXC'PARENTID = 0) then ! T'SROW = -1 ! T'SCOL = -1 ! T'EROW = -400 ! T'ECOL = -600 ! else ! calculate coordinates to more or less fill up groupbox #3 T'SROW = 2 T'SCOL = 2 T'EROW = xtdlg'GB'EROW(3)-xtdlg'GB'SROW(3) T'ECOL = xtdlg'GB'ECOL(3)-xtdlg'GB'SCOL(3) - 2 ! endif ! [111] Add an animation display while loading if (AVI'FLAG$ = "Y") then ! [111] Start with a centered dialog (note: must use MBF_MODELESS!!!) xcall AUI, AUI_CONTROL, CTLOP_ADD, AVI'DLG'ID, "Please wait...", & MBST_ENABLE+MBST_CENTER, & MBF_DIALOG+MBF_MODELESS, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, 1,1,5,25, & NUL_FGC, NUL_BGC, NUL_FONTATTR, NUL_FONTSCALE, NUL_FONTFACE$, & NUL_TOOLTIP$, xtdlg'DLGID Debug.print "$# $T AVI dialog id = " + AVI'DLG'ID ! [111] Now put the animation inside it xcall AUI, AUI_CONTROL, CTLOP_ADD, AVI'ID, AVI'SPEC$, MBST_ENABLE, & NUL_CTYPE, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, 2, 2, 5, 20, & NUL_FGC, NUL_BGC, NUL_FONTATTR, NUL_FONTSCALE, NUL_FONTFACE$, & NUL_TOOLTIP$, AVI'DLG'ID,"SysAnimate32", ACS_TRANSPARENT+ACS_AUTOPLAY,0 ! [111] sleep to simulate an actual delay while loading.... Debug.print "$# $T Sleeping 2 secs (to simulate slow loading)..." xcall SLEEP,2 ! [111] set the auto-delete flag TXC'DELCTLID = AVI'DLG'ID endif ! Call the XTEXT control ! note that T'xxx and TXTCTL params have been initialized by ! INIT'XTEXT'PARAMS and by the user changing field values via ! the various xtdlg'xxxxx field-level routines. !TXC'MAXBYTES = 100 !TXC'FLAGS8 = &h80000000 ! force ESC to save without asking !TXC'FLAGS8 = &h40000000 ! force ESC to abort without asking if T'FLAGS and TXF_POPUP then T'EROW = 20 ! [115] TXC'HFLAGMASK = &h0001 ! set/clear entire set of gflags1 TXC'HFLAGS1 = &h78006 ! test no head xcall XTEXT,T'OPCODE,T'FLAGS,T'SRC,T'DST, & T'SROW,T'SCOL,T'EROW,T'ECOL,T'EXITCODE,TXTCTL,T'AUXTXT ! [105] ! [XXX] try putting a dialog on top of xtext ! xcall AUI, AUI_CONTROL, CTLOP_ADD, TESTDLG'ID, "Test Dialog", MBST_ENABLE, & ! MBF_DIALOG, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, T'SROW+2,T'SCOL+10,T'EROW+2,T'ECOL+10, & ! NUL_FGC, NUL_BGC, NUL_FONTATTR, NUL_FONTSCALE, NUL_FONTFACE$, & ! NUL_TOOLTIP$, TXC'PARENTID, NUL_WINCLASS$, NUL_WINSTYLE, & ! NUL_WINSTYLEX ! ! [XXX] put a button in it ! xcall AUI, AUI_CONTROL, CTLOP_ADD, 0, "OK", MBST_ENABLE, & ! MBF_BUTTON+MBF_KBD, "VK_ESC", NUL_FUNC$, NUL_CSTATUS, 2,5,3,15, & ! NUL_FGC, NUL_BGC, NUL_FONTATTR, NUL_FONTSCALE, NUL_FONTFACE$, & ! NUL_TOOLTIP$, TESTDLG'ID, NUL_WINCLASS$, NUL_WINSTYLE, & ! NUL_WINSTYLEX ! ! ! xcall AUI, AUI_EVENTWAIT, TESTDLG'ID, 0, EXITCODE, EVW_NEXT ! xcall AUI, AUI_CONTROL, CTLOP_DEL, TESTDLG'ID ! display updated field data... fldid$ = "txc'outbytes" : call xtdlg'DISPLAY'FIELD'BY'NAME fldid$ = "txc'outlines" : call xtdlg'DISPLAY'FIELD'BY'NAME fldid$ = "txc'saveoffset" : call xtdlg'DISPLAY'FIELD'BY'NAME fldid$ = "txc'overflow" : call xtdlg'DISPLAY'FIELD'BY'NAME fldid$ = "txc'modified" : call xtdlg'DISPLAY'FIELD'BY'NAME fldid$ = "txc'xcuroffset" : call xtdlg'DISPLAY'FIELD'BY'NAME fldid$ = "txc'xrow" : call xtdlg'DISPLAY'FIELD'BY'NAME fldid$ = "txc'xcol" : call xtdlg'DISPLAY'FIELD'BY'NAME fldid$ = "t'dst" : call xtdlg'DISPLAY'FIELD'BY'NAME fldid$ = "t'exitcode" : call xtdlg'DISPLAY'FIELD'BY'NAME Debug.print "$# $T rtn from XTEXT: exitcode="+T'EXITCODE return !----------------------------------------------------------------------- ! INIT'XTEXT'PARAMS ! Establish some initial values for the parameters ! Inputs: T'XXXX, TXC'xxxx ! Outputs: T'XXXX, TXC'xxxx ! Locals: ! Notes: ! [105] if XTX1.INI exists, load values from it instead (see ! SAVE'XTEXT'PARAMS for saving them on exit from program) !----------------------------------------------------------------------- INIT'XTEXT'PARAMS: ! initialize the T'xxxx and TXC'xxxx params used to call XTEXT T'OPCODE = TXOP_CREATE T'FLAGS = TXF_FKEY + TXF_TOOLBAR + TXF_FITVIEW + TXF_STATUS & + TXF_MODELESS + TXF_TAB ! [101] T'SRC = "Hello world (this is input text)" T'DST = "" ![105] move this logic to just before actual XCALL ! ! calculate coordinates to more or less fill up groupbox #3 ! T'SROW = 2 ! T'SCOL = 3 ! T'EROW = xtdlg'GB'EROW(3)-xtdlg'GB'SROW(3) - 2 ! T'ECOL = xtdlg'GB'ECOL(3)-xtdlg'GB'SCOL(3) - 4 ![114] T'AUXTXT = "" ! not yet implemented T'AUXTXT = "XTEXT Demo App (XTX1)" ! [114] this should show on popup titles T'EXITCODE = 0 TXC'CTLNO = 0 TXC'KBDSTR = "VK_xF500" TXC'PARENTID = xtdlg'GB'ID(3) ! parent is our groupbox 3 TXC'WRAPWIDTH = 0 TXC'DOCFMT'SRC = TXFF_TEXT TXC'DOCFMT'DST = TXFF_TEXT TXC'OUTBYTES = 0 TXC'OUTLINES = 0 TXC'SAVEOFFSET = 0 TXC'OVERFLOW = 0 TXC'MODIFIED = 0 TXC'FONTFACE = "" TXC'FONTSIZE = 0 TXC'FONTATTR = 0 TXC'XCOL = 0 TXC'XCUROFFSET = 0 TXC'SRCHKEY = "" TXC'SFLAGS = TXSF_SCROLL ! scroll located text into view TXC'CTLID = 0 TXC'DELCTLID = 0 TXC'FLAGMASK = &h0000 ! [106] 0 = additive mode (default) TXC'FLAGS1 = &h02000000 ! [105] show page breaks even in readonly mode TXC'FLAGS2 = &h00010200 ! [105] smooth vertical scroll TXC'FLAGS3 = 0 TXC'FLAGS4 = 0 TXC'FLAGS5 = 0 TXC'FLAGS6 = 0 TXC'FLAGS7 = 0 TXC'FLAGS8 = 0 TXC'FMAPCTL = &h0030 ! f5=search, f6=replace TXC'FMAPAPP = &hFF00 ! f9-f16 exits XTEXT TXC'TOOLBARMASK = TXTB_DFLT_BUF ! default options for no-file mode TXC'FCOLOR = 0 TXC'BCOLOR = 0 TXC'FPROTCLR = 0 TXC'BPROTCLR = 0 TXC'PROTROWS = 0 TXC'TIMEOUT = 0 ![107] TXC'MENUMASK1 = 0 ![117] TXC'MENUMASK2 = 0 ![117] TXC'HFLAGMASK = 0 ![117] TXC'HFLAGS1 = 0 ![117] TXC'HFLAGS2 = 0 ![117] TXC'IDNAME = "xtxTestName" ![110] ! [105] if we have saved params in XTX1.INI, overwrite the defaults if LOOKUP("XTX1.INI") then open #1, "XTX1.INI", input input #1, INIFMT if INIFMT = 1 then input csv #1, T'OPCODE, T'FLAGS !trace.print "inputting "+T'OPCODE+","+T'FLAGS input csv #1, TXC'CTLNO,TXC'KBDSTR,TXC'WRAPWIDTH,TXC'DOCFMT'SRC, & TXC'DOCFMT'DST input csv #1, TXC'FONTFACE,TXC'FONTSIZE,TXC'FONTATTR ! input csv #1, TXC'SFLAGS, TXC'FLAGS1, TXC'FLAGS2, TXC'FLAGS3, & ! TXC'FLAGS4, TXC'FLAGS5, TXC'FLAGS6, TXC'FLAGS7, TXC'FLAGS8 input csv #1, TXC'FMAPCTL,TXC'FMAPAPP,TXC'TOOLBARMASK input csv #1, TXC'FCOLOR, TXC'BCOLOR, TXC'FPROTCLR, TXC'BPROTCLR, & TXC'PROTROWS,TXC'TIMEOUT,TXC'MENUMASK1,TXC'MENUMASK2 ! [107][117] input csv #1, TXC'HFLAGMASK, TXC'HFLAGS1, TXC'HFLAGS2 ! [117] T'SRC = "" PLINE = "" do input line #1, PLINE if PLINE # "." then T'SRC = T'SRC + PLINE loop until PLINE = "." or eof(1)=1 T'DST = "" PLINE = "" do input line #1, PLINE if PLINE # "." then T'DST = T'DST + PLINE loop until PLINE = "." or eof(1)=1 else xcall EVTMSG,"XTX1.INI ini file format (%d) doesn't match program (1) - ignoring", & INIFMT endif close #1 endif !TRACE.PRINT "T'FLAGS = "+T'FLAGS return !----------------------------------------------------------------------- ! SAVE'XTEXT'PARAMS ! Save current param settings so we start with them next time ! Inputs: T'XXXX, TXC'xxxx ! Outputs: XTX1.INI ! Locals: ! Notes: !----------------------------------------------------------------------- SAVE'XTEXT'PARAMS: !trace.print "saving tflags "+T'FLAGS open #1, "XTX1.INI", output ? #1, "1" ! INIFMT writecd #1, T'OPCODE, T'FLAGS writecd #1, TXC'CTLNO,TXC'KBDSTR,TXC'WRAPWIDTH,TXC'DOCFMT'SRC, & TXC'DOCFMT'DST writecd #1, TXC'FONTFACE,TXC'FONTSIZE,TXC'FONTATTR ! writecd #1, TXC'SFLAGS, TXC'FLAGS1, TXC'FLAGS2, TXC'FLAGS3, & ! TXC'FLAGS4, TXC'FLAGS5, TXC'FLAGS6, TXC'FLAGS7, TXC'FLAGS8 writecd #1, TXC'FMAPCTL,TXC'FMAPAPP,TXC'TOOLBARMASK writecd #1, TXC'FCOLOR, TXC'BCOLOR, TXC'FPROTCLR, TXC'BPROTCLR, & TXC'PROTROWS,TXC'TIMEOUT,TXC'MENUMASK1,TXC'MENUMASK2 ![117] writecd #1, TXC'HFLAGMASK, TXC'HFLAGS1, TXC'HFLAGS2 ! [117] print #1, T'SRC print #1, "." ! mark end of SRC (in case multiline) print #1, T'DST print #1, "." ! mark end of SRC (in case multiline) close #1 return !----------------------------------------------------------------------- ! XTEXT'RETRIEVE'BUFFER'CHUNKS ! Call the XTEXT TXOP_SAVE routine as many times as needed to ! get all the remaining text (one buffer at a time) and write it ! to a file XTEXT.BUF. ! Inputs: T'XXXX, TXC'xxxx ! Outputs: XTEXT.BUF, count (# of times called) ! Note: We start saving from beginning of buffer, regardless of ! what the incoming TXC'SAVEOFFSET was. !----------------------------------------------------------------------- XTEXT'RETRIEVE'BUFFER'CHUNKS: open #9001, "XTEXT.BUF", output ![101] print #9001, T'DST; ! this was already output from previous ! call to XTEXT count = 1 T'EXITCODE = 0 TXC'SAVEOFFSET = -1 ! restart from beginning do xcall XTEXT,TXOP_SAVE,T'FLAGS,T'SRC,T'DST, & 2,4,8,50,T'EXITCODE,TXTCTL,T'AUXTXT if T'EXITCODE = 0 then count = count + 1 print #9001,T'DST; endif loop until T'EXITCODE # 0 or TXC'SAVEOFFSET = 0 close #9001 xcall EVTMSG,"Updated text transferred to XTEXT.BUF via %d calls to " & + "XTEXT.SBR, using T'DST as an intermediate buffer. Exitcode = %d", & count,T'EXITCODE ! update these fields on screen... fldid$ = "t'exitcode" : call xtdlg'DISPLAY'FIELD'BY'NAME fldid$ = "txc'saveoffset" : call xtdlg'DISPLAY'FIELD'BY'NAME fldid$ = "txc'overflow" : call xtdlg'DISPLAY'FIELD'BY'NAME return !----------------------------------------------------------------------- ! XTEXT'ERR'MSG ! Set error message for XTEXT.SBR ! Inputs: T'EXITCODE, MSG$ ! Outputs: MSG$ ! Locals: !----------------------------------------------------------------------- XTEXT'ERR'MSG: if T'EXITCODE >= 90 then MSG$ = MSG$ + " (Error: " endif if T'EXITCODE = 99 then MSG$ = MSG$ + "Error loading/linking the TER13.DLL)" endif if T'EXITCODE = 98 then MSG$ = MSG$ + "Invalid TXC'CTLNO; no such control)" endif if T'EXITCODE = 97 then MSG$ = MSG$ + "Unable to create the XTEXT control)" endif if T'EXITCODE = 96 then MSG$ = MSG$ + "Unable to load/save text into/from control)" endif if T'EXITCODE = 95 then MSG$ = MSG$ + "Unable to allocate memory for XTEXT buffer)" endif if T'EXITCODE = 94 then MSG$ = MSG$ + "Fatal conflict with TXC'DELCTLID)" endif return !----------------------------------------------------------------------- ! LOAD'FIELD'DATA ! Load all of the field parameters used in this program. ! ! (In a more formal programming environment, these data might be ! loaded externally from files, or perhaps auto-generated, but ! to make this same program as self-contained as possible, we ! just embed it all in data statements) ! ! Inputs: ! Outputs: ! xtdlg'CX'ARRAY() - main dialog (xtdlg) control array ! xtdlg'CTLCNT - # of controls in CX'ARRAY ! xtdlg'EXITCODE'FIRST- first exitcode in array ! xtdlg'EXITCODE'LAST - last exitcode in array ! xtdlg'GROUPBOXES() - group boxes used in xtdlg ! INFLD'ARRAY() - all INFLD field defs (referenced by CX'ARRAY) ! GENCTL'ARRAY() - all general control defs (ref'd by CX'ARRAY) ! Locals: ! I, J, F,ID$, FTYP$, GRP, TABNO, TB$ !----------------------------------------------------------------------- LOAD'FIELD'DATA: call LOAD'INFLD'DATA ! get all INFLD field data call LOAD'GENCTL'DATA ! get all AUI_CONTROL field data call xtdlg'LOAD'GB'DATA ! get xtdlg groupboxes call xtdlg'LOAD'FIELD'ARRAY ! get xtdlg field array call LOAD'XTREE'XTEXT'FLAGS'DATA ! get xtree data for xtext flags dlg call LOAD'XTREE'XTEXT'TBMASK'DATA ! get xtree data for xtext toolbarmask dlg call LOAD'XTREE'XTEXT'SFLAGS'DATA ! [102] get xtree data for sflags dlg return !----------------------------------------------------------------------- ! Define all of the INFLD fields for the program ! (and load them into the master INFLD'ARRAY) ! id$,max,min,type,prompt,tooltip !----------------------------------------------------------------------- !{Data-INFLD zone} data "INFLD" ! identify start of INFLD data (make sure we're synced) data "t'opcode",10,0,"#","Opcode:","Main text editing operation code" data "t'flags",8,0,"||hZ","Flags:","Options (hex bits); hit ? for help" data "t'src",36,0,"A","Src (src type):","Source filespec or text (based on txc'docfmt'src)" ![111] data "avi'flag",20,0,"YN||c||b","","Illustrate use of an AVI control to show activity while XTEXT is loading" data "txc'ctlno",3,1,"#-","Txc'ctlno:","Relative XTEXT control # (0-4)" data "txc'parentid",3,0,"#-","Txc'parentid:","Control ID of XTEXT parent (0=main window, -1=floating)" data "txc'kbdstr",11,0,"A","Txc'kbdstr:","Keyboard click sequence (e.g. VK_xF901)" data "txc'wrapwidth",4,0,"#","Txc'wrapwidth:","Wrap width in characters (0 for none or control width)" data "txc'docfmt'src",4,0,"||hZ","Txc'docfmt'src:","Src format (txt vs rtf, file vs buffer)" data "txc'docfmt'dst",4,0,"||hZ","Txc'docfmt'dst:","Dst format (txt vs rtf, file vs buffer)" data "txc'outbytes",7,0,"#","Txc'outbytes:","# of bytes in updated text" data "txc'outlines",7,0,"#","Txc'outlines:","# of lines in updated text" data "txc'saveoffset",7,0,"#","Txc'saveoffset:","offset to next byte to save" data "txc'overflow",1,0,"YN","Txc'overflow:","Did output overflow the destination buffer?" data "txc'modified",1,0,"YN","Txc'modified:","Was text modified?" data "txc'fontface",16,0,"A","Txc'fontface:","" data "txc'fontsize",3,0,"-#","Txc'fontsize:","In points (or negative for twips)" data "txc'fontattr",8,0,"#?","Txc'fontattr:","? for help" data "txc'xrow",6,0,"#","Txc'xrow:","Cursor row on exit" data "txc'xcol",6,0,"#","Txc'xcol:","Cursor col on exit" data "txc'xcuroffset",6,0,"#","Txc'xcuroffset:","Cursor abs offset within text exit" data "txc'srchkey",12,0,"A","Txc'srchkey:","String to search for" data "txc'sflags",4,0,"||hZ","Txc'sflags:","Flags affecting search" data "txc'fmapctl",8,0,"||hZ","Txc'fmapctl:","Hex bitmap of F keys to send to control" data "txc'fmapapp",8,0,"||hZ","Txc'fmapapp:","Hex bitmap of F keys to send to app (requires TXF_FKEY)" data "txc'toolbarmask",8,0,"||hZ","Txc'toolbarmask:","Hex bitmap of toolbar icons to exclude (if TXF_TOOLBAR set)" data "txc'fcolor",8,0,"||hZ","Txc'fcolor:","RGB text color (in hex, using 10bbrrgg format)" data "txc'bcolor",8,0,"||hZ","Txc'bcolor:","RGB bg color (in hex, using 10bbrrgg format)" data "txc'fprotclr",8,0,"||hZ","Txc'fprotclr:","RGB protected text color (in hex, using 10bbrrgg format)" data "txc'bprotclr",8,0,"||hZ","Txc'bprotclr:","RGB protected text bg color (in hex, using 10bbrrgg format)" data "txc'protrows",4,0,"#-","Txc'protrows:","# of protected rows (-1 = all, -2 = all but last, etc.)" data "txc'timeout",4,0,"#","Txc'timeout:","Inactivity timeout (ms) (sets EXITCODE=11)" data "txc'menumask1",8,0,"||hZ","Txc'menumask1:","Menu removal flags (if TXF_POPOP+TXC_MENU)" data "txc'menumask2",8,0,"||hZ","2:","Menu removal flags (if TXF_POPOP+TXC_MENU)" data "txc'hflagmask",4,0,"||hZ","Txc'hflagmask:","Mask controlling how hflags interpreted" data "txc'hflags1",8,0,"||hZ","Txc'hflags1:","HTML flags" data "txc'hflags2",8,0,"||hZ","2:","HTML flags" data "t'exitcode",5,0,"#","Exitcode:","Return value" data "t'dst",36,0,"A","Dst (dst type):","Destination (filespec or actual data based on txc'docfmt'out)" data "" LOAD'INFLD'DATA: ! make sure we are in sync with data... read ID$ if ID$ # "INFLD" then xcall EVTMSG,EVL_ERROR, & "Unable to load INFLD data: sync error (%s)",ID$ End endif I = 0 do read ID$ !? "[";ID$;"]"; !? I; if ID$#"" then I = I + 1 if I > MAX_INFCTLS then xcall MSGBOX,"Exceeded max # of INFLD fields","XTX1 Error", & MBTN_OK,MBICON_STOP,MBMISC_TASKMODAL,MRC else IX'ID$(I) = ID$ read IX'XMAX(I),IX'XMIN(I), & IX'TYPE$(I),IX'PROMPT$(I),IX'TOOLTIP$(I) !? I;IX'XMAX(I);IX'XMIN(I);IX'PROMPT$(I) endif endif loop until ID$ = "" return !----------------------------------------------------------------------- ! Define all of the AUI_CONTROL fields for the program ! (and load them into the master GENCTL'ARRAY) ! id$,width,height,text,type,tip ! type: B=button, BI=button w/ icon, SL=static text lftjst, K=kbd ! fno,width,height,text,type,tip !----------------------------------------------------------------------- data "GENCTL" data "btn'tflags",1,2,"edit::ashico1.dll",BIK,"Click to display flags detail dialog" data "btn'xtext",1,10,"Xcall XTEXT",BK,"Execute XTEXT control with current params" data "btn'exit",1,10,"Exit",BK,"Exit program" data "btn'docfmt'src",1,2,"help::ashico1.dll",BIK,"Info on docfmt'src options" data "btn'docfmt'dst",1,2,"help::ashico1.dll",BIK,"Info on docfmt'dst options" data "btn'xrow",1,2,"help::ashico1.dll",BIK,"Info on xrow, xcol, xcuroffset fields" data "btn'srchkey",1,2,"help::ashico1.dll",BIK,"Info on searching" data "btn'sflags",1,2,"edit::ashico1.dll",BIK,"Click to set search flags" data "btn'tbmask",1,2,"edit::ashico1.dll",BIK,"Click to display mask detail dialog" data "btn'fcolor",1,2,"help::ashico1.dll",BIK,"Click for color format explanation" data "btn'bcolor",1,2,"help::ashico1.dll",BIK,"Click for color format explanation" data "btn'fprotclr",1,2,"help::ashico1.dll",BIK,"Click for color format explanation" data "btn'bprotclr",1,2,"help::ashico1.dll",BIK,"Click for color format explanation" data "btn'xferdst",1,15,"Copy Dst to Src",BK,"" data "" LOAD'GENCTL'DATA: ! make sure we are in sync with data... read ID$ if ID$ # "GENCTL" then xcall EVTMSG,EVL_ERROR, & "Unable to load GENCTL data: sync error (%s)",ID$ End endif I = 0 do read ID$ if ID$ # "" then I = I + 1 !? "[";ID$;"],I=";I; if I > MAX_GENCTLS then xcall MSGBOX,"Exceeded max # of General Controls","XTX1 Error", & MBTN_OK,MBICON_STOP,MBMISC_TASKMODAL,MRC else GX'ID$(I) = ID$ read GX'HEIGHT(I),GX'WIDTH(I),GX'TEXT$(I),FTYP$,GX'TOOLTIP$(I) ! convert abbreviated type codes into CTYPE param GX'CTYPE(I) = 0 if instr(1,FTYP$,"B") > 0 then GX'CTYPE(I) = GX'CTYPE(I) or MBF_BUTTON if instr(1,FTYP$,"I") > 0 then GX'CTYPE(I) = GX'CTYPE(I) or MBF_ICON endif if FTYP$[1,1]="S" then GX'CTYPE(I) = GX'CTYPE(I) or MBF_STATIC if FTYP$[2,2]="L" then GX'CTYPE(I) = GX'CTYPE(I) or MBF_LFJUST if FTYP$[1,1]="R" then GX'CTYPE(I) = GX'CTYPE(I) or MBF_RTJUST endif if instr(1,FTYP$,"K") > 0 then GX'CTYPE(I) = GX'CTYPE(I) or MBF_KBD !? GX'HEIGHT(I);GX'WIDTH(I);GX'TEXT$(I);FTYP$;GX'TOOLTIP$(I),GX'CTYPE(I) endif endif loop until ID$ = "" return !----------------------------------------------------------------------- ! groupbox definitions ! gb#,title,srow,scol,erow,ecol ! Note: since these are purely display/organizational, they ! are not part of the field definitions; but they must be ! defined before the CX array because it references groups ! by number. !----------------------------------------------------------------------- ![110] Add names data "xtdlg-GB" data 1,"gbMain","Main Parameters",2,2,10,54 data 2,"gbTxtctl","TXTCTL Fields",2,56,31,90 data 3,"gbXTEXT","Text Control",12,2,20,54 data 4,"gbDestination","Destination, Status Fields",22,2,30,54 data 0 xtdlg'LOAD'GB'DATA: ! make sure we are in sync with data... read ID$ if ID$ # "xtdlg-GB" then xcall EVTMSG,EVL_ERROR, & "Unable to load xtdlg GB data: sync error (%s)",ID$ End endif do read I if I>0 then !? I if I > xtdlg_MAX_GB then xcall MSGBOX,"Exceeded max # of Group boxes","XTX1 Error", & MBTN_OK,MBICON_STOP,MBMISC_TASKMODAL,MRC I = 0 else read xtdlg'GB'ID$(I), xtdlg'GB'TITLE(I), xtdlg'GB'SROW(I), & xtdlg'GB'SCOL(I), xtdlg'GB'EROW(I), xtdlg'GB'ECOL(I) ! [110] xtdlg'GBCNT = I endif endif loop until I = 0 return !----------------------------------------------------------------------- ! Form/dialog field definitions. These establish the order and location ! of all the display controls on the form, except for groupboxes, which ! must be defined above displayed controls. ! Controls that do not get the focus do not ! have T in the type and can be in any position in list. The ! idx field links this table to the INFLD and CONTROL tables ! where the remaining params are . ! grp, id$, srow, scol, type-idx, tab-state ! (type: I=infld, C=control, X=xtree, T=text editor) ! (tab-state: t if tabstop, d=disable, - for neither) !----------------------------------------------------------------------- data "xtdlg-MAIN" data 1,t'opcode,2,15,I,t data 1,t'flags,2,40,I,t data 1,btn'tflags,2,50,C,t data 1,t'src,3,15,I,t ![111] insert avi'flag data 1,avi'flag,7,15,I,t data 1,btn'xtext,8,16,C,t data 1,btn'exit,8,30,C,t data 2,txc'ctlno,2,11,I,t data 2,txc'parentid,2,30,I,t data 2,txc'kbdstr,3,11,I,t data 2,txc'wrapwidth,4,11,I,t data 2,txc'docfmt'src,5,11,I,t data 2,btn'docfmt'src,5,17,C,t data 2,txc'docfmt'dst,6,11,I,t data 2,btn'docfmt'dst,6,17,C,t ! field is output only, so disable (d) data 2,txc'outbytes,7,11,I,td data 2,txc'outlines,8,11,I,td data 2,txc'saveoffset,9,11,I,t data 2,txc'overflow,10,11,I,td data 2,txc'modified,10,30,I,td data 2,txc'fontface,11,11,I,t data 2,txc'fontsize,12,11,I,t data 2,txc'fontattr,13,11,I,t data 2,txc'xrow,14,11,I,t data 2,btn'xrow,14,19,C,t data 2,txc'xcol,15,11,I,t data 2,txc'xcuroffset,16,11,I,t data 2,txc'srchkey,17,11,I,t data 2,btn'srchkey,17,24,C,t data 2,txc'sflags,18,11,I,t data 2,btn'sflags,18,21,C,t data 2,txc'fmapctl,19,11,I,t data 2,txc'fmapapp,20,11,I,t data 2,txc'toolbarmask,21,11,I,t data 2,btn'tbmask,21,21,C,t data 2,txc'fcolor,22,11,I,t data 2,btn'fcolor,22,21,C,t data 2,txc'bcolor,23,11,I,t data 2,btn'bcolor,23,21,C,t data 2,txc'fprotclr,24,11,I,t data 2,btn'fprotclr,24,21,C,t data 2,txc'bprotclr,25,11,I,t data 2,btn'bprotclr,25,21,C,t data 2,txc'protrows,26,11,I,t ![107] data 2,txc'timeout,26,30,I,t data 2,txc'menumask1,27,11,I,t data 2,txc'menumask2,27,26,I,t data 2,txc'hflagmask,28,11,I,t data 2,txc'hflags1,29,11,I,t data 2,txc'hflags2,29,26,I,t data 4,t'exitcode,2,15,I,t data 4,t'dst,3,15,I,t data 4,btn'xferdst,6,15,C,t data -1 ! end of table xtdlg'LOAD'FIELD'ARRAY: ! make sure we are in sync with data... read ID$ if ID$ # "xtdlg-MAIN" then xcall EVTMSG,EVL_ERROR, & "Unable to load xtdlg-MAIN data: sync error (%s)",ID$ End endif I = 0 TABNO = 0 do read GRP if GRP>=0 then I = I + 1 !? "GRP=";GRP;I if I > xtdlg_MAX_CTLS then xcall MSGBOX,"Exceeded max # of xtdlg controls","XTX1 Error", & MBTN_OK,MBICON_STOP,MBMISC_TASKMODAL,MRC GRP = -1 else read ID$,xtdlg'CX'SROW(I),xtdlg'CX'SCOL(I), & FTYP$,TB$ xtdlg'CX'GRP(I) = GRP ! parse out the FTYP$ param xtdlg'CX'FTYP$(I) = FTYP$[1,1] ! assign a tab stop # if this is a tabstop control if TB$[1,1]="t" then TABNO = TABNO + 10 xtdlg'CX'TABNO(I) = TABNO endif if instr(1,TB$,"d") > 0 then xtdlg'CX'BITS(I) = xtdlg'CX'BITS(I) or MBST_DISABLE endif ! link this to the corresponding INFLD or AUI_CONTROL item ! by scanning for a name match J = 1 if xtdlg'CX'FTYP$(I)="I" then ! INFLD do while J <= MAX_INFCTLS if IX'ID$(J) = ID$ exit else J = J + 1 endif loop if J > MAX_INFCTLS then xcall EVTMSG,EVL_ERROR, & "Unable to locate control '%s' in INFLD array",ID$ End endif endif if xtdlg'CX'FTYP$(I)="C" then ! AUI_CONTROL do while J <= MAX_GENCTLS if GX'ID$(J) = ID$ exit else J = J + 1 endif loop if J > MAX_GENCTLS then xcall EVTMSG,EVL_ERROR, & "Unable to locate control '%s' in GENCTL array",ID$ End endif endif xtdlg'CX'IDX(I) = J xtdlg'CX'ID$(I) = ID$ !? I;xtdlg'CX'GRP(I),xtdlg'CX'ID$(I),xtdlg'CX'SROW(I),xtdlg'CX'SCOL(I),xtdlg'CX'FTYP$(I),xtdlg'CX'IDX(I) endif endif loop until GRP < 0 !STOP xtdlg'CTLCNT = I ! field count xtdlg'EXITCODE'FIRST = -(xtdlg_FKEY_BASE + 1) xtdlg'EXITCODE'LAST = xtdlg'EXITCODE'FIRST - xtdlg'CTLCNT return !----------------------------------------------------------------------- ! Load the definition params for a single screen field, so that ! we can then pass them to INFLD or AUI_CONTROL. In this version, ! we just pull the details out of one of the arrays which were loaded ! en masse at the start of the program. ! Input: ! cx (field #) ! Output: ! INF'xxxx or AUI'xxxx params for specified field ! fldtyp$ (I=infld, C=AUI_CONTROL) !-DLG CX array params... ! map2 xtdlg'CX'GRP,B,1 ! map2 xtdlg'CX'ID$,S,16 ! field ID (links to INFLD,other arrays) ! map2 xtdlg'CX'SROW,B,1 ! map2 xtdlg'CX'SCOL,B,1 ! map2 xtdlg'CX'FTYP$,S,1 ! field type: I=INFLD, C=Control, X=Xtree, T=Text ! map2 xtdlg'CX'IDX,B,1 ! index into array for field type ! map2 xtdlg'CX'TABNO,B,2 ! tab # (0 if not a tab-stop control) ! map2 xtdlg'CX'BITS,B,4 ! misc options bits (0x0001 = disable) ! map2 xtdlg'CX'CTLID,B,2 ! control id # !-INFLD array params... ! map2 IX'ID$,S,16 ! field ID (links to ID$ in CX array) ! map2 IX'XMAX,B,1 ! map2 IX'XMIN,B,1 ! map2 IX'TYPE$,S,50 ! map2 IX'PROMPT$,S,30 ! map2 IX'TOOLTIP$,S,100 !-GENCTL array params... ! map2 GX'ID$,S,12 ! field ID (links to ID$ in CX array) ! map2 GX'HEIGHT,B,1 ! map2 GX'WIDTH,B,1 ! map2 GX'TEXT$,S,60 ! MAP2 GX'CTYPE,B,4 ! map2 GX'TOOLTIP$,S,100 ! Uses: ! i,ix,gx !----------------------------------------------------------------------- xtdlg'GET'FIELD'PARAMS'BY'FLDNUM: ! store the exitcode value associated with this field (useful below ! and in the field-level routines) xtdlg'EXITCODE'THIS = -(xtdlg_FKEY_BASE+cx) if xtdlg'CX'FTYP$(cx) = "I" then ! INFLD field ix = xtdlg'CX'IDX(cx) INF'ROW = xtdlg'CX'SROW(cx) INF'COL = xtdlg'CX'SCOL(cx) INF'XMAX = IX'XMAX(ix) INF'XMIN = IX'XMIN(ix) INF'TYPE = IX'TYPE$(ix) + "]|G||C135T||Tg|Ke`" ![110] INF'V = 1 + xtdlg'GB'ID(xtdlg'CX'GRP(cx)) ![110] INF'VF = 1 + xtdlg'GB'ID(xtdlg'CX'GRP(cx)) ![110] INF'V = INF'VF ! to avoid string concat INF'V = xtdlg'GB'ID$(xtdlg'CX'GRP(cx)) + ">" + IX'ID$(ix) ! [110] INF'OPCODE = iop INF'TIMER = 0 INF'DEFPT = -1 INF'MAXPT = -1 INF'FUNMAP = -1 INF'HLPIDX = ">"+IX'TOOLTIP$(ix)+"~VK_xF"+str(-(xtdlg'EXITCODE'THIS)) INF'SETDEF = "" INF'MAXCHRS = 0 if xtdlg'CX'BITS(cx) and MBST_DISABLE then INF'CMDFLG = INFCF_DISABLE else INF'CMDFLG = 0 endif endif if xtdlg'CX'FTYP$(cx) = "C" then ! AUI_CONTROL field gx = xtdlg'CX'IDX(cx) AUI'OPCODE = CTLOP_ADD AUI'SROW = xtdlg'CX'SROW(cx) AUI'SCOL = xtdlg'CX'SCOL(cx) AUI'EROW = AUI'SROW + GX'HEIGHT(gx) - 1 AUI'ECOL = AUI'SCOL + GX'WIDTH(gx) - 1 AUI'CSTATE = xtdlg'CX'BITS(cx) and &h0FF AUI'CTYPE = GX'CTYPE(gx) AUI'CTEXT$ = GX'TEXT$(gx) AUI'CMD$ = "VK_xF" + str(-(xtdlg'EXITCODE'THIS)) AUI'FUNC$ = NUL_FUNC$ AUI'FGC = NUL_FGC AUI'BGC = NUL_BGC AUI'FONTATTR = NUL_FONTATTR AUI'FONTSCALE = NUL_FONTSCALE AUI'FONTFACE$ = NUL_FONTFACE$ AUI'TOOLTIP$ = GX'TOOLTIP$(gx) AUI'PARENTID = xtdlg'GB'ID(xtdlg'CX'GRP(cx)) AUI'WINCLASS$ = NUL_WINCLASS$ AUI'WINSTYLE = NUL_WINSTYLE AUI'WINSTYLEX = NUL_WINSTYLEX endif return !----------------------------------------------------------------------- ! Variation of xtdlg'GET'FIELD'PARAMS'BY'FLDNUM which works by field ! name. This is useful when you can to call a single field routine from ! a context where you don't know its number. ! Input: ! fldid$ (field name) ! Output: ! INF'xxxx or AUI'xxxx params for specified field ! fldtyp$ (I=infld, C=AUI_CONTROL) !----------------------------------------------------------------------- xtdlg'GET'FIELD'PARAMS'BY'FLDNAME: call xtdlg'FIND'FIELD if cx then call xtdlg'GET'FIELD'PARAMS'BY'FLDNUM else xcall EVTMSG,EVL_ERROR,"Unable to locate field by name (%s)",fldid$ goto ABORT endif return !----------------------------------------------------------------------- ! Routine to display a field by it's name; designed for convenient use ! from within another field-level routine. ! Input: ! fldid$ (field name) ! T'xxxxx (field var must be set, so it can be loaded in field rtn) ! Output: ! Note: ! Saves/restores EXITCODE so as to not foul up dialog field order !----------------------------------------------------------------------- xtdlg'DISPLAY'FIELD'BY'NAME: save'exitcode = EXITCODE call xtdlg'GET'FIELD'PARAMS'BY'FLDNAME iop = INFOP_DISPLAY call xtdlg'DO'FIELD ! update DST edit field based on dialog EXITCODE = save'exitcode return !----------------------------------------------------------------------- ! Variation of above routine that doesn't force display mode ! from within another field-level routine. ! Input: ! iop (INFLD opcode) ! fldid$ (field name) ! T'xxxxx (field var must be set, so it can be loaded in field rtn) ! Output: ! Note: ! Saves/restores EXITCODE so as to not foul up dialog field order !----------------------------------------------------------------------- xtdlg'DO'FIELD'BY'NAME: save'exitcode = EXITCODE call xtdlg'GET'FIELD'PARAMS'BY'FLDNAME call xtdlg'DO'FIELD ! update DST edit field based on dialog EXITCODE = save'exitcode return !----------------------------------------------------------------------- ! This routine locates a field by name in the CX array. ! It is needed in order to directly call a field level routine ! if you don't have the cx value in hand (such as when one field ! calls another). This is because the field level routines use the ! incoming cx value to find their own parameters in the CX array. ! Input: ! fldid$ ! xtdlg'CTLCNT ! Output: ! cx (0 if not found) ! Uses: ! i !----------------------------------------------------------------------- xtdlg'FIND'FIELD: cx = 0 i = 1 do while cx = 0 and i <= xtdlg'CTLCNT i = i + 1 if xtdlg'CX'ID$(i) = fldid$ then cx = i endif loop if (cx = 0) then xcall EVTMSG,EVL_ERROR,"Cannot locate field (%s) in xtdlg CX array!",fldid$ endif return !----------------------------------------------------------------------- !XTREE data for XTEXT flags bits: value,chk,symbol,description !----------------------------------------------------------------------- data "XTR-XTX-FLAGS" data 1, 00000001,0,"TXF_FKEY","Function keys F1-F32 exit (exitcode -1 thru -32); see txc'fmapapp" data 2, 00000002,0,"TXF_LEFT","Left arrow exits (exitcode -40)" data 3, 00000004,0,"TXF_RIGHT","Right arrow exits (exitcode -41)" data 4, 00000008,0,"TXF_UP","Up arrow or shift-TAB exits (exitcode -42)" data 5, 00000020,0,"TXF_TAB","TAB exits (exitcode -44)" data 6, 00000040,0,"TXF_HOME","HOME exits (exitcode -45)" data 7, 00000080,0,"TXF_END","END exits (exitcode -46)" data 8, 00000100,0,"TXF_ENTESC","ENTER exits (exitcode 0)" data 9, 00000200,0,"TXF_MODELESS","Modeless (leave text control on screen when inactive)" data 10,00000400,0,"TXF_EOT","Start editing with cursor at end of text" data 11,00000800,0,"TXF_DEFERSAVE","Defer saving text" data 12,00002000,0,"TXF_HSCROLL","Horizontal scroll bar" data 13,00004000,0,"TXF_VSCROLL","Vertical scroll bar" data 14,00008000,0,"TXF_RULER","Display ruler" data 15,00010000,0,"TXF_STATUS","Display status bar" data 16,00020000,0,"TXF_TOOLBAR","Display toolbar" data 17,00040000,0,"TXF_READONLY","Read only" data 18,00080000,0,"TXF_POSCUR","Set initial cursor pos to txc'xcuroffset" data 19,00200000,0,"TXF_DISABLE","Disable text control when inactive" data 20,00400000,0,"TXF_DEL","DEL key exits (exitcode -47)" data 21,00800000,0,"TXF_MARGIN","Show margin space around page border" data 22,01000000,0,"TXF_NOCLICKOUT","No click out of field" data 23,02000000,0,"TXF_WRAP","Word wrap" data 24,04000000,0,"TXF_PRINTVIEW","Wrap as it would print with current printer setup" data 25,08000000,0,"TXF_PAGEMODE","Single page mode" data 26,10000000,0,"TXF_FITVIEW","Wrap based on control display width" data 27,20000000,0,"TXF_POPUP","Let edit control float as a popup window" data 28,40000000,0,"TXF_DLGNOCREEP","Pop coords relative to main window, not dlg" data 29,80000000,0,"TXF_MENU","Full version of editor, with menu" data 0 LOAD'XTREE'XTEXT'FLAGS'DATA: ! Must set hex in order to handle hex conversions for flags if HEXON = 0 then HEXON = 1 xcall MIAMEX,MX_SETHEX,HEXON endif ! make sure we are in sync with data... read ID$ if ID$ # "XTR-XTX-FLAGS" then xcall EVTMSG,EVL_ERROR, & "Unable to load XTR-XTX-FLAGS: sync error (%s)",ID$ End endif do read I if I>0 then if I > MAX_XFPFLAGS then xcall EVTMSG,EVL_ERROR, & "Exceeded max # of TXF'FLAGS fields (I=%d,max=%d)",I,MAX_XFPFLAGS I = 0 else read HEX$,XFP'CB(I),XFP'SYMBOL(I),XFP'DESCR(I) xcall MIAMEX,MX_GTHEX,HEX$,B4 XFP'VALUE(I) = B4 using "###########" XFP'SYMBOL(I) = XFP'SYMBOL(I) + space(15) XFP'MAXSEL = XFP'MAXSEL + 1 endif endif loop until I = 0 return !----------------------------------------------------------------------- !XTREE data for XTEXT txc'toolbarmask bits: symbol,chk,value,description !----------------------------------------------------------------------- data "XTR-XTX-TBMASK" data 1, "TXTB_ROW1 ",0,00000001,"rmv entire 1st row of toolbar" data 2, "TXTB_NEW ",0,00000002,"remove File|New button" data 3, "TXTB_OPEN ",0,00000004,"remove File|Open button" data 4, "TXTB_SAVE ",0,00000008,"remove File|Save button" data 5, "TXTB_PRINT ",0,00000010,"remove File|Print button" data 6, "TXTB_PREVIEW ",0,00000020,"remove File|Preview button" data 7, "TXTB_CLIPBOARD",0,00000040,"remove Cut/Copy/Paste buttons" data 8, "TXTB_UNDOREDO ",0,00000080,"remove Undo/Redo buttons" data 9, "TXTB_FIND ",0,00000100,"remove Search (binoculars) button" data 10,"TXTB_DATE ",0,00000200,"remove insert date button" data 11,"TXTB_PAGENUM ",0,00000400,"remove insert page # button" data 12,"TXTB_PAGECOUNT",0,00000800,"remove insert page count button" data 13,"TXTB_SHOWMARKS",0,00001000,"remove show marks (eg para) button" data 14,"TXTB_HELP ",0,00002000,"remove help button" data 15,"TXTB_ZOOM ",0,00004000,"remove zoom dropdown" data 16,"TXTB_ROW2 ",0,00010000,"remove 2nd row of toolbar" data 17,"TXTB_STYLE ",0,00020000,"remove paragraph style dropdown" data 18,"TXTB_FONTFACE ",0,00040000,"remove typeface dropdown" data 19,"TXTB_POINTSIZE",0,00080000,"remove pointsize dropdown" data 20,"TXTB_CHARATTR ",0,00100000,"remove bold/ital/uline buttons" data 21,"TXTB_ALIGN ",0,00200000,"remove alignment buttons" data 22,"TXTB_NUMLIST ",0,00400000,"remove numbered list button" data 23,"TXTB_BULLETS ",0,00800000,"remove bullet list button" data 24,"TXTB_INDENT ",0,01000000,"remove indent buttons" data 0 LOAD'XTREE'XTEXT'TBMASK'DATA: ! Must set hex in order to handle hex conversions for flags if HEXON = 0 then HEXON = 1 xcall MIAMEX,MX_SETHEX,HEXON endif ! make sure we are in sync with data... read ID$ if ID$ # "XTR-XTX-TBMASK" then xcall EVTMSG,EVL_ERROR, & "Unable to load XTR-XTX-TBMASK: sync error (%s)",ID$ End endif do read I if I>0 then if I > MAX_XTBMASK then xcall EVTMSG,EVL_ERROR, & "Exceeded max # of TXF'TOOLBARMASK fields (I=%d,max=%d)",I,MAX_XTBMASK I = 0 else read XTB'SYMBOL(I),XTB'CB(I),HEX$,XTB'DESCR(I) xcall MIAMEX,MX_GTHEX,HEX$,B4 ! convert to decimal XTB'VALUE(I) = B4 using "###########" ! and format to fill field XTB'SYMBOL(I) = XTB'SYMBOL(I) + space(15) !XFP'VALUE(I) = F using "###########" XTB'MAXSEL = XTB'MAXSEL + 1 endif endif loop until I = 0 return !----------------------------------------------------------------------- !XTREE data for XTEXT txc'sflags bits: symbol,chk,value,description [102] !----------------------------------------------------------------------- data "XTR-XTX-SFLAGS" data 1,"TXSF_SCROLL" ,0,00000001,"Scroll located text into view" data 2,"TXSF_CASE " ,0,00000010,"Case sensitive search" data 3,"TXSF_WORD " ,0,00000020,"Locate whole word matches only" data 4,"TXSF_BACK " ,0,00000080,"Search backwards" data 5,"TXSF_EXIT " ,0,00001000,"Exit immediately after search" data 0 LOAD'XTREE'XTEXT'SFLAGS'DATA: ! Must set hex in order to handle hex conversions for flags if HEXON = 0 then HEXON = 1 xcall MIAMEX,MX_SETHEX,HEXON endif ! make sure we are in sync with data... read ID$ if ID$ # "XTR-XTX-SFLAGS" then xcall EVTMSG,EVL_ERROR, & "Unable to load XTR-XTX-SFLAGS: sync error (%s)",ID$ End endif do read I if I>0 then if I > MAX_XTSFLAGS then xcall EVTMSG,EVL_ERROR, & "Exceeded max # of TXF'SFLAGS fields (I=%d,max=%d)",I,MAX_XTSFLAGS I = 0 else read XTS'SYMBOL(I),XTS'CB(I),HEX$,XTS'DESCR(I) xcall MIAMEX,MX_GTHEX,HEX$,B4 ! convert to decimal XTS'VALUE(I) = B4 using "###########" ! and format to fill field XTS'SYMBOL(I) = XTS'SYMBOL(I) + space(15) XTS'MAXSEL = XTS'MAXSEL + 1 endif endif loop until I = 0 return ! Dummy function to return arg (to test function stack issues) Function Fn'Ident(A) Fn'Ident = A End Function