program XTRA2,1.0(124) ! test/demo XTREE.SBR array/multicolumn !-------------------------------------------------------------------- ! XTRA2.BAS ! ! Demonstrate/test XTREE.SBR array, multi-column, multi-level ! (parent/child rows), using advanced column definition syntax. !-------------------------------------------------------------------- ! EDIT HISTORY ![100] June 20, 2004 11:22 AM Edited by Jack ! Created from XTREE; expanded to demonstrate columns ![101] June 27, 2004 01:16 PM Edited by jack ! Add another column, more rows ![103] July 09, 2004 10:52 AM Edited by Jack ! Copied from PCKARY, upgrade to use new COLDEF$, EXPCTL ![104] July 17, 2004 01:22 PM Edited by Jack ! Add Amount & Date columns for more testing ![105] August 28, 2004 03:24 PM Edited by Jack ! Add dialog box option ![106] August 30, 2004 10:36 PM Edited by Jack ! Add multi-select option, add Select All, Clear All buttons ![107] September 01, 2004 10:08 PM Edited by Jack ! Add MBF_SYSMENU option to dialog ![108] February 27, 2005 09:19 AM Edited by Jack ! Added a context (right click) menu ![109] April 27, 2005 05:10 PM Edited by Jack ! Show returned XTR'XROW, XTR'XCOL values (valid when ! context menu used to exit, as of 4.9.928.2) ![110] May 13, 2005 04:25 AM Edited by Jack ! Add a totals line (test new XTF'TOTALS flag); switch ! to new style of symbols. ![111] April 18, 2006 07:19 PM Edited by joaquin ! Use new row bg color feature to make the top level rows ! have different background colors ![112] April 19, 2006 08:40 PM Edited by joaquin ! Add column-specific popupmenus, increase COLDEF$ size ![113] September 11, 2006 06:02 PM Edited by joaquin ! Add a timeout option ![114] October 04, 2006 05:04 PM Edited by joaquin ! Try Mask= option ![115] November 06, 2006 05:04 PM Edited by joaquin ! Adjust column order so that hidden columns (multilevel, font, ! color) are not defined first (working around tendency of XTREE ! to mysteriously make the first column visible) ![116] November 30, 2006 06:24 PM Edited by joaquin ! Add grid counters along the top; update symbols, ++includes !{Edit History} ! ! 10-06-2009 --- 124 --- Jack McGregor ! Support extended Title and Footer (added in 1160.8) /jdm ! ! 07-21-2009 --- 123 --- Jack McGregor ! Adjust flags to support XTF2_xxx flags; test with printing landscape /jdm ! ! 12-10-2008 --- 122 --- Jack McGregor ! Add code Title= ! ! 10-07-2008 --- 121 --- Jack McGregor ! Add code to XTRCTL initialization to use symbols, illustrate ! new options (XTR'SEARCHMODE) ! ! 20-02-2008 --- 120 --- Jack McGregor ! Add print button (for 5.1) ! ! 15-08-2007 --- 119 --- Jack McGregor ! Misc. cleanup. Move MMOCLR to XTREE.MAP. ! ! 14-03-2007 --- 118 --- Jack McGregor ! Allow dialog to be maximized ! ! 28-12-2006 --- 117 --- Jack McGregor ! Add CtlName= to test assigning a name to a control (977.6+) ! !-------------------------------------------------------------------- ++pragma ERROR_IF_NOT_MAPPED "ON" ! (avoid stupid unmapped symbol errors) ++include ashinc:XTREE.MAP ++include ashinc:XTREE.DEF ++include ashinc:ashell.def ! [116] define DLG_NAME$ = "dlgXTREE2" map1 MISC map2 I,F map2 EXITCODE,F map2 MAXCHOICE,F,6 map2 SROW,F map2 SCOL,F map2 EROW,F map2 ECOL,F map2 PROMPT,S,120 map2 ID,B,2 ![123] map2 XTFLAGS,F,6 map2 XTFLAGS'X ! [123] map3 XTFLAGS,B,4 ! [123] map3 XTFLAGS2,B,4 ! [123] map2 MLVL$,S,1 map2 DLG$,S,1 map2 MSEL$,S,1 ! [106] map2 STATUS,F map2 COLDEF$,S,1200 ! column definitions [112] map2 DLGID,B,2 ! [105] map2 DSROW,F ! [105] dialog box coords map2 DSCOL,F map2 DEROW,F map2 DECOL,F map2 BID,B,2 map2 STATE,F ! [106] map2 TOTAL,F ! [110] map2 INXCTL,F define MAX_ITEMS = 100 ! max items in our example map1 XTREE'DATA(MAX_ITEMS),S,140 ! XTREE data array map1 ANSWERX ! ANSWERX may be used now for either: map2 ANSARY(MAX_ITEMS),S,1 ! multi-selection map1 ANSWER,B,4,@ANSWERX ! or single selection map1 ANSWER$,S,100,@ANSWERX ! (convenient string format for display) ! sample array data ! !This first line would serve as column definition in the simple column mode, !but we are going to use the advanced column definition system instead. !(See COLDEF$ assignment) !data "Zip City State Country Amount Date Comments" ! 12345678901234567890123456789012345678901234567890123456789012345678901234567890 data "0 A (Colorado cities) Colorado USA 98123.45 04/01/2004" data "1 80501 Longmont Colorado USA -0.01 12/15/2003 Once home of AMUS" data "1 81615 Snowmass Village Colorado USA 9999.99 01/15/1999 An alpine village, much lower key than Vail" data "0 B (CA cities) California USA 001.33 10/10/1899" data "1 91355 Canoga Park California USA -876.00 06/30/2004 West San Fernando Valley" data "1 91367 Woodland Hills California USA -15.88 09/09/2001 Home of MicroSabio" data "1 95834 Sacramento California USA 10000.01 11/30/2000 Capital of California" data "1 92660 Newport Beach California USA 99999.02 01/13/2003 Upscale seaside town, site of Alpha Micro Dealer meetings" data "1 91406 San Luis Obispo California USA 8765.32 07/04/2004 Home of Alpha Pacific, Ty Griffin, Cal Poly" data "1 94080 San Francisco California USA 32.11 02/29/1992 A place to leave your heart" data "0 C (Other states) Other States USA .09 12/01/1995" data "1 20903 Silver Spring Maryland USA 312.55 04/30/2004 Not sure who lives here" data "1 98366 Port Orchard Washington USA -922.55 08/15/1999 Out on the peninsula" data "1 72118 North Little Rock Arkansas USA 1000.11 10/11/1995" data "1 3900 Mexico City D.F. DMexico 8.88 03/21/2001 One of the smoggiest cities in the world" data "1 20837 Poolsville Maryland USA 17.17 05/02/2004 What kind of pools are they talking about?" data "1 3113 Manila EPhillipi 87234.32 12/31/1999" data "1 62903 Carbondale Illinois USA 6212.66 09/09/2001" data "1 SG85AQRoyston Hertfordshire FEngland 100.00 01/01/2001 Horse Country" data "1 37133 Murfreesboro Tennessee USA 7122.44 08/15/2002" data "1 84127 Salt Lake City Utah USA -123.45 06/05/2003 Gateway to Moab" data "1 M5H1L3Toronto Ontario DCanada 822.55 08/30/2004" data "1 Epernay Champagne FFrance 5245.51 01/22/1998" data "1 Taipei Taiwan ER.O.C. 711.87 05/31/2004" !++ifdef NEVER data "1 V9N246Courtenay B.C. DCanada -8787.22 08/01/2004" data "1 36124 Montgomery Alabama USA -11.99 04/02/2000 Home of Lexicom" data "1 00911 San Juan Puerto Rico USA 1500.15 11/22/2001" data "1 Tarragona FSpain 762.44 09/01/2004 South of Barcelona, where Tarragon comes from?" data "1 06320 New London Connecticutt USA 87878.22 06/22/2000" data "1 75004 Paris Isle de France FFrance 9898.33 08/01/2004 Ah ouí, la ville de lumière" data "1 San Jose Del Cabo Baja Sur DMexico 111.33 01/29/1999 Once a sleepy fishing village, now Miami West" data "1 33441 Deerfield Beach Florida USA 0.01 04/04/1994 Home of AlphaMed" data "1 Isla Mujeres Yúcatan DMexico -44.99 11/01/2000" data "1 S7K2M2Saskatoon Saskatchewan DCanada 12344.55 06/30/1999" data "1 44301 Nantes Loire FFrance 762.44 08/15/2002 Home of Disposelec" data "1 35L3H3Edmonton Alberta DCanada 17.17 03/21/2001" data "1 85705 Tucson Arizona USA 711.87 01/22/1998" data "1 96813 Honolulu Hawaii USA -11.99 05/02/2004" data "1 75961 Nacogdoches Texas USA 12344.55 04/02/2002" data "1 PE45DGPeterborough Werring FEngland 711.87 03/21/2001" data "1 71107 Shreveport Louisiana USA 822.55 01/22/1998" data "1 G8Z4H1Trois-Rivières Québec DCanada -11.99 01/22/1998 Moitié entre Montréal et Vieux Québec" data "1 41012 Carpi Modena FItaly 0.01 06/20/1999" data "1 50003 Zaragoza FSpain .09 03/21/2001" data "1 89104 Las Vegas Nevada USA 12344.55 05/02/2004" !++endif data "01E Totals 999999.99 " ![110] data "" I = 0 DATALOOP: do I = I + 1 read XTREE'DATA(I) loop until I >= MAX_ITEMS or XTREE'DATA(I)="" DATADONE: MAXCHOICE = I-1 ![110] compute a total to illustrate special handling of totals lines TOTAL = 0 for I = 1 to MAXCHOICE-1 TOTAL = TOTAL + VAL(XTREE'DATA(I)[52;9]) next I XTREE'DATA(MAXCHOICE)[52;9] = TOTAL using "######.##" ! [106] clear multi-select array for I = 1 to MAX_ITEMS ANSARY(I)="0" next I ! initialize some program options MLVL$ = "N" ! Multi-level DLG$ = "Y" ! Dialog MSEL$ = "N" ! Multi-select XLOOP: ? tab(-1,0);"Test XCALL XTREE - Complex columns, multi-level, multi-sel options" ! prompt for program options (this is tacky, but allows us to focus on ! what we are trying to demonstrate ? "Multi Level Option? [";MLVL$;"] ?"; input "",MLVL$ ? "Dialog frame? [";DLG$;"] ?"; ! [105] input "",DLG$ ? "Multi-Select? [";MSEL$;"] ?"; ! [106] input "",MSEL$ ? "Timeout (ms): ? "; ! [113] input "",XTR'TIMEOUT ! [113] ? tab(-1,28); ! turn cursor off call Setup'Xtree'Params(COLDEF$,XTFLAGS,SROW,SCOL,EROW,ECOL,XTRCTL,MLVL$,MSEL$) ! [105] Display some controls that will be overlaid ! [105] by the XTREE to see how the layering works TPRINT tab(SROW+2,1);"Sample background message" TPRINT tab(SROW+3,ECOL-5);"Sample background message" xcall AUI,AUI_CONTROL,CTLOP_ADD,BID,"Calculator"+chr(13)+"line2",0, & MBF_CMDLIN+MBF_WRAP, "calc.exe","",STATUS,SROW-1,1,SROW+1,15 ! [105] if dialog option, load a dialog first, then put xtree in it if ucs(DLG$)="Y" then DLGID = FN'Create'Dialog(DLG_NAME$,SROW,SCOL,EROW,ECOL,MSEL$) ! [119] endif ! XTFLAGS = XTFLAGS and not XTF_MODELESS ! ! XTFLAGS = XTFLAGS or XTF_NOSEL ! XTR'OPCODE = XTROP_PRINT ! [123] print (without prior display) XTR'OPCODE = XTROP_CREATE ! [123] normal mode XTFLAGS2 = XTF2_LANDSCAPE ! [123] force landscape printing XLOOP2: ! [120] ! [106] chg ANSWER to ANSWERX... xcall XTREE,SROW,SCOL,ANSWERX,XTREE'DATA(1),MAXCHOICE,COLDEF$,EXITCODE, & EROW,ECOL,XTFLAGS'X,"",XTREE'MMOCLR,XTRCTL ! [120] chg XTFLAGS to XTFLAGS'X if EXITCODE=-501 then ! [120] print XTR'OPCODE = XTROP_PRINT xcall XTREE,SROW,SCOL,ANSWERX,XTREE'DATA(1),MAXCHOICE,COLDEF$,EXITCODE, & EROW,ECOL,XTFLAGS'X,"",XTREE'MMOCLR,XTRCTL ! [120] XTR'OPCODE = XTROP_RESELECT goto XLOOP2 endif ! [107] Note that clicking on dialog X to close it will ! [107] send an ESC which will force XTREE to exit, so we don't ! [107] need any special test for ESC. if ucs(DLG$)="Y" then ! [105] remove the dialog box xcall AUI,AUI_CONTROL,CTLOP_DEL,DLG_NAME$ else XTR'OPCODE = XTROP_DELETE ! [120] manually delete XTREE xcall XTREE,SROW,SCOL,ANSWERX,XTREE'DATA(1),MAXCHOICE,COLDEF$,EXITCODE, & EROW,ECOL,XTFLAGS,"",XTREE'MMOCLR,XTRCTL endif ! display some output results on the main window ? tab(-1,29); ! turn cursor back on ? tab(15,1); if ucs(MSEL$)#"Y" then ! [106] ? "ANSWER = ";ANSWER; if ANSWER>0 then ? " (";XTREE'DATA(ANSWER);") " else ? "ANSWER = ";ANSWER$ endif ? "EXITCODE = ";EXITCODE ? "XTR'COLUMNACTIVE: ";XTR'COLUMNACTIVE; & ", XTR'XROW: ";XTR'XROW;", XTR'XCOL: ";XTR'XCOL ! [109] ? "XTR'COLUMNSORT/SORTORDER: "; for I = 1 to 3 ? str(XTR'COLUMNSORT(I));"/";str(XTR'SORTORDER(I));" "; next I ? STOP goto XLOOP !------------------------------------------------------------------------- !Procedure: Setup'Xtree'Params(coldef$, xtflags, srow, scol, erow, ecol, mlvl$, msel$) ! Setup several of the XTREE parameters !Parameters: ! coldef$ [s2000, out] Column definition string ! xtflags [b4, out] flags ! srow,scol,erow,ecol [b2, out] coordinates ! mlvl$ [y/n, in] Multi-select option ! msel$ [y/n, in] Multi-select option !Returns: ! coldef$, xtflags !Globals: ! Information about the column layout (needed to set up coldef$) !Error handling: ! none !Notes: ! This routine would have to be customized for every XTREE. ! One weakness of the procedure model here is that we don't really ! know how big the coldef$ string is going to have to be. But, since ! this routine would have to be customized for every XTREE anyway, ! there is no particular harm in setting the size after determining ! it (manually). But, the calling program would also need some way ! to know how big to map it. DIMX would be one approach, but for now, ! we'll just assume that 2000 is large enough and don't worry about waste. !------------------------------------------------------------------------- Procedure Setup'Xtree'Params(coldef$ as s2000, xtflags as b4, & srow as b2, scol as b2, erow as b2, ecol as b2, & xtrctl as x128, mlvl$ as s1, msel$ as s1) ++include ashinc:xtree.map ! local copy ! Define the columns. Note that you don't have to match the layout ! of the data, and should be able to eliminate a column just by ! commenting out the corresponding line below coldef$ = "" ![115] Move this hidden column definition down past the first visible column ![115] (otherwise an XTREE quirk may decide to make it visible) ! if ucs(MLVL$)="Y" then ! Multi-level ! coldef$ = coldef$ + "1~1~ ~@H~~" ! Special column with dummy "x" title ! endif ! [111] Define a set of background RGB colors that we can use for rows coldef$ = coldef$ + "0~0~xr~H~RGBbg=210,230,250,A~~" coldef$ = coldef$ + "0~0~xs~H~RGBbg=230,250,210,B~~" coldef$ = coldef$ + "0~0~xt~H~RGBbg=250,210,230,C~~" ! [111] and a few more to use for individual cell highlighting coldef$ = coldef$ + "0~0~xu~H~RGBbg=141,243,92,D~~" coldef$ = coldef$ + "0~0~xv~H~RGBbg=92,141,243,E~~" coldef$ = coldef$ + "0~0~xw~H~RGBbg=243,92,141,F~CtlName=xtrTest~~" ! [117] assign name coldef$ = coldef$ + "0~0~xr~H~RGBbgSel=200,200,255~RGBfgSel=120,0,80~~" coldef$ = coldef$ + "0~0~xr~H~RGBbgEven=255,255,235~RGBbgOdd=183,255,183~~" ! [xxx] coldef$ = coldef$ + "0~0~xr~H~DefaultScale=140~~" ! [108] Context menu defined as a dummy column (using offset,width 0,0) ! [108] (Column title & type ignored, but shouldn't be null) ! [108] Format is PopupMenu=text,cmd;text,cmd;....text,cmd~~ ! [108] (cmd should be a 'virtual key sequence' (e.g %VK_xF501%) coldef$ = coldef$ + "0~0~ ~SH~PopupMenu=" & + "Retire,VK_xF501;Visit,VK_xF502;Pass Through,VK_xF503;-----,;" & + "Attack,VK_xF504~~" ! [110] define a header font (bold, 125%) coldef$ = coldef$ + "0~0~xa~H~HdrFont=Arial Black,2048~HdrScale=120~~" ! [110] define a special font (associated with a null column) to reference later coldef$ = coldef$ + "0~0~xb~H~Font=Arial Black,2048~Scale=125~TreeID=XTRA2~~" ! [122] Add a title (for printing only) ![124] (date is default for left title) ! coldef$ = coldef$ + "0~0~x~H~Title=This is a Sample Title~~" ![124] Left|Right ! coldef$ = coldef$ + "0~0~x~H~Title=Sample Left Title|Sample Right Title~~" ![124] Left|Center|Right coldef$ = coldef$ + "0~0~x~H~Title=Sample Left Title|Center Title|Sample Right Title~~" ![124] Footer= (page # is default for right footer) ! coldef$ = coldef$ + "0~0~x~H~Footer=This is a Sample Footer~~" ![124] Left|Right ! coldef$ = coldef$ + "0~0~x~H~Footer=Sample Left Footer|Sample Right Footer~~" ![124] Left|Center|Right coldef$ = coldef$ + "0~0~x~H~Footer=Sample Left Footer|Center Footer|Sample Right Footer~~" ! zip starts in 4th char of data; 5 chars wide, title="Zip", ! string format, Keep in 1st column, left justify, set up ! custom fg and bg colors, don't allow column to be shrunk below 5 coldef$ = coldef$ + "4~5~Zip~SK<~RGBfg=200,50,100~~" ! "~Dspwid=5~~" ! + "RGBbg=180,180,235~Dspmin=5~~" ! [115] Define the hidden columns after the first visible column... if ucs(mlvl$)="Y" then ! Multi-level coldef$ = coldef$ + "1~1~ ~@H~~" ! Special column with dummy "x" title endif ! move these hidden columns after the first visible one ! [110] define the column to be used to specify the font (references fonts just defined) coldef$ = coldef$ + "2~1~xc~Hf~~" ! [111] define the column to be used to specify the row BG color coldef$ = coldef$ + "3~1~xd~Hb~~" ! city starts in pos 10, 18 wide, string format, center justify ! wrap, allow overflow into next column coldef$ = coldef$ + "10~18~City Name~S|WO~Scale=125~~" ! state starts in pos 29, 15 wide, string, right justify, allow ! overflow of previous column into this one ! [112] Add a popupmenu which is specific to this row (states) ! [112] but which is appended to shared popup menu (+) coldef$ = coldef$ + "29~15~State/Province~S>o~" & + "PopupMenu=+-------,;Run for governor,%VK_xF505%;" & + "Check state tax rates,%VK_xF506%;" & + "Find state capital,%VK_xF507%~~" ! country starts in pos 45, 9 wide, string ! [111] first char is a bg color index ! [112] Add a popup menu which is specific to this row (countries) ! [112] This one replaces the shared popup menu (no +) coldef$ = coldef$ + "45~9~Country~SB~" & + "PopupMenu=Obtain passport,%VK_xF508%;Recall ambassador,%VK_xF509%~~" ! coldef$ = coldef$ + "45~9~Country~HSB~~" ! experiment ! amount starts in pos 54, 9 wide, numeric format, right justify coldef$ = coldef$ + "54~9~Amount~#>~Mask=###,###.##~~" ! [114] ! date starts in pos 64, 10 wide, date format MM/DD/{CC}YY coldef$ = coldef$ + "64~10~Date~D~~" ! date ! comments start pos 74, 50 wide, string, allow wrap, overflow coldef$ = coldef$ + "74~50~Comments~SWO~~" ! comments ! Set up (hard-code) xtflags xtflags = 0 ! These first two are mandatory for this program... xtflags = xtflags or XTF_XYXY ! alt coords (srow,scol,erow,ecol) xtflags = xtflags or XTF_COLDFX ! complex syntax in coldef$ ! Remaining xtflags are optional - you can experiment with them xtflags = xtflags or XTF_TOTALS ! [110] last line of data is a totals line xtflags = xtflags or XTF_FKEY ! Allow F1-F16 xtflags = xtflags or XTF_LEFT ! Left arrow (Exitcode -40) xtflags = xtflags or XTF_RIGHT ! Right arrow (Exitcode -41) xtflags = xtflags or XTF_UP ! Up arrow (Exitcode -42) xtflags = xtflags or XTF_TAB ! TAB (Exitcode -44) xtflags = xtflags or XTF_HOME ! Right arrow (Exitcode -45) xtflags = xtflags or XTF_END ! Right arrow (Exitcode -46) xtflags = xtflags or XTF_MODELESS ! Leave box on screen after exit xtflags = xtflags or XTF_TIMOUT ! 200 sec timeout (auto ESC) xtflags = xtflags or XTF_SORT ! Allow column sorting xtflags = xtflags or XTF_REORD ! Allow reordering of columns xtflags = xtflags or XTF_VARY ! Vari. ht rows (see XTR'ITEMLINES) if ucs(msel$)="Y" then xtflags = xtflags or XTF_MSEL ! [106] multi-select endif ! Set up XTRCTL options... XTR'ITEMLINES = 2 ! (max) # lines per row to show (see XTF_VARY) XTR'SHOWGRID = 1 ! show grid lines ! [121]... ! XTR'GRIDSTYLE = XTRGRID_VERT ! solid vert (default=0) ! XTR'GRIDSTYLE = XTRGRID_HORZ ! solid horz XTR'GRIDSTYLE = XTRGRID_BOTH ! solid vert + horz ! XTR'GRIDSTYLE = XTRGRID_VERT_DOT ! dotted vert + horz ! XTR'GRIDSTYLE = XTRGRID_HORT_DOT ! dotted vert + horz ! XTR'GRIDSTYLE = XTRGRID_BOTH_DOT ! dotted vert + horz ! [121]... ! default=0 (click anywhere on item, sel bar covers item) XTR'SELECTAREA = XTRSEL_AREA_ANY ! XTR'SELECTAREA = XTRSEL_AREA_CELLS ! all cells ! XTR'SELECTAREA = XTRSEL_AREA_CELL1 ! first cell ! XTR'SELECTAREA = XTRSEL_AREA_CELL1T ! first cell text ! set selection bar style ! XTR'SELECTAREA = XTR'SELECTAREA or XTRSEL_STY_ALL ! entire item ! XTR'SELECTAREA = XTR'SELECTAREA or XTRSEL_STY_CELLS ! all cells ! XTR'SELECTAREA = XTR'SELECTAREA or XTRSEL_STY_CELL1 ! 1st cell ! XTR'SELECTAREA = XTR'SELECTAREA or XTRSEL_STY_CELL1T ! 1st cell text XTR'SELECTAREA = XTR'SELECTAREA or XTRSEL_STY_ALL_GRD ! item (outline/gradiant) ! XTR'SELECTAREA = XTR'SELECTAREA or XTRSEL_STY_CELLS_GRD ! cells (outline/gradiant) ! XTR'SELECTAREA = XTR'SELECTAREA or XTRSEL_STY_CELL1_GRD ! 1st cell (outline/gradiant) ! keep selection bar active during editing ! XTR'SELECTAREA = XTR'SELECTAREA or XTRSEL_EDIT_KEEP ! [121] char search mode ! XTR'SEARCHMODE = XTRSRCH_TOP_ALL ! (0=dflt) from top, all items, all chars ! XTR'SEARCHMODE = XTRSRCH_TOP_ONE ! one char, all items, from top ! XTR'SEARCHMODE = XTRSRCH_NONE ! no search ! XTR'SEARCHMODE = XTRSRCH_TOP_ALLX ! like TOP_ALL but skip collapsed deps ! XTR'SEARCHMODE = XTRSRCH_TOP_ONEX ! like TOP_ONE but " " ! XTR'SEARCHMODE = XTRSRCH_NXT_ONE ! like TOP_ONE but start from cur itm, wrap ! XTR'SEARCHMODE = XTRSRCH_NXT_ONEX ! like TOP_ONEX but " " " XTR'SEARCHMODE = XTRSRCH_NXT_ALL ! like TOP_ALL but start from cur itm ! XTR'SEARCHMODE = XTRSRCH_NXT_ALLX ! like NXT_ALL but skip collapsed deps XTR'COLUMNACTIVE = 4 ! make city column the active one (for search) XTR'SCROLLTIPS = 1 ! show scroll tips XTR'FLYBY = 1 ! show flyby highlighting XTR'TRUNCATED = 1 ! show truncation indicators ! XTR'SHOWBUTTONS0 = 1 ! show exp/collapse buttons (level 0) ! XTR'SHOWBUTTONS = 1 ! show exp/collapse buttons (level 1+) XTR'USRCFG = XTUCFG_ALL ! save all configurable params ! set up coordinates srow = 10 scol = 10 erow = 20 ecol = 60 ! return the updated params xputarg 1,coldef$ xputarg 2,xtflags xputarg 3,srow xputarg 4,scol xputarg 5,erow xputarg 6,ecol xputarg 7,XTRCTL End Procedure !------------------------------------------------------------------------- !Function: Fn'Create'Dialog(dlgname$,srow,scol,erow,ecol,msel$) ! Create a dialog to display the sample xtree in !Parameters: ! dlgname$ [string, in] - name/id of dialog ! srow,scol,erow,ecol [b2, in] - coordinates of desired xtree ctl ! msel$ [y/n, in] Multi-select option !Returns: ! Numeric dialog id (<=0 on error) ! Also updates the srow,scol,erow,ecol params !Globals: ! none !Error handling: ! none !Notes: !------------------------------------------------------------------------- Function FN'Create'Dialog(dlgname$ as s24, srow as b2, scol as b2, & erow as b2, ecol as b2, msel$ as s1) as b2 map1 locals map2 dsrow,b,2 map2 dscol,b,2 map2 derow,b,2 map2 decol,b,2 map2 cstatus,f map2 i,f map2 cstate,b,4 map2 prompt$,s,100 map2 verstr$,s,28 ! [120] map2 vmajor,b,1 ! [120] map2 vminor,b,1 ! [120] ! make Dialog box occupy similar (but larger) space as XTREE dsrow = (srow - 2) max 2 dscol = (scol - 2) max 2 derow = (erow + 4) min 23 decol = (ecol + 2) min 79 srow = 2 ! adjust xtree coords to be relative to dialog scol = 3 erow = derow-dsrow-4 ecol = decol-dscol-2 ! Below we have 3 versions of the dialog ! Version of dialog with maximize button xcall AUI,AUI_CONTROL,CTLOP_ADD,dlgname$,"XTREE Dialog Box", & MBST_ENABLE,MBF_DIALOG+MBF_SYSMENU+MBF_MAXBUTTON+MBF_ALTPOS, & NUL_CMD$,NUL_FUNC$,cstatus,dsrow,dscol,derow,decol ! Version with just the sysmenu ! xcall AUI,AUI_CONTROL,CTLOP_ADD,DLGID,"XTREE Dialog Box", & ! MBST_ENABLE,MBF_DIALOG+MBF_SYSMENU+MBF_ALTPOS, & ! NUL_CMD$,NUL_FUNC$,cstatus,dsrow,dscol,derow,decol !maximized version (with no maximize button or sysmenu) ... ! xcall AUI,AUI_CONTROL,CTLOP_ADD,DLGID,"XTREE Dialog Box", & ! MBST_ENABLE+MBST_MAXIMIZE,MBF_DIALOG+MBF_ALTPOS, & ! NUL_CMD$,NUL_FUNC$,cstatus,dsrow,dscol,derow,decol ! cstatus will return the numeric ID of the dialog (<=0 if error) FN'Create'Dialog = cstatus ! (return value of the dialog) if (cstatus > 0) then ! and add a couple of buttons just for fun ! (note: we don't care about button ids so we just use the NUL_CTLID, NUL_CSTATUS xcall AUI,AUI_CONTROL,CTLOP_ADD,NUL_CTLID,"OK",MBST_ENABLE, & MBF_BUTTON+MBF_KBD,"VK_ENTER",NUL_FUNC$,NUL_CSTATUS, & erow+2,3,erow+3,10 xcall AUI,AUI_CONTROL,CTLOP_ADD,NUL_CTLID,"Cancel",0, & MBF_BUTTON+MBF_KBD,"VK_ESCAPE","",NUL_CSTATUS, & erow+2,13,erow+3,20 ! [106] add buttons for select all, clear all if ucs(msel$)="Y" then cstate=MBST_ENABLE else cstate=MBST_DISABLE xcall AUI,AUI_CONTROL,CTLOP_ADD,NUL_CTLID,"&Select All",cstate, & MBF_BUTTON+MBF_KBD,"^A","",NUL_CSTATUS,erow+2,23,erow+3,30 xcall AUI,AUI_CONTROL,CTLOP_ADD,NUL_CTLID,"&Clear All",cstate, & MBF_BUTTON+MBF_KBD,"^B","",NUL_CSTATUS,erow+2,33,erow+3,40 ! [120] Add a Print option (enable only for 5.1 though) xcall MIAMEX, MX_GETVER, verstr$, vmajor, vminor if (vmajor*10+vminor) < 51 then cstate = MBST_DISABLE else cstate = MBST_ENABLE endif xcall AUI,AUI_CONTROL,CTLOP_ADD,NUL_CTLID,"&Print",cstate, & MBF_BUTTON+MBF_KBD,"VK_xF501","",NUL_CSTATUS,erow+2,43,erow+3,50 ! display row #'s of dialog (just to help visualize the "grid") ! note that tprint will automatically output to current dialog for i = 1 to (derow-dsrow+1) tprint tab(i,1);str(i); next i ! display column #'s across the top (again, just to visualize the grid) prompt$ = "" for i = 5 to 100 prompt$ = prompt$ + str(i mod 10) next i tprint tab(derow-dsrow+1,5);prompt$; ! [116] display column grid along the top ! [116] using 75% scaled characters for i = 5 to 65 step 5 xcall AUI,AUI_CONTROL,CTLOP_ADD,NUL_CTLID,str(i),MBST_ENABLE, & MBF_STATIC,NUL_CMD$,NUL_FUNC$,cstatus,1,i,1,i+1, & NUL_FGC,NUL_BGC,NUL_FONTATTR,75,NUL_FONTFACE$, & NUL_TOOLTIP$,dlgname$ next i endif ! update the coordinate parameters (in addition to the return value of function) xputarg 2,srow xputarg 3,scol xputarg 4,erow xputarg 5,ecol End Function