home *** CD-ROM | disk | FTP | other *** search
Wrap
<BookPath> :HDMEDIAPATH System 1, #> MTB40DLG.DLL TB40DOS.DLL fName c:\mtb40\samples\ getFileList sortTextlines TB40DLG.DLL fScript *.tbk MTB40DOS.DLL wsortTextlines getFileList buttonClick TO HANDLE buttonClick ZLONG i ZSTRING f,fl,p linkDLL "TB40DOS. "getFileList( GsortTextlines( p = "c:\mtb40\samples\" f = p & "*.tbk" fl = fl = --trap "fName" = "fScript" = (p &( unlinkDLL "MTB40DLG. fname fscript fscript CDBSE&File &Open... Ctrl+O &Save Ctrl+S Save &As... saveas &Import... import &Export... export Print Set&up... printsetup &Print Pages... Ctrl+P printpages Prin&t Report... printreport Send &Mail... sendmail &Run... E&xit Alt+F4 &Edit &Undo Ctrl+Z Cu&t Ctrl+X &Copy Ctrl+C &Paste Ctrl+V paste C&lear Del clear Select &All Shift+F9 selectall Select Pa&ge Shift+F12 selectpage &Size to Page F11 sizetopage F&ind... F5 Re&place... replace Aut&hor F3 author &Text &Character... F6 character &Paragraph... F7 paragraph &Regular Ctrl+Space regular &Bold Ctrl+B &Italic Ctrl+I italic &Underline Ctrl+U underline Stri&keout Ctrl+K strikeout Superscrip&t/Subscript superscriptSubscript &Normal Script normalscript Su&bscript Ctrl+L subscript Su&perscript Ctrl+Shift+L superscript &Show Hotwords F9 showhotwords &Page &Next Alt+Right &Previous Alt+Left previous &First Alt+Up first &Last Alt+Down &Back Shift+F2 &History... Ctrl+F2 history N&ew Page Ctrl+N newpage &Help &Contents F1 contents Status &Bar F12 statusbar `E`3! filename NSTALL LOG MOUSE UTOEXECB~K ONFIG B~K PMACLAN5 NSTALL TMP ONFIG 1 UTOEXEC1 ONFIG 2 UTOEXEC2 UTOEXEC3 PMACLAN VO DIALOG.TBK DIALOG.TBK Transfer ge id 8 Button Field ge id 8 page "button page" page "Field page" unlinkDLL "MTB30DLG. field page button page splunge field page this is some text button page transfer --TO HANDLE buttonClick <> NULL "f2"= --END Transfer --TO HANDLE buttonClick <> NULL "f2"= --END goats 12790 stoats buttonClick TO HANDLE buttonClick ZINT x,y 4STRING z[4][2] x = 122 y = (525 - x) * 4 z[1][1] = "12790" z[1][2] = "cats" z[2][1] = "34" z[2][2] = "bats" z[3][1] = 455 z[3][2] = "stoats" z[4][1] = "9765" z[4][2] = "goats" <> NULL "f2"= uttonClick TO HANDLE buttonClick <> NULL "f2"= enterBackground leaveBackground TO HANDLE = 70,105 = 70,160 isOpen close [ToolBook] startupSysBooks=C:\MTB30\mtb30.sbk startupAutoScriptFile= splunged Entry: *ClassTbl* *ClassEntry* *PTABLE* *WINDOWSEG* *ICONRESTAB* *ICONRESSEG* *ICONRES* Background *OBJTABLE* *IDTABLE* *NAMETAB* Rectangle Ellipse RoundedRectangle Polygon IrregularPolygon AngledLine Curve PaintObject Picture Group Stage Button Viewer ComboBox Field RecordField Hotword *RHOTWORD* *TbxBase* <BookPath> :HDMEDIAPATH System ame" to menu "contents" at author with helptext\ "Changes name of current chapter." add menuitem "" to menu "contents" at author add menuitem "New &Topic..." to menu "contents" at author with helptext\ "Adds new topic to this chapter." add menuitem "Change To&pic Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of topic chapter." add menuitem "Using this &Template" alias "helpTemplate" to menu "help" position 2 at author with helptext\ "Displays help on using this template." if firstTime of this book is not false open viewer "outline" send rebuildStructure firstTime of this book = false end if not animSysbookLoaded() request "The path animation sysbook is not loaded. Animations in the ""Path Animation"" sections will not run. Be sure that either mtb30.sbk or mtb30ani.sbk are included in your startupSysbooks." hide button "help" of page "toolbar" -- initialize checkmarks bk = topicsBackground() step i from 1 to pagecount of bk set visited of page i of bk to false set checked of group "tableofcontents" of page "tableOfContents" to false if syslevel is author send reader to handle entermenu menuName,menuAlias if menuName is "contents" and syslevel is author if this background is chaptersBackground() enable menuitem "Change Chapter Name..." in menu "contents" at author else disable menuitem "Change Chapter Name..." in menu "contents" at author end if this background is TopicsBackground() enable menuitem "Change Topic Name..." in menu "contents" at author else disable menuitem "Change Topic Name..." in menu "contents" at author end if visible of viewer "outline" check menuitem "outline" in menu "contents" at author else uncheck menuitem "outline" in menu "contents" at author end forward to handle leaveapplication remove menu "Contents" at author remove menuitem "helpTemplate" in menu "help" at author forward to handle author if isOpen of viewer "outline" set fw to focusWindow show viewer "outline" set focusWindow to fw show button "help" of page "toolbar" forward to handle reader forward if isOpen of viewer "outline" hide viewer "outline" hide button "help" of page "toolbar" send sizeToPage to handle outline mstate = menuItemChecked("outline" in menu "contents" at author,mainwindow) if mstate is true if isOpen of viewer "outline" close viewer "outline" end else open viewer "outline" send rebuildStructure show viewer "outline" -- if a newbackground is inserted into the content area, -- move it beyond the content area to handle newBackground get chapterCount of this book if it < chapterLimit() forward lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) if pagenumber of this page < lastPage pageNumber of this page = lastPage end else request "This template is limited to" && chapterLimit() && "chapters." --================ Utility handlers =================== -- returns number of chapters allowed in this template to get chapterLimit return 8 -- returns the background reference for the chapter headings background to get chaptersBackground return background "chapter headings" -- returns the background reference for the chapter topics background to get topicsBackground return background "topics" to handle rebuildStructure updatePalette if updatePalette is null updatePalette = true local pagesOfEachChapter,curPage,curBackground,prevChapterHeadingPage,chapterList,listBoxText pageNumber of page "tableofcontents" = 1 pagenumber of first page of chaptersBackground() = 2 lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageCounter = 2 chapterCount = 0 while pageCounter <= lastPage curPage = page pageCounter curPageId = idnumber of curPage curBackground = parent of curPage pagelabel = label of curPage conditions when curBackground is chaptersBackground() increment chapterCount if prevChapterHeadingPage is not NULL myPages of prevChapterHeadingPage = pagesOfEachChapter clear pagesOfEachChapter end prevChapterHeadingPage = curPage curChapterId = curPageId myChapterID of curPage = curChapterID if chapterList is not null put crlf after chapterList end put curPageId & "," & pageLabel after chapterList put pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter when curBackground is topicsBackground() if pagesOfEachChapter is not null put "," after pagesOfEachChapter end put idnumber of curPage after pagesOfEachChapter myChapterID of curPage = curChapterID put tab & pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter else -- this page is not of either background. Move it beyond both backgrounds pageNumber of curPage = lastPage decrement lastPage end myPages of prevChapterHeadingPage = pagesOfEachChapter voutline of group "tableOfContents" of page "tableOfContents" = chapterList clear last char of listBoxText clear last char of listBoxText if updatePalette if isOpen of viewer "outline" send initPage listBoxText to currentPage of viewer "outline" end in mainWindow send initPage to this page chapterCount of this book = chapterCount -- Used to get the text before a tab of a textline -- (in the list box of a dialog viewer, tab is used -- to store extra information that gets clipped by the -- right side of the field) to get extractName t if first char of t is tab clear first char of t tabOffset = offset(tab,t) if tabOffset is 0 return null else return chars 1 to tabOffset-1 of t -- Used to get the text beyond a tab of a textline to get extractID t lastTabLoc = charcount(t) decrement lastTabLoc until lastTabLoc <=0 or char lastTabLoc of t is tab if lastTabLoc <=0 return null else return chars lastTabLoc+1 to charcount(t) of t -- returns the numerical location of an item in a list to get itemOffset itm,lst step i from 1 to itemcount(lst) pop lst if it = itm return i end return 0 -- returns a gray color to get middleGray return 240,63.5,2.1875 -- returns dark blue to get darkBlue return 240,25.125,100 -- returns a string of tabs. This serves a spacer between the -- label of a page and the idnumber on each line in the listbox. -- This is used so the idnumber is clipped and not visible to get tabSpacer return tab&tab&tab&tab&tab&tab&tab&tab&tab&tab --============= Navigation and menu messages ============= -- tableOfContents message sent by toolbar -- when the tableOfContents button is pressed to handle tableOfContents pref = page "tableOfContents" send updatechecks to group "tableofcontents" of pref go to pref to handle helpTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt1" of bref open vref show vref sysErrorNumber = sen sysError = se to handle initPage to handle newChapter promptForName get chapterCount of this book if it < chapterLimit() if promptForName is null promptForName = true end chapterName = "Untitled" if promptForName ask "Enter new chapter name." with chapterName if syserror = cancel break end chapterName = it end in mainwindow ls = lockscreen of this window lockscreen of this window = true -- go to a clean page so that leavePage messages are sent -- then suspend messages and navigate to the last page of the -- appropriate background so that enterPage messages are not sent go to page 1 ssm = syssuspendmessages syssuspendmessages = true go to last page of chaptersBackground() send newPage syssuspendmessages = ssm set label of this page to chapterName lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) set pageNumber of this page to lastPage send rebuildStructure send enterPage to this page set enabled of button "tableOfContents" of page "toolbar" to true lockscreen of this window = ls end else request "This template is limited to" && chapterLimit() && "chapters." to handle newTopic pageNum chapterName = "Untitled" if pageNum is null ask "Enter new topic name." with chapterName if syserror = cancel break end chapterName = it in mainWindow if pageNum is null conditions when this background is chaptersBackground() when this background is topicsBackground() pageNum = pageNumber of this page else lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageNum = lastPage end end ls = lockscreen of this window lockscreen of this window = true -- go to a clean page so that leavePage messages are sent -- then suspend messages and navigate to the last page of the -- appropriate background so that enterPage messages are not sent go to page 1 ssm = syssuspendmessages syssuspendmessages = true if this background is not topicsBackground() go to last page of topicsBackground() end send newPage syssuspendmessages = ssm set label of this page to chapterName set pageNumber of this page to pageNum+1 send rebuildStructure send enterPage to this page set enabled of button "tableOfContents" of page "toolbar" to true lockscreen of this window = ls to handle changeName ask "Enter new name." with label of this page if syserror = cancel break label of this page = it send rebuildStructure to handle saveAs firstTime of this book = true forward to handle aboutAnimate show viewer "about" as modal to get animSysbookLoaded if sysbooks contains "mtb30.sbk" or sysbooks contains "mtb30anm.sbk" return true else return false CBT_DEMO.TBK H)H)-- -- Copyright 1994 Asymetrix Corporation -- -- Asymetrix gives you permission to copy, revise, and reuse the -- individual objects and scripts in this application in your own -- applications. You may not copy the entire book (or a -- substantial part of it) for redistribution as your own product. -- -- Asymetrix retains the copyright on the original elements of this -- application. Include the notice "Portions of this application are -- the copyright of Asymetrix Corporation" in your product if they -- contain objects or scripts copied from this application. -- Author: Joseph Brick -- Last revision: 5/9/94 to handle enterApplication forward sysHistoryRecord = true go to page "introscreen" if sysRuntime is false add menu "&Contents" at author with helpText "Options for modifying content of this template." add menuitem "Template &Outline" alias "outline" to menu "contents" at author with helptext\ "Displays/hides Template Outline palette." add menuitem "" to menu "contents" at author add menuitem "New &Chapter..." to menu "contents" at author with helptext\ "Adds new chapter to this book." add menuitem "Change C&hapter Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of current chapter." add menuitem "" to menu "contents" at author add menuitem "New &Topic..." to menu "contents" at author with helptext\ "Adds new topic to this chapter." add menuitem "Change To&pic Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of topic chapter." add menuitem "Using this &Template" alias "helpTemplate" to menu "help" position 2 at author with helptext\ "Displays help on using this template." if firstTime of this book is not false open viewer "outline" send rebuildStructure firstTime of this book = false end send reader to handle entermenu menuName,menuAlias if menuName is "contents" and syslevel is author if this background is chaptersBackground() enable menuitem "Change Chapter Name..." in menu "contents" at author else disable menuitem "Change Chapter Name..." in menu "contents" at author end if this background is TopicsBackground() enable menuitem "Change Topic Name..." in menu "contents" at author else disable menuitem "Change Topic Name..." in menu "contents" at author end if visible of viewer "outline" check menuitem "outline" in menu "contents" at author else uncheck menuitem "outline" in menu "contents" at author end forward to handle leaveapplication set syslockscreen to true set captionBar of mainwindow to normal set state of mainwindow to normal remove menu "Contents" at author remove menuitem "helpTemplate" in menu "help" at author forward to handle author if isOpen of viewer "outline" set fw to focusWindow show viewer "outline" set focusWindow to fw set state of mainwindow to normal set captionBar of mainwindow to normal forward to handle reader forward if isOpen of viewer "outline" hide viewer "outline" set captionBar of mainwindow to none set state of mainwindow to maximized to handle outline mstate = menuItemChecked("outline" in menu "contents" at author,mainwindow) if mstate is true if isOpen of viewer "outline" close viewer "outline" end else open viewer "outline" send rebuildStructure show viewer "outline" -- if a newbackground is inserted into the content area, -- move it beyond the content area to handle newBackground forward lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) if pagenumber of this page < lastPage pageNumber of this page = lastPage --================ Utility handlers =================== -- returns the background reference for the chapter headings background to get chaptersBackground return background "chapterheadings" -- returns the background reference for the chapter topics background to get topicsBackground return background "content" to handle rebuildStructure updatePalette local chapterCounter chapterCounter = 0 if updatePalette is null updatePalette = true local pagesOfEachChapter,curPage,curBackground,prevChapterHeadingPage,chapterList,listBoxText pageNumber of page "introscreen" = 1 pagenumber of first page of chaptersBackground() = 2 lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageCounter = 2 while pageCounter <= lastPage curPage = page pageCounter curPageId = idnumber of curPage curBackground = parent of curPage pagelabel = label of curPage conditions when curBackground is chaptersBackground() increment chapterCounter if prevChapterHeadingPage is not NULL myPages of prevChapterHeadingPage = pagesOfEachChapter clear pagesOfEachChapter end prevChapterHeadingPage = curPage curChapterId = curPageId myChapterID of curPage = curChapterID if chapterList is not null put crlf after chapterList end put curPageId & "," & pageLabel after chapterList put pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter when curBackground is topicsBackground() chapter of curPage = chapterCounter if pagesOfEachChapter is not null put "," after pagesOfEachChapter end put idnumber of curPage after pagesOfEachChapter myChapterID of curPage = curChapterID put tab & pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter else -- this page is not of either background. Move it beyond both backgrounds pageNumber of curPage = lastPage decrement lastPage end myPages of prevChapterHeadingPage = pagesOfEachChapter voutline of group "tableOfContents" of background "Content" = chapterList clear last char of listBoxText clear last char of listBoxText if updatePalette if isOpen of viewer "outline" send initPage listBoxText to currentPage of viewer "outline" in mainWindow send enterpage to this page end end -- Used to get the text before a tab of a textline -- (in the list box of a dialog viewer, tab is used -- to store extra information that gets clipped by the -- right side of the field) to get extractName t if first char of t is tab clear first char of t tabOffset = offset(tab,t) if tabOffset is 0 return null else return chars 1 to tabOffset-1 of t -- Used to get the text beyond a tab of a textline to get extractID t lastTabLoc = charcount(t) decrement lastTabLoc until lastTabLoc <=0 or char lastTabLoc of t is tab if lastTabLoc <=0 return null else return chars lastTabLoc+1 to charcount(t) of t -- returns the numerical location of an item in a list to get itemOffset itm,lst step i from 1 to itemcount(lst) pop lst if it = itm return i end return 0 -- returns a gray color to get middleGray return 240,63.5,2.1875 -- returns dark blue to get darkBlue return 240,25.125,100 -- returns a string of tabs. This serves a spacer between the -- label of a page and the idnumber on each line in the listbox. -- This is used so the idnumber is clipped and not visible to get tabSpacer return tab&tab&tab&tab&tab&tab&tab&tab&tab&tab to handle helpTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt1" of bref open vref show vref sysErrorNumber = sen sysError = se to handle initPage to handle newChapter promptForName if promptForName is null promptForName = true chapterName = "Untitled" if promptForName ask "Enter new chapter name." with chapterName if syserror = cancel break end chapterName = it in mainwindow ls = lockscreen of this window lockscreen of this window = true go to last page of chaptersBackground() ssm = syssuspendmessages syssuspendmessages = true send newPage syssuspendmessages = ssm set label of this page to chapterName lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) set pageNumber of this page to lastPage send rebuildStructure send enterPage to this page lockscreen of this window = ls to handle newTopic pageNum chapterName = "Untitled" if pageNum is null ask "Enter new topic name." with chapterName if syserror = cancel break end chapterName = it in mainWindow if pageNum is null conditions when this background is chaptersBackground() when this background is topicsBackground() pageNum = pageNumber of this page else lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageNum = lastPage end end ls = lockscreen of this window lockscreen of this window = true if this background is not topicsBackground() go to last page of topicsBackground() end ssm = syssuspendmessages syssuspendmessages = true send newPage syssuspendmessages = ssm set label of this page to chapterName set pageNumber of this page to pageNum+1 send rebuildStructure send enterPage to this page lockscreen of this window = ls to handle changeName ask "Enter new name." with label of this page if syserror = cancel break label of this page = it send rebuildStructure to handle sizeToPage if syslevel is AUTHOR forward CBT_TIPS.TBK --==================== Standard ToolBook messages =================== to handle enterApplication forward -- link needed dll's linkDLL "tb30win.dll" int displayBitsPerPixel() -- these gdi calls are used for drawing separator line linkDLL "gdi" int getDeviceCaps(word,int) dword moveTo(word,int,int) int lineTo(word,int,int) int setROP2(word,int) word createPen(int,int,dword) int deleteObject(word) word selectObject(word,word) linkdll user word getDC(word) int releaseDC(word,word) if sysruntime is false add menuitem "Using this &Template" alias "helpTemplate" to menu "help" position 2 at author with helptext\ "Displays help on using this template." -- set backcolor (a "to set" handler, below) depending on -- the number of colors displayed. get numColors() if it > 16 or it = 0 set backcolor of this book to darkerBlue() else set backcolor of this book to lighterBlue() show viewer "navigationBar" in viewer "navigationBar" -- initialize combobox and field in navigation window set text of combobox "categories" to "<All topics>" send populate "All" to field "Topics" if sysLevel is not "reader" send reader else send hideControls to handle leaveApplication remove menuitem "helpTemplate" in menu "help" at author -- show buttons for modifying book to handle author forward send showControls to handle showControls show group "CategoryButtons" of page "Navigation" set item 4 of bounds of field "topics" of page "Navigation" to \ item 2 of bounds of group "CategoryButtons" of page "Navigation" - 60 send sizetopage -- hide buttons for modifying book to handle reader forward send hideControls to handle hideControls hide group "CategoryButtons" of page "Navigation" set item 4 of bounds of field "topics" of page "Navigation" to \ item 4 of bounds of group "CategoryButtons" of page "Navigation" send sizetopage to handle destroy -- if a page is deleted, updates the category array (struct[][]) userProperty -- of this book. -- Each row of the category array has the category name and a list -- of the id numbers of pages belonging to that category. This handler -- walks through the array, finding every instance of that id number. -- when found, it removes it. if object of target is "page" and name of parent of target is in "description and script,description and example,description only" local x[][] set x to categoryStruct of this book set pageID to idnumber of target step i from 1 to item 1 of dimensions(x) get itemOffset(pageID,x[i][2]) if it > 0 clear item it of x[i][2] end end set categoryStruct of this book to x forward to handle enterPage forward -- if this is a content background if name of parent of this page is in "description and script,description and example,description only" -- to ensure the recordfield is set to the label property -- the label property holds the name of each topic set fref to recordfield "subTopicName" of this page if text of fref is not label of this page set text of fref to label of this page end -- set the scroll of the recordfield, if necessary set fref to recordfield "explanation" if scroll of fref is not 0 set scroll of fref to 0 end -- add/remove scrollbars, if necessary set txtOver to textoverflow of fref conditions when txtOver > 0 and borderstyle of fref is "none" set borderstyle of fref to "scrolling" when txtOver = 0 and borderstyle of fref is "scrolling" set borderstyle of fref to "none" end to handle leavePage forward if name of parent of this page is in "description and script,description and example,description only" set topic to text of recordfield "subTopicName" if label of this page is not topic set label of this page to topic end --========================= Utility handlers =========================== -- returns the text before a tab to get extractName t set tabOffset to offset(tab,t) return chars 1 to tabOffset-1 of t -- returns the text following a tab to get extractID t set lastTabLoc to charcount(t) decrement lastTabLoc until lastTabLoc <=0 or char lastTabLoc of t is tab if lastTabLoc <=0 return null else return chars lastTabLoc+1 to charcount(t) of t -- returns the offset of item itm in list lst to get itemOffset itm,lst step i from 1 to itemcount(lst) pop lst if itm = it return i end return 0 -- removes all instances of a char from a string to get stripChar chr,strng while strng contains chr clear char offset(chr,strng) of strng return strng -- returns the number of colors displayed to get numColors hdc = getDC(windowhandle of mainWindow) retval = getDeviceCaps(hdc,24) get releaseDC(windowhandle of mainwindow,hdc) return retval to get darkerBlue return 212,79.1875,71.6875 to get lighterBlue return 180,75.125,100 to set backColor to value set bckgrnds to "intro,description and script,description and example,description only" step i from 1 to itemcount(bckgrnds) pop bckgrnds set curBack to background it if fillcolor of curBack is not value set fillcolor of curBack to value end --================ Handlers for dealing with array structure ============ -- display the array in a request box. -- (used during authoring for debugging purposes) to handle showCategoryStruct local x[][] set x to categoryStruct of this book local retval step i from 1 to item 1 of dimensions(x) put x[i][1] after retval put tab & x[i][2] & crlf after retval request retval --------------- these handers sort the array -------------------- to handle twoDquicksort fArray[][],n,dtype system stbk_noSwap set stbk_noSwap to 0 send twoDquicksrt fArray, 1, item 1 of dimensions(fArray),n,dtype to handle twoDquicksrt fArray[][], l, r,n,dtype system stbk_noSwap if r > l send swap fArray, l, ((l+r) div 2) set lst to l step i from (l+1) to r conditions when dtype is "text" set test to fArray[i][n] < fArray[l][n] as text when dtype is "date" set test to fArray[i][n] < fArray[l][n] as date else set test to fArray[i][n] < fArray[l][n] as number end if test increment lst send swap fArray, lst, i else increment stbk_noswap end if end step send swap fArray,l,lst send twoDquicksrt fArray, l, lst-1,n,dtype send twoDquicksrt fArray, lst+1,r,n,dtype end to handle swap fArray[][], a, b local temp step i from 1 to item 2 of dimensions (fArray) set temp to farray[a][i] set farray[a][i] to farray[b][i] set farray[b][i] to temp to handle helpTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt4" of bref open vref show vref sysErrorNumber = sen sysError = se CBT1.TBK -- Copyright 1994 Asymetrix Corporation -- -- Asymetrix gives you permission to copy, revise, and reuse the -- individual objects and scripts in this application in your own -- applications. You may not copy the entire book (or a -- substantial part of it) for redistribution as your own product. -- -- Asymetrix retains the copyright on the original elements of this -- application. Include the notice "Portions of this application are -- the copyright of Asymetrix Corporation" in your product if they -- contain objects or scripts copied from this application. -- Author: Joseph Brick -- Last revision: 5/9/94 --============== Standard ToolBook messages =================== -- set up the menus, initialize Back handling to handle enterApplication forward set enabled of button "back" of page "toolbar" to false if sysRuntime is false add menu "&Contents" at author with helpText "Options for modifying content of this template." add menuitem "Template &Outline" alias "outline" to menu "contents" at author with helptext\ "Displays/hides Template Outline palette." add menuitem "" to menu "contents" at author add menuitem "New &Chapter..." to menu "contents" at author with helptext\ "Adds new chapter to this book." add menuitem "Change C&hapter Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of current chapter." add menuitem "" to menu "contents" at author add menuitem "New &Topic..." to menu "contents" at author with helptext\ "Adds new topic to this chapter." add menuitem "Change To&pic Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of topic chapter." add menuitem "Using this &Template" alias "helpTemplate" to menu "help" position 2 at author with helptext\ "Displays help on using this template." if firstTime of this book is not false open viewer "outline" send rebuildStructure firstTime of this book = false end hide button "help" of page "toolbar" -- initialize checkmarks bk = topicsBackground() step i from 1 to pagecount of bk set visited of page i of bk to false set checked of group "tableofcontents" of page "tableOfContents" to false if syslevel is author send reader to handle entermenu menuName,menuAlias if menuName is "contents" and syslevel is author if this background is chaptersBackground() enable menuitem "Change Chapter Name..." in menu "contents" at author else disable menuitem "Change Chapter Name..." in menu "contents" at author end if this background is TopicsBackground() enable menuitem "Change Topic Name..." in menu "contents" at author else disable menuitem "Change Topic Name..." in menu "contents" at author end if visible of viewer "outline" check menuitem "outline" in menu "contents" at author else uncheck menuitem "outline" in menu "contents" at author end forward to handle leaveapplication remove menu "Contents" at author remove menuitem "helpTemplate" in menu "help" at author forward to handle author if isOpen of viewer "outline" set fw to focusWindow show viewer "outline" set focusWindow to fw show button "help" of page "toolbar" forward to handle reader forward if isOpen of viewer "outline" hide viewer "outline" hide button "help" of page "toolbar" to handle outline mstate = menuItemChecked("outline" in menu "contents" at author,mainwindow) if mstate is true if isOpen of viewer "outline" close viewer "outline" end else open viewer "outline" send rebuildStructure show viewer "outline" -- if a newbackground is inserted into the content area, -- move it beyond the content area to handle newBackground forward lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) if pagenumber of this page < lastPage pageNumber of this page = lastPage --================ Utility handlers =================== -- returns the background reference for the chapter headings background to get chaptersBackground return background "chapter headings" -- returns the background reference for the chapter topics background to get topicsBackground return background "topics" to handle rebuildStructure updatePalette if updatePalette is null updatePalette = true local pagesOfEachChapter,curPage,curBackground,prevChapterHeadingPage,chapterList,listBoxText pageNumber of page "tableofcontents" = 1 pagenumber of first page of chaptersBackground() = 2 lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageCounter = 2 while pageCounter <= lastPage curPage = page pageCounter curPageId = idnumber of curPage curBackground = parent of curPage pagelabel = label of curPage conditions when curBackground is chaptersBackground() if prevChapterHeadingPage is not NULL myPages of prevChapterHeadingPage = pagesOfEachChapter clear pagesOfEachChapter end prevChapterHeadingPage = curPage curChapterId = curPageId myChapterID of curPage = curChapterID if chapterList is not null put crlf after chapterList end put curPageId & "," & pageLabel after chapterList put pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter when curBackground is topicsBackground() if pagesOfEachChapter is not null put "," after pagesOfEachChapter end put idnumber of curPage after pagesOfEachChapter myChapterID of curPage = curChapterID put tab & pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter else -- this page is not of either background. Move it beyond both backgrounds pageNumber of curPage = lastPage decrement lastPage end myPages of prevChapterHeadingPage = pagesOfEachChapter voutline of group "tableOfContents" of page "tableOfContents" = chapterList clear last char of listBoxText clear last char of listBoxText if updatePalette if isOpen of viewer "outline" send initPage listBoxText to currentPage of viewer "outline" end in mainWindow send initPage to this page -- Used to get the text before a tab of a textline -- (in the list box of a dialog viewer, tab is used -- to store extra information that gets clipped by the -- right side of the field) to get extractName t if first char of t is tab clear first char of t tabOffset = offset(tab,t) if tabOffset is 0 return null else return chars 1 to tabOffset-1 of t -- Used to get the text beyond a tab of a textline to get extractID t lastTabLoc = charcount(t) decrement lastTabLoc until lastTabLoc <=0 or char lastTabLoc of t is tab if lastTabLoc <=0 return null else return chars lastTabLoc+1 to charcount(t) of t -- returns the numerical location of an item in a list to get itemOffset itm,lst step i from 1 to itemcount(lst) pop lst if it = itm return i end return 0 -- returns a gray color to get middleGray return 240,63.5,2.1875 -- returns dark blue to get darkBlue return 240,25.125,100 -- returns a string of tabs. This serves a spacer between the -- label of a page and the idnumber on each line in the listbox. -- This is used so the idnumber is clipped and not visible to get tabSpacer return tab&tab&tab&tab&tab&tab&tab&tab&tab&tab --============= Navigation and menu messages ============= -- tableOfContents message sent by toolbar -- when the tableOfContents button is pressed to handle tableOfContents pref = page "tableOfContents" send updatechecks to group "tableofcontents" of pref go to pref to handle helpTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt1" of bref open vref show vref sysErrorNumber = sen sysError = se to handle initPage to handle newChapter promptForName if promptForName is null promptForName = true chapterName = "Untitled" if promptForName ask "Enter new chapter name." with chapterName if syserror = cancel break end chapterName = it in mainwindow ls = lockscreen of this window lockscreen of this window = true go to last page of chaptersBackground() ssm = syssuspendmessages syssuspendmessages = true send newPage syssuspendmessages = ssm set label of this page to chapterName lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) set pageNumber of this page to lastPage send rebuildStructure send enterPage to this page lockscreen of this window = ls to handle newTopic pageNum chapterName = "Untitled" if pageNum is null ask "Enter new topic name." with chapterName if syserror = cancel break end chapterName = it in mainWindow if pageNum is null conditions when this background is chaptersBackground() when this background is topicsBackground() pageNum = pageNumber of this page else lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageNum = lastPage end end ls = lockscreen of this window lockscreen of this window = true if this background is not topicsBackground() go to last page of topicsBackground() end ssm = syssuspendmessages syssuspendmessages = true send newPage syssuspendmessages = ssm set label of this page to chapterName set pageNumber of this page to pageNum+1 send rebuildStructure send enterPage to this page lockscreen of this window = ls to handle changeName ask "Enter new name." with label of this page if syserror = cancel break label of this page = it send rebuildStructure CBT2.TBK -- Copyright 1994 Asymetrix Corporation -- -- Asymetrix gives you permission to copy, revise, and reuse the -- individual objects and scripts in this application in your own -- applications. You may not copy the entire book (or a -- substantial part of it) for redistribution as your own product. -- -- Asymetrix retains the copyright on the original elements of this -- application. Include the notice "Portions of this application are -- the copyright of Asymetrix Corporation" in your product if they -- contain objects or scripts copied from this application. -- Author: Joseph Brick -- Last revision: 5/9/94 to handle enterApplication forward go to page "introscreen" if sysRuntime is false add menu "&Contents" at author with helpText "Options for modifying content of this template." add menuitem "Template &Outline" alias "outline" to menu "contents" at author with helptext\ "Displays/hides Template Outline palette." add menuitem "" to menu "contents" at author add menuitem "New &Chapter..." to menu "contents" at author with helptext\ "Adds new chapter to this book." add menuitem "Change C&hapter Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of current chapter." add menuitem "" to menu "contents" at author add menuitem "New &Topic..." to menu "contents" at author with helptext\ "Adds new topic to this chapter." add menuitem "Change To&pic Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of topic chapter." add menuitem "Using this &Template" alias "helpTemplate" to menu "help" position 2 at author with helptext\ "Displays help on using this template." if firstTime of this book is not false open viewer "outline" send rebuildStructure firstTime of this book = false end send reader to handle entermenu menuName,menuAlias if menuName is "contents" and syslevel is author if this background is chaptersBackground() enable menuitem "Change Chapter Name..." in menu "contents" at author else disable menuitem "Change Chapter Name..." in menu "contents" at author end if this background is TopicsBackground() enable menuitem "Change Topic Name..." in menu "contents" at author else disable menuitem "Change Topic Name..." in menu "contents" at author end if visible of viewer "outline" check menuitem "outline" in menu "contents" at author else uncheck menuitem "outline" in menu "contents" at author end forward to handle leaveapplication remove menu "Contents" at author remove menuitem "helpTemplate" in menu "help" at author forward to handle author if isOpen of viewer "outline" set fw to focusWindow show viewer "outline" set focusWindow to fw set state of mainwindow to normal set captionBar of mainwindow to normal forward to handle reader forward if isOpen of viewer "outline" hide viewer "outline" set captionBar of mainwindow to none set state of mainwindow to maximized to handle outline mstate = menuItemChecked("outline" in menu "contents" at author,mainwindow) if mstate is true if isOpen of viewer "outline" close viewer "outline" end else open viewer "outline" send rebuildStructure show viewer "outline" -- if a newbackground is inserted into the content area, -- move it beyond the content area to handle newBackground forward lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) if pagenumber of this page < lastPage pageNumber of this page = lastPage --================ Utility handlers =================== -- returns the background reference for the chapter headings background to get chaptersBackground return background "chapterheadings" -- returns the background reference for the chapter topics background to get topicsBackground return background "content" to handle rebuildStructure updatePalette local chapterCounter chapterCounter = 0 if updatePalette is null updatePalette = true local pagesOfEachChapter,curPage,curBackground,prevChapterHeadingPage,chapterList,listBoxText pageNumber of page "introscreen" = 1 pagenumber of first page of chaptersBackground() = 2 lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageCounter = 2 while pageCounter <= lastPage curPage = page pageCounter curPageId = idnumber of curPage curBackground = parent of curPage pagelabel = label of curPage conditions when curBackground is chaptersBackground() increment chapterCounter if prevChapterHeadingPage is not NULL myPages of prevChapterHeadingPage = pagesOfEachChapter clear pagesOfEachChapter end prevChapterHeadingPage = curPage curChapterId = curPageId myChapterID of curPage = curChapterID if chapterList is not null put crlf after chapterList end put curPageId & "," & pageLabel after chapterList put pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter when curBackground is topicsBackground() chapter of curPage = chapterCounter if pagesOfEachChapter is not null put "," after pagesOfEachChapter end put idnumber of curPage after pagesOfEachChapter myChapterID of curPage = curChapterID put tab & pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter else -- this page is not of either background. Move it beyond both backgrounds pageNumber of curPage = lastPage decrement lastPage end myPages of prevChapterHeadingPage = pagesOfEachChapter voutline of group "tableOfContents" of background "Content" = chapterList clear last char of listBoxText clear last char of listBoxText if updatePalette if isOpen of viewer "outline" send initPage listBoxText to currentPage of viewer "outline" in mainWindow send enterpage to this page end end -- Used to get the text before a tab of a textline -- (in the list box of a dialog viewer, tab is used -- to store extra information that gets clipped by the -- right side of the field) to get extractName t if first char of t is tab clear first char of t tabOffset = offset(tab,t) if tabOffset is 0 return null else return chars 1 to tabOffset-1 of t -- Used to get the text beyond a tab of a textline to get extractID t lastTabLoc = charcount(t) decrement lastTabLoc until lastTabLoc <=0 or char lastTabLoc of t is tab if lastTabLoc <=0 return null else return chars lastTabLoc+1 to charcount(t) of t -- returns the numerical location of an item in a list to get itemOffset itm,lst step i from 1 to itemcount(lst) pop lst if it = itm return i end return 0 -- returns a gray color to get middleGray return 240,63.5,2.1875 -- returns dark blue to get darkBlue return 240,25.125,100 -- returns a string of tabs. This serves a spacer between the -- label of a page and the idnumber on each line in the listbox. -- This is used so the idnumber is clipped and not visible to get tabSpacer return tab&tab&tab&tab&tab&tab&tab&tab&tab&tab to handle helpTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt1" of bref open vref show vref sysErrorNumber = sen sysError = se to handle initPage to handle newChapter promptForName if promptForName is null promptForName = true chapterName = "Untitled" if promptForName ask "Enter new chapter name." with chapterName if syserror = cancel break end chapterName = it in mainwindow ls = lockscreen of this window lockscreen of this window = true go to last page of chaptersBackground() ssm = syssuspendmessages syssuspendmessages = true send newPage syssuspendmessages = ssm set label of this page to chapterName lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) set pageNumber of this page to lastPage send rebuildStructure send enterPage to this page lockscreen of this window = ls to handle newTopic pageNum chapterName = "Untitled" if pageNum is null ask "Enter new topic name." with chapterName if syserror = cancel break end chapterName = it in mainWindow if pageNum is null conditions when this background is chaptersBackground() when this background is topicsBackground() pageNum = pageNumber of this page else lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageNum = lastPage end end ls = lockscreen of this window lockscreen of this window = true if this background is not topicsBackground() go to last page of topicsBackground() end ssm = syssuspendmessages syssuspendmessages = true send newPage syssuspendmessages = ssm set label of this page to chapterName set pageNumber of this page to pageNum+1 send rebuildStructure send enterPage to this page lockscreen of this window = ls to handle changeName ask "Enter new name." with label of this page if syserror = cancel break label of this page = it send rebuildStructure to handle sizeToPage if syslevel is AUTHOR forward to handle exit syserror = null forward if syserror is null set syslockscreen to true set captionBar of mainwindow to normal set state of mainwindow to normal CBT3.TBK -- Copyright 1994 Asymetrix Corporation -- -- Asymetrix gives you permission to copy, revise, and reuse the -- individual objects and scripts in this application in your own -- applications. You may not copy the entire book (or a -- substantial part of it) for redistribution as your own product. -- -- Asymetrix retains the copyright on the original elements of this -- application. Include the notice "Portions of this application are -- the copyright of Asymetrix Corporation" in your product if they -- contain objects or scripts copied from this application. -- Author: Joseph Brick -- Last revision: 5/9/94 to handle enterMenu menuName,alias -- if menu "Page" is selected if syslevel is reader and menuName is "Page" -- set all menus to known state enable menuitem "Next" in menu menuName at reader enable menuitem "Previous" in menu menuName at reader enable menuitem "First" in menu menuName at reader enable menuitem "Last" in menu menuName at reader if isOpen of viewer "scroll" in viewer "scroll" -- disable "First" and "Previous", if appropriate if this page is first page of this background in mainWindow disable menuitem "First" in menu menuName at reader disable menuitem "Previous" in menu menuName at reader end end -- disable "Last" and "Next", if appropriate if this page is last page of this background in mainWindow disable menuitem "Last" in menu menuName at reader disable menuitem "Next" in menu menuName at reader end end end end forward to handle enterApplication forward if syslevel is not reader syslevel = reader to handle aboutTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt3" of bref open vref show vref sysErrorNumber = sen sysError = se CBT3.TBK -- Copyright 1994 Asymetrix Corporation -- -- Asymetrix gives you permission to copy, revise, and reuse the -- individual objects and scripts in this application in your own -- applications. You may not copy the entire book (or a -- substantial part of it) for redistribution as your own product. -- -- Asymetrix retains the copyright on the original elements of this -- application. Include the notice "Portions of this application are -- the copyright of Asymetrix Corporation" in your product if they -- contain objects or scripts copied from this application. -- Author: Joseph Brick -- Last revision: 5/9/94 to handle enterMenu menuName,alias -- if menu "Page" is selected if syslevel is reader and menuName is "Page" -- set all menus to known state enable menuitem "Next" in menu menuName at reader enable menuitem "Previous" in menu menuName at reader enable menuitem "First" in menu menuName at reader enable menuitem "Last" in menu menuName at reader if isOpen of viewer "scroll" in viewer "scroll" -- disable "First" and "Previous", if appropriate if this page is first page of this background in mainWindow disable menuitem "First" in menu menuName at reader disable menuitem "Previous" in menu menuName at reader end end -- disable "Last" and "Next", if appropriate if this page is last page of this background in mainWindow disable menuitem "Last" in menu menuName at reader disable menuitem "Next" in menu menuName at reader end end end end forward to handle enterApplication forward if syslevel is not reader syslevel = reader to handle aboutTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt3" of bref open vref show vref sysErrorNumber = sen sysError = se local x[][] set x to categoryStruct of this book set pageID to idnumber of target step i from 1 to item 1 of dimensions(x) get itemOffset(pageID,x[i][2]) if it > 0 clear item it of x[i][2] end end set categoryStruct of this book to x forward to handle enterPage forward -- if this is a content background if name of parent of this page is in "description and script,description and example,description only" -- to ensure the recordfield is set to the label property -- the label property holds the name of each topic set fref to recordfield "subTopicName" of this page if text of fref is not label of this page set text of fref to label of this page end -- set the scroll of the recordfield, if necessary set fref to recordfield "explanation" if scroll of fref is not 0 set scroll of fref to 0 end -- add/remove scrollbars, if necessary set txtOver to textoverflow of fref conditions when txtOver > 0 and borderstyle of fref is "none" set borderstyle of fref to "scrolling" when txtOver = 0 and borderstyle of fref is "scrolling" set borderstyle of fref to "none" end to handle leavePage forward if name of parent of this page is in "description and script,description and example,description only" set topic to text of recordfield "subTopicName" if label of this page is not topic set label of this page to topic end --========================= Utility handlers =========================== -- returns the text before a tab to get extractName t set tabOffset to offset(tab,t) return chars 1 to tabOffset-1 of t -- returns the text following a tab to get extractID t set lastTabLoc to charcount(t) decrement lastTabLoc until lastTabLoc <=0 or char lastTabLoc of t is tab if lastTabLoc <=0 return null else return chars lastTabLoc+1 to charcount(t) of t -- returns the offset of item itm in list lst to get itemOffset itm,lst step i from 1 to itemcount(lst) pop lst if itm = it return i end return 0 -- removes all instances of a char from a string to get stripChar chr,strng while strng contains chr clear char offset(chr,strng) of strng return strng -- returns the number of colors displayed to get numColors hdc = getDC(windowhandle of mainWindow) retval = getDeviceCaps(hdc,24) get releaseDC(windowhandle of mainwindow,hdc) return retval to get darkerBlue return 212,79.1875,71.6875 to get lighterBlue return 180,75.125,100 to set backColor to value set bckgrnds to "intro,description and script,description and example,description only" step i from 1 to itemcount(bckgrnds) pop bckgrnds set curBack to background it if fillcolor of curBack is not value set fillcolor of curBack to value end --================ Handlers for dealing with array structure ============ -- display the array in a request box. -- (used during authoring for debugging purposes) to handle showCategoryStruct local x[][] set x to categoryStruct of this book local retval step i from 1 to item 1 of dimensions(x) put x[i][1] after retval put tab & x[i][2] & crlf after retval request retval --------------- these handers sort the array -------------------- to handle twoDquicksort fArray[][],n,dtype system stbk_noSwap set stbk_noSwap to 0 send twoDquicksrt fArray, 1, item 1 of dimensions(fArray),n,dtype to handle twoDquicksrt fArray[][], l, r,n,dtype system stbk_noSwap if r > l send swap fArray, l, ((l+r) div 2) set lst to l step i from (l+1) to r conditions when dtype is "text" set test to fArray[i][n] < fArray[l][n] as text when dtype is "date" set test to fArray[i][n] < fArray[l][n] as date else set test to fArray[i][n] < fArray[l][n] as number end if test increment lst send swap fArray, lst, i else increment stbk_noswap end if end step send swap fArray,l,lst send twoDquicksrt fArray, l, lst-1,n,dtype send twoDquicksrt fArray, lst+1,r,n,dtype end to handle swap fArray[][], a, b local temp step i from 1 to item 2 of dimensions (fArray) set temp to farray[a][i] set farray[a][i] to farray[b][i] set farray[b][i] to temp to handle helpTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt4" of bref open vref show vref sysErrorNumber = sen sysError = se CONTACT.TBK T--*************************************************************************** -- Asymetrix Contact: dBase sample app. -- -- Asymetrix Corporation 1994 -- Authored by Charles Hiestand & Jeff Ayars -- Copyright 1994 Asymetrix Corporation -- Asymetrix gives you permission to copy, revise and reuse the individual -- objects and scripts in this application in your own applications. -- You may not, however, copy the entire book (or a substantial part of it) -- for redistribution as your own product. -- Asymetrix retains the copyright on the original elements of this -- application. Include the notice "Portions of this application are the -- copyright of Asymetrix Corporation" in your product if they contain -- objects or scripts copied from this application. -- A note on language independence: For ease of translating this -- application, all text strings visible to readers that come from scripts -- are put into functions located at the bottom of this book script. --******************************************************************************* --************************ Handlers for built in messages *************************** -- initialize the path, the text fields, link TB30DB3.DLL, open the dBase files to handle enterApplication system s_bookPath system LOGICAL s_firstFlag sysLevel = reader sysCursor = none sysLockScreen = TRUE s_firstFlag = TRUE s_bookPath = name of this book while last character of s_bookPath <> "\" clear last character of s_bookPath end while send linkDB3 set sysCursor to default get OpenDBFile(s_bookPath & "contact.dbf") if it < 0 request stringOpenError("contact.dbf") else index of this book = "name.ndx" checked of button "name" = TRUE selectedTextlines of field "records" = 1 focus = field "records" send updateRecords to field "records" end if -- Make sure book is initialized to browse mode if caption of button "edit" of page 1 = stringResource("Browse") send buttonClick to button "edit" of page 1 end if sysLockScreen = FALSE show mainWindow show viewer "splash" forward pause 2 seconds close viewer "splash" end enterApplication to handle leaveApplication get closeAllDBFiles() unlinkDLL sysToolBookDirectory & "TB30DB3" forward end leaveApplication to handle idle -- we make doubly sure that the window sizes correctly system s_firstFlag forward if s_firstFlag is TRUE clear s_firstFlag send sizeToPage end if end idle -- Handles all the help messages in the status bar. -- The property "helpText" is either a keyword or null for every object in -- the book. StringHelp uses the keyword to return the displayed text. to handle mouseEnter caption of statusBar = stringHelp(helpText of target) end mouseEnter to handle mouseLeave caption of statusBar = " " end mouseLeave to handle enterMenu mName,mAlias if mName = "File" enable menuItem "printReport" end if forward end enterMenu -- "About", just the splash screen. to handle about show viewer "splash" as modal end about -- "Quick Help" to handle quickHelp show viewer "Quick Help" as modal end quickHelp -- Simple save handler -- More for creating and debugging to handle save forward send updateDB end save -- These prevent resizing problems in 640 X 480 mode. -- In higher modes, it may look better to not have these handlers. to handle reader forward send sizeToPage end reader to handle author forward send sizeToPage end author --******************************************************************************* --*********************** Handlers for custom messages ************************** -- Links all the functions, but not all functions are used to handle linkDB3 clear sysError sysSuspend = false -- we'll handle our own errors if linking fails clear sysError linkdll sysToolBookDirectory & "TB30DB3.DLL" INT checkDBIndex(STRING) INT closeAllDBFiles() INT closeDBFile(STRING) INT closeDBIndexFile(STRING) WORD createDBFieldTag(WORD) INT createDBFile(STRING,WORD,WORD) INT createDBIndexFile(STRING,STRING,WORD,WORD) INT deleteDBFile(STRING) INT deselectDBIndexFile() INT findDBKey(STRING) INT firstDBKey() INT firstDBRecord() INT freeDBFieldTag(WORD) STRING getDBDateFormat() STRING getDBErrorString(INT) INT getDBFieldCount() STRING getDBFieldName(WORD) INT getDBFieldPrecision(STRING) INT getDBFieldType(STRING) STRING getDBFieldValue(STRING) INT getDBFieldWidth(STRING) STRING getDBFileName() STRING getDBIndexExpression() STRING getDBIndexFileName() INT getDBKeyType() STRING getDBKeyValue() INT getDBNavigateToDeleted() LONG getDBRecordCount() INT getDBRecordDeleted() LONG getDBRecordNumber() INT gotoDBRecord(DWORD) INT lastDBKey() INT lastDBRecord() INT nextDBKey() INT nextDBRecord() INT openDBFile(STRING) INT openDBIndexFile(STRING) INT packDBFile() INT previousDBKey() INT previousDBRecord() INT reindexDBFile(STRING) INT removeDBRecords(DWORD,DWORD) INT selectDBFile(STRING) INT selectDBIndexFile(STRING) INT setDBDateFormat(STRING) INT setDBFieldTag(WORD,WORD,STRING,STRING,WORD,WORD) INT setDBFieldValue(STRING, STRING) INT setDBNavigateToDeleted(INT) INT setDBRecordDeleted(WORD) INT writeDBRecord(DWORD) end linkdll if sysError <> null request stringError("linkError") end if end linkDB3 -- Gets better scrolling behavior for the field "record". -- Many of the buttons on the page have notify handlers for this message to handle updateDisplay system ARRAY LONG s_recordNumbertoTextline[] oldFocus = focus currentScroll = scroll of field "records" newScroll = s_recordNumbertoTextline[currentRecord of this book] selectedTextlines of field "records" = newScroll -- size of the bottom scroll of the field is hardwired to "6" fieldSize = textLineCount(text of field "records") - 6 if newScroll > currentScroll + 6 scroll of field "records" = min(fieldSize,newScroll - 1) else if newScroll < currentScroll + 1 scroll of field "records" = max(newScroll - 6,0) end end if focus = oldFocus end updateDisplay --*********************** Wrappers for TB30DB3.DLL calls ************************ -- All calls to the DLL are made from here. The rest of the book always -- calls these handlers and functions to get to the DLL. -- Simple wrapper for getDBFieldValue to get fieldValue fieldName clear sysError get getDBFieldValue(fieldName) if sysError is not null request getDBErrorString(syserror) break to system -- prevent notify messages else return it end if return null end fieldValue -- Simple wrapper for findDBKey. Provides some feedback to the user for two -- special cases. FindDBKey returns 3 if it can't find the text, and returns 4 -- if the search text goes past the last key. -- Important: dBaseIII is case sensitive. "a" > "A" !!! to handle findKey searchString get findDBKey(searchString) conditions when it = 3 request stringResource("findDBKey3") when it = 4 request stringResource("findDBKey4") get lastDBKey() when it < 1 request getDBErrorString(it) break to system -- prevent notify messages end conditions end findKey -- Wrapper for indexing, handles errors until it gives up. to set index to value system STRING s_bookPath get getDBIndexFileName() if it is null or value is not in it get openDBIndexFile(s_bookPath & value) get checkDBIndex(s_bookPath & value) if it = 1 -- got it OK get selectDBIndexFile(s_bookPath & value) else get reindexDBFile(s_bookPath & value) if it = -53 -- no index with that name request stringIndexError(value) break to system else if it < 1 request getDBErrorString(it) break to system -- prevent notify messages end if end if end if end index --- Simple wrapper for dBase navigation to set currentRecord to value conditions when value = "first" get firstDBKey() when value = "last" get lastDBKey() when value = "next" get nextDBKey() when value = "previous" get previousDBKey() when isType(DWORD, value) and value > 0 get goToDBRecord(value) else break end conditions if it < 0 if it = -10 -- no such record -- set a flag for updateRecords in script of field "Records" of page 1 sysErrorNumber = 65535 else request getDBErrorString(it) break to system -- prevent notify messages end if end if end currentRecord -- Simple wrapper for setDBFieldValue to set fieldValue fieldName to value get setDBFieldValue(fieldName, value) if it < 0 request getDBErrorString(it) break to system -- prevent notify messages end if end fieldValue -- Creates a new (and empty) record. -- We won't update the textfield until after we have created -- the first, last, and company names for the record. to handle newDBRecord get writeDBRecord(totalRecords of this book + 1) if it < 0 request getDBErrorString(it) break to system -- prevent notify messages end if end newDBRecord -- Simple wrapper for writeDBRecord. This is where the dBase record -- is actually written out. to handle updateDB get writeDBRecord(currentRecord of this book) if it < 0 request getDBErrorString(it) break to system -- prevent notify messages else send updateRecords to field "records" end if end updateDB -- Simple wrapper for setDBRecordDeleted. -- Note also that if we pack the dBase here, -- there's no recovery for a deleted file. to handle deleteRecord packFlag get setDBRecordDeleted(1) if it < 0 request getDBErrorString(it) break to system -- prevent notify messages end if if autoPack of this book is TRUE or packFlag is TRUE send packDataBase end if end deleteRecord -- Toggle the autoPack feature to handle autoPack -- from menu item get not (menuItemChecked(autoPack)) -- the toggle set autoPack of this book to it if it is TRUE check menuItem autoPack else uncheck menuItem autoPack end if end autoPack -- Simple wrapper for packDBFile to handle packDatabase sysCursor = 4 -- also moves to last record in database -- so, to prevent that: if checked of button "name" of page 1 set searchText to fieldValue(lastName) else set searchText to fieldValue(Company) end if get packDBFile() if it < 1 request getDBErrorString(it) break to system -- prevent notify messages else send resetDBase send findKey searchText send updateDisplay send updateRecords to field "records" get totalRecords of this book if it > 50000 -- Print Records can't deal with anything larger than this if it > 65531 request stringError("TooBig") else request stringError("AlmostTooBig") end if end if end if sysCursor = default end packDatabase -- workaround for dBase dll tracking problem to handle resetDBase currentRecord of this book = "next" currentRecord of this book = "previous" end resetDBase --******** For functions, errors must be handled by the caller ************* -- Simple wrapper for getDBKeyValue to get keyValue return getDBKeyValue() end keyValue -- Simple wrapper for getDBRecordNumber to get currentRecord return getDBRecordNumber() end currentRecord -- Simple wrapper for getDBRecordCount to get totalRecords return getDBRecordCount() end totalRecords --****************** printing ************ -- utility for printing a single record to handle printCurrentRecord sysCursor = 4 sysLockScreen = TRUE get objects of group "reportGroup" of page "Print Current Record" step i from 1 to itemCount(it) set text of item i of it to fieldValue(uppercase(name of item i of it)) set tPage to this page linkDLL "tb30win.dll" STRING getWinIniVar(STRING,STRING) end linkDLL get getWinIniVar("windows","device") unlinkDLL "tb30Win.DLL" if it is NULL request stringResource("BadPrinter") sysCursor = 1 break printCurrentRecord end if clear sysError sS = sysSuspend sysSuspend = FALSE start spooler if sysError <> NULL request stringResource("BadPrinter") sysCursor = 1 sysLockScreen = FALSE sysSuspend = sS break printCurrentRecord end if set sysSuspend to sS clear printerConditions printerStyle = "Pages" go to page "Print Current Record" print 1 pages end spooler go to tPage sysLockScreen = FALSE sysCursor = 1 end printCurrentRecord to handle printReport -- for hardwired report, see code below. -- first check if there is a printer hooked up clear sysError sS = sysSuspend sysSuspend = FALSE linkDLL "tb30win.dll" STRING getWinIniVar(STRING,STRING) end linkDLL get getWinIniVar("windows","device") unlinkDLL "tb30Win.DLL" if it is NULL request stringResource("BadPrinter") sysCursor = 1 break printReport end if -- pack the database, so that records displayed = total records of the dBase. request stringResource("PackDB") with stringResource("Yes") or stringResource("No") if it <> stringResource("Yes") break else send packDatabase end if -- The built in PrintReport is going to be used. Once -- that's started, there is no way to control it, meaning -- we have to be ready to go, and by the time we get to -- this point, there is really no way to back out of this -- gracefully. So we just take a deep breath and do it. -- This may take a while sysCursor = 4 -- nor do we want enterPage or leavePage messages. sysSuspendMessages = TRUE -- and we really don't want to see this! sysLockScreen = TRUE -- cache the current page tPage = this page -- cache the background we'll be using bgRB = background "report builder" go to first page of bgRB set currentRecord of this book to "First" -- this works because we've packed the database. set newPgCount to totalRecords of this book set rFObjs to objects of group "reportGroup" of bgRB -- change reference from explicit background to implicit page step i from 1 to itemCount(rFObjs) clear words 4 to 7 of item i of rFObjs end step set objCount to itemCount(rFObjs) -- now fill the first page, make another, fill it, etc. step i from 1 to newPgCount step j from 1 to objCount set text of item j of rFObjs to \ fieldValue(uppercase(name of item j of rFObjs)) end step if i < newPgCount set currentRecord of this book to "next" send newpage end if end step --=============== allow user to custom build the report ============= forward --=================================================== -->>>>>>>>>> alternative: a hardwired report <<<<<<<<<<< -- printerStyle = "groups" -- step i from objCount to 1 -- push name of item i of rFObjs onto tempStack -- end -- printerFields = tempStack -- printerGroupsAcross = 2 -- start spooler -- print newPgCount pages -- end --<<<<<<<<>>>>>>>>>>> -- now get rid of all those extra pages go to page 2 of bgRB step i from 2 to newPgCount send selectPage send clear end step step i from 1 to objCount clear text of item i of rFObjs end step go to tPage sysCursor = 1 end printReport --****************** Strings ********************* -- Special string functions to get stringOpenError dbf return "Error opening" && dbf & ". It is needed to run this application." \ && "Please put it in the same directory as"&& uniqueName of this book & "." end stringOpenError to get stringIndexError value return "error opening index file:" && value & \ ". It is needed to run this application." && \ "Please put it in the same directory as" && \ uniquename of this book & "." end stringIndexError -- Strings for all occassions. to get stringResource keyword conditions when keyword = "" return "" when keyword is "Edit" return "Ed&it" when keyword is "New" return "Ne&w" when keyword is "Yes" return "Yes" when keyword is "No" return "No" when keyWord is "YesNoWarning" return "Yes, no more warnings" when keyword is "escape" return "Cancel" when keyword is "DeleteWarning" return "This action will delete this record. Do you want to continue?" when keyword is "Browse" return "&Browse" when keyword is "nameSearch" return "Name to search for..." & CRLF & "(Search is case sensitive)" when keyword is "companySearch" return "Company to search for..." & CRLF & "(Search is case sensitive)" when keyword = "findDBKey3" if checked of button "name" = TRUE set keyType to "name" else set keyType to "company" end if return "String not found, next" && \ keyType && "record becomes the current record." when keyword = "BadPrinter" return "There is a problem with the printer. Make sure it is connected and turned on." when keyword = "findDBKey4" if checked of button "name" = TRUE set keyType to "name" else set keyType to "company" end if return "String not found, and search string is greater than last" && \ keyType && "record. Last record of this type becomes the current record." when keyword is "PackDB" return "This will require that all records marked for deletion are discarded." & CRLF & \ "This can take a while if there are a lot of records. Shall we continue?" when keyword is "contents" return "Contact.tbk" & CRLF & "A Simple dBaseIII Sample Application" & CRLF & \ 1994 Asymetrix Corp." & CRLF & "All Rights Reserved." else -- debug, not for international return "Error: String resource received unknown keyword" && \ keyword && "from target" && target & "." end conditions end stringResource -- Error strings to get stringError keyword, trgt conditions when keyword = "" return "" when keyword = "linkError" return "Could not link to TB30DB3.dll" when keyword is "NoMem" return "There is not enough system memory for this operation." && \ "Please shut down other applications and try again." when keyword is "stringToBig" get getDBFieldWidth(name of trgt) return "This field will only accept strings up to" && it && "characters long." when keyword is "BadDBase" return "This database is not compatable with Contact.tbk. Switching to Contact.dbf" when keyword is "TooBig" return "This Contact database has become so large as to be unprintable." && \ "This application was designed as a demonstration and was not intented for such heavy use." && \ "You should delete records that are no longer valid, or consider using a different database application." when keyword is "almostTooBig" return "This Contact database is becoming quite large. You should consider deleting unused records." else -- debug, not for international return "Error: Error string function received unknown keyword:" && \ keyword && "from target" && target & "." end stringError -- Help strings to get stringHelp keyword conditions when keyword = "" return "" when keyword = "Edit" return "Toggle between browse/edit mode" when keyword = "New" return "Insert a new record into the database" when keyword = "Delete" return "Delete the current record from the database" when keyword = "Search" return "Search the database for a key in the current index" when keyword = "reset" return "Reset field values" when keyword = "Update" return "Write field values to file" when keyword = "Next" return "Go to the next record" when keyword = "Previous" return "Go to the previous record" when keyword = "FirstName" return "Enter first name" when keyword = "LastName" return "Enter last name" when keyword = "Company" return "Enter company name" when keyword = "Notes" return "Enter notes about person" when keyword = "BillingCD" return "Enter billing code if applicable" when keyword = "Misc" return "Enter other personal information" when keyword = "fCountryCD" return "Enter fax country code" when keyword = "fAreaCode" return "Enter fax area code" when keyword = "fLocalNum" return "Enter fax number" when keyword = "fExtension" return "Enter fax extension" when keyword = "vCountryCD" return "Enter voice country code" when keyword = "vAreaCode" return "Enter voice area code" when keyword = "vLocalNum" return "Enter voice phone number" when keyword = "vExtension" return "Enter voice extension" when keyword = "name" return "Sort the records by last name first" when keyword = "companyButton" return "Sort the records by company first" when keyword = "viewByCompany" return "View name and company fields" when keyword = "viewByPhone" return "View name and phone fields" when keyword is "Records" if caption of button "Edit" is stringResource("Edit") return "Doubleclick to edit selection" else return "Doubleclick to browse selection" end if else -- debug, not for international return "Error: Help string function received unknown keyword:" && \ keyword && "from target" && target & "." end conditions end stringHelp DBEXCHNG.TBK R--*************************************************************************** -- Asymetrix dBase - Paradox - ToolBook Exchange -- 1991 - 1994 -- Asymetrix Corporation --Copyright 1991-1994 Asymetrix Corporation --This version authored by Jeff Ayars and Charles Hiestand --Asymetrix gives you permission to copy, revise and reuse the individual --objects and scripts in this application in your own applications. --You may not, however, copy the entire book (or a substantial part of it) --for redistribution as your own product. --Asymetrix retains the copyright on the original elements of this --application. Include the notice "Portions of this application are the --copyright of Asymetrix Corporation" in your product if they contain --objects or scripts copied from this application. --A note on language independence: For ease of translating this --application, all text strings visible to readers that come from scripts --are put into functions located at the bottom of this book script. --The names of these functions start with the letters: "str". -- handlers in this script: -- author set prompt for save changes -- enterApplication handle housekeeping -- leaveApplication clean up -- leavePage clean up per page -- ImportdBase go to option -- ExportdBase go to option -- dBaseHelp go to help page -- linkFile link tb30DOS.dll functions -- linkdBase link tb30db3.dll functions -- last go to page 10 if in reader -- User defined functions in this script: -- isAlNum test for alphaNumeric -- isNum test for numeric -- isAlpha test for alphabetic -- isPosInt test for positive integer -- nameOnly return prefix of file name only. --*************************************************************************** to handle enterApplication system s_firstFlag s_firstFlag = true set sysChangesdb to FALSE if sysRuntime is TRUE request strRuntime() send exit to system break to system end if send reader show mainWindow show viewer "splash" send linkFile send linkdBase send linkPX get initializePX("DBExchange") if it < 0 -- if SHARE.EXE is not running, an error will occur here -- request getPXErrorString(it) request "DBEXCHNG.TBK needs SHARE.EXE to work correctly. Please leave Windows and from the DOS prompt type ""share"" followed by the enter key. You can then re-enter Windows and start DBEXCHNG.TBK" request "DBEXCHNG.TBK will now exit." send exit to system break to system end if send sizeToPage -- center window on screen pause 2 seconds forward close viewer "splash" end enterApplication to handle leaveApplication get exitPX() forward end leaveApplication to handle idle -- make sure the screen is centered --(sometimes in 640 X 480 there is a problem) system s_firstFlag forward if s_firstFlag = TRUE send sizeToPage clear s_firstFlag end if end idle --ask to saveChanges if they have switched to author mode. to handle author set sysChangesDB to TRUE forward send sizeToPage end author to handle reader forward send sizeToPage end reader to handle last if sysLevel is reader go to page "Export" else forward end if end last --********************************************************************* --handlers for custom menu alias messages --********************************************************************* to handle menuItemSelected menuItem, menuAlias conditions when menuItem is "ImportFromDbaseFile" go to page "import Dbase" when menuItem is "ExportToDbase" go to page "export DBase" when menuItem is "ImportFromParadox" go to page "import Paradox" when menuItem is "ExportToParadox" go to page "export Paradox" else forward end conditions end menuItemSelected to handle dBaseHelp system STRING svReturnPage syscursor = 4 -- Do not want to send leave or enterPage because user will -- lose work sysSuspendMessages = TRUE -- Do not modify return page if they are already in help if name of this background <> "exchangeHelp" svReturnPage = name of this page end if if name of this page contains "export" go to page "exporting ToolBook to dBase" else go to page "importing dBase to Toolbook" end if sysCursor = default -- needed because syssuspendmessages set to TRUE end dBaseHelp to handle aboutdBase show viewer "splash" -- request strAboutDbase() end aboutdBase --***************************************************************************** --handlers to link DLL functions used by the book --***************************************************************************** --link functions for file dll to handle linkFile sysSuspend = FALSE clear sysError linkDLL sysToolBookDirectory & "tb30dos.dll" INT fileExists(STRING) STRING getFileList(STRING) end linkDLL if syserror is not null request strNoDll ("TB30DOS.DLL") send exit to system break to system end if set syserror to null linkDLL sysToolBookDirectory & "tb30dlg.dll" STRING OpenFileDlg(STRING,STRING,STRING,STRING,INT) STRING saveAsDlg(STRING,STRING,STRING,STRING,INT) end linkDLL if syserror is not null request strNoDll ("TB30DLG.DLL") send exit to system break to system end if linkDLL "kernel" WORD GlobalAlloc(WORD,DWORD) WORD GlobalFree(WORD) POINTER GlobalLock(WORD) WORD GlobalUnlock(WORD) end linkDLL sysSuspend = TRUE end linkFile to handle linkdBase sysSuspend = FALSE clear sysError linkdll sysToolBookDirectory & "tb30DB3.DLL" INT checkDBIndex(STRING) INT closeAllDBFiles() INT closeDBFile(STRING) INT closeDBIndexFile(STRING) WORD createDBFieldTag(WORD) INT createDBFile(STRING,WORD,WORD) INT createDBIndexFile(STRING,STRING,WORD,WORD) INT deleteDBFile(STRING) INT deselectDBIndexFile() INT findDBKey(STRING) INT firstDBKey() INT firstDBRecord() INT freeDBFieldTag(WORD) STRING getDBDateFormat() STRING getDBErrorString(INT) INT getDBFieldCount() STRING getDBFieldName(WORD) INT getDBFieldPrecision(STRING) INT getDBFieldType(STRING) STRING getDBFieldValue(STRING) INT getDBFieldWidth(STRING) STRING getDBFileName() STRING getDBIndexExpression() STRING getDBIndexFileName() INT getDBKeyType() STRING getDBKeyValue() INT getDBNavigateToDeleted() LONG getDBRecordCount() INT getDBRecordDeleted() LONG getDBRecordNumber() INT gotoDBRecord(DWORD) INT lastDBKey() INT lastDBRecord() INT nextDBKey() INT nextDBRecord() INT openDBFile(STRING) INT openDBIndexFile(STRING) INT packDBFile() INT previousDBKey() INT previousDBRecord() INT reindexDBFile(STRING) INT removeDBRecords(DWORD,DWORD) INT selectDBFile(STRING) INT selectDBIndexFile(STRING) INT setDBDateFormat(STRING) INT setDBFieldTag(WORD,WORD,STRING,STRING,WORD,WORD) INT setDBFieldValue(STRING, STRING) INT setDBNavigateToDeleted(INT) INT setDBRecordDeleted(WORD) INT writeDBRecord(DWORD) end linkdll if sysError <> null request "Could not link to TB30db3.dll" end if set sysSuspend to true if sysError <> null request strNoDLL("TB30DB3.DLL") end if sysSuspend = TRUE end linkdBase to handle linkPX -- all are linked, not all are used linkDLL sysToolBookDirectory & "tb30PDX.DLL" INT addPXKey(STRING,STRING,INT) --PXKeyAdd() INT addPXPassword(STRING) --PXPswAdd() INT addPXTable(STRING,STRING) --PXTblAdd() INT appendPXRecord(STRING) --PXRecAppend() INT clonePXBlob(STRING,STRING) --PXBlobClone() INT closePXBitmapWindow(WORD) INT closePXBlob(INT,INT) --PXBlobClose() INT closePXTable(STRING) --PXTblClose() INT copyPXTable(STRING,STRING) --PXTblCopy() INT createPXTable(STRING,STRING,STRING) --PXTblCreate() INT decryptPXTable(STRING) --PXTblDecrypt() INT deletePXPassword(STRING) --PXPswDel() INT deletePXRecord(STRING) --PXRecDelete() INT deletePXTable(STRING) --PXTblDelete() INT doesPXTableExist(STRING) --PXTblExist() INT dropPXBlob(STRING,STRING) --PXBlobDrop() INT dropPXKey(STRING,STRING,WORD) --PXKeyDrop() INT emptyPXField(STRING,STRING) INT emptyPXRecord(STRING) --PXRecBufEmpty() INT emptyPXTable(STRING) --PXTblEmpty() INT encryptPXTable(STRING,STRING) --PXTblEncrypt() INT exitPX() --PXExit() INT freePXGraphicBlob(WORD) INT freePXGraphicBlobPalette(WORD) INT firstPXRecord(STRING) --PXRecFirst() LONG getPXBitmapSize(WORD) LONG getPXBlob(INT,DWORD,LONG) --PXBlobGet() LONG getPXBlobQuick(STRING,STRING,INT) --PXBlobQuickGet() LONG getPXBlobSize(INT) --PXBlobGetSize() STRING getPXErrorString(INT) --return error string INT getPXFieldCount(STRING) --PXRecNFlds() STRING getPXFieldNames(STRING) STRING getPXFieldType(STRING,STRING) --PXFldType() STRING getPXFieldValue(STRING,STRING) LONG getPXFileSize(STRING) LONG getPXGraphicBlob(INT) LONG getPXGraphicBlobPalette(INT) INT getPXKeyFieldCount(STRING) --PXKeyNFlds() INT getPXMaxFiles() INT getPXMaxLocks() INT getPXMaxTables() INT getPXSwapSizeFromINI() INT getPXMaxTablesFromINI() INT getPXMaxFilesFromINI() INT getPXMaxLocksFromINI() STRING getPXMemoBlob(INT) STRING getPXNetErrorUser() --PXNetErrUser() STRING getPXNetUserName() --PXNetUserName() LONG getPXRaw(STRING,INT) --PXRawGet() INT getPXRawDataSize(STRING) LONG getPXRecordCount(STRING) --PXTblNRecs() LONG getPXRecordNumber(STRING) --PXRecNum() STRING getPXSortOrder() INT getPXSwapSize() STRING getPXUserInfo() INT gotoPXNetRecordLock(STRING,INT) --PXNetRecGotoLock() INT gotoPXRecord(STRING,LONG) --PXRecGoto() INT initializePX(STRING) --PXWinInit() INT insertPXRecord(STRING) --PXRecInsert() INT isPXNetRecordLocked(STRING) --PXNetRecLocked() INT isPXNetTableChanged(STRING) --PXNetTblChanged() INT isPXTableProtected(STRING) --PXTblProtected() INT lastPXRecord(STRING) --PXRecLast() INT lockPXNetFile(STRING,INT) --PXNetFileLock() LONG lockPXNetRecord(STRING) --PXNetRecLock() INT lockPXNetTable(STRING,INT) --PXNetTblLock() LONG mapPXKey(STRING,STRING,STRING,INT) --PXKeyMap() INT nextPXRecord(STRING) --PXRecNext() LONG openPXBitmapWindow(WORD,WORD,WORD,STRING,INT,STRING) LONG openPXBlobRead(STRING,STRING) --PXBlobOpenRead() LONG openPXBlobWrite(STRING,STRING,LONG,INT)--PXBlobOpenWrite() INT openPXTable(STRING,STRING,INT,INT) --PXTblOpen() INT packPXTable(STRING) INT previousPXRecord(STRING) --PXRecPrev() STRING queryPXKey(STRING) --PXKeyQuery() INT refreshPXNetTable(STRING) --PXNetTblRefresh() INT renamePXTable(STRING,STRING) --PXTblRename() INT savePX() --PXSave() INT searchPXField(STRING,STRING,WORD,INT) INT searchPXKey(STRING,INT,STRING,INT) --PXSrchKey() INT setPXBitmapWindowInfo(WORD,WORD,WORD,INT,STRING) INT setPXBlob(INT,DWORD,LONG,WORD) --PXBlobPut() INT setPXBlobFromFile(INT,DWORD,DWORD,DWORD,STRING)--PXBlobPut() INT setPXFieldValue(STRING,STRING,STRING) --PXPutAlpha(), PXPutDate(), PXPutDouble(), PXPutLong(), PXPutShort() INT setPXGraphicBlob(INT,WORD,WORD) --PXBlobPut() INT setPXGraphicBlobFromFile(INT,STRING) --PXBlobPut() INT setPXINIMaxFiles(INT) --PXSetDefaults() INT setPXINIMaxLocks(INT) --PXSetDefaults() INT setPXINIMaxTables(INT) --PXSetDefaults() INT setPXMemoBlob(INT,STRING) --PXBlobPut() INT setPXRaw(STRING,INT,INT) --PXRawPut() INT setPXSortOrder(STRING) INT setPXINISwapSize(INT) INT setPXTableCreateMode(INT) --PXTblCreateMode() INT setPXTableMaxSize(INT) --PXTblMaxSize() INT setPXUserInfo(STRING) INT unlockPXNetFile(STRING,INT) --PXNetFileUnlock() INT unlockPXNetRecord(STRING,INT) --PXNetRecUnlock() INT unlockPXNetTable(STRING,INT) --PXNetTblUnlock() INT updatePXRecord(STRING) --PXRecUpdate() INT upgradePXTable(STRING) --PXTblUpgrade() LONG writePXBlobToFile(INT,STRING,INT) --PXBlobPut() LONG writePXGraphicBlobToFile(INT,STRING,INT)--PXBlobPut() end linkDLL clear sysError end linkPX --************************************************************************* --Functions to support data validation and error checking --************************************************************************* -- We test the ANSI number of each character. -- See page C-4 (appendix C) of the ToolBook User Manual. to get isAlNum string local LONG i step i from 1 to charCount(string) get charToAnsi(char i of string) if (it >= 0 and it <= 47) or \ (it >= 91 and it <= 96) or \ (it >= 58 and it <= 64) return FALSE end if end step return TRUE end isAlNum to get isAlpha string local INT i step i from 1 to charCount(string) get charToAnsi(char i of string) if ( it >= 0 and it <= 64) or (it >= 91 and it <= 96) or (it > 127) return FALSE end if end step return TRUE end isAlpha -- Instead of replacing ever call to these ToolBook 1.5 functions, -- they have been rewritten using the new 3.0 functionality. to get isNum str return isType(REAL, str) end isNum --boolean test for a positive integer to get isPosInt str return evaluate(isType(INT,str) and str >= 0) end isPosInt -- get just the file name from a fully qualified path to get nameOnly fFile local WORD vOffset set vOffset to offset ("\",fFile) while vOffset > 0 clear chars 1 to vOffset of fFile set vOffset to offset ("\",fFile) end while return fFile end nameOnly to get strHelp return "Help" end strHelp to get strAboutDbase -- debug: better about return "dBaseIII (tm) - Paradox (tm) - ToolBook (tm) Exchange" & crlf & \ "Copyright (c) 1991 - 1994 -- Asymetrix Corporation" end strAboutDbase to get strCloseInstances return "Please close all other instances of ToolBook." end strCloseInstances to get strRuntime return "This application will only work with the full authoring ToolBook system. It will now close, please restart it using mtb30.EXE" end strRuntime to get strdbf return "&dBase" end strdbf to get strDBFileCreationError fName return "There was an error creating dBase file:" && fName end strDBFileCreationError to get strDBFileOpenError fName return "There was an error opening dBase file:" && fName end strDBFileOpenError to get strErrNoDBF return "There is no current dBase file. Please select one." end strErrNoDBF to get strErrRefdbField fField return "Error referencing dBase field: " & fField end strErrRefdbField to get strErrDBFWrite return "Error writing dBase record." end strErrDBFWrite to get strErrSetDBF fField return "There was an error setting value of dBase field: " & fField end strErrSetDBF to get strErrTag return "Error creating dBase field tag." end strErrTag to get strErrTbkExe request "There was an error running mtb30.exe." return FALSE end strErrTbkExe to get strExportDone errCount if errCount = 0 return "Export completed." else return "Export completed: There were" && errCount && "field(s) with" && \ "invalid data." end if return "Export completed." end strExportDone to get strNoDBFFields return "No dBase fields have been selected yet." end strNoDBFFields to get strNoDLL fName return "Can't find" && fName & ". Please copy this file to a directory that's in your path, or change your path to include"&&fname&"'s directory, then open this book again." end strNoDLL to get strSelTBFields return "Please select ToolBook fields for export." end strSelTBFields to get strSetDBName return "Please enter a dBase file name." end strSetDBName to get strTagErr index return "Error setting field tag for field " && index & "." end strTagErr to get strTBErrorRef fName return "There was an error referencing book: " & fname end strTBErrorRef to get strTBrecordError fField return "Error referencing record field:" && fField end strTBrecordError to get strEnterDBfile return "Please enter a valid dBase file name." end strEnterDBfile to get strNoOpenDBfile return "File cannot be opened. Please enter a valid dBase file name." end strNoOpenDBfile to get strNoNameOrType return "There is no name or type for one of the fields. Please set the values." end strNoNameOrType to get strSeldBFileName return "Please select a dBase file name." end strSeldBFileName to get strErrListdBFile return "Error listing fields for this dBase file." end strErrListdBFile to get strSelTBKFileName return "Please select a ToolBook file name." end strSelTBKFileName to get strNoNameRecFfl return "No named, ungrouped record fields were found on the last page of this ToolBook file." end strNoNameRecFfl to get strTwoShareName return "Two or more record fields share the same name in this book. Please give all recordfields unique names." end strTwoShareName to get strNoRecIndBase return "There are no records in this dBase file." end strNoRecIndBase to get strErrorFirstdBRec return "Error getting the first record in this dBase file." end strErrorFirstdBRec to get strErrorGetdBValue curFld, totrecs return "Error getting value for field" && \ curFld && "in record number" && totrecs & "." end strErrorGetdBValue to get strErrSetdBValue curfld, totrecs return "Error setting value for record field" && \ curfld && "in record number" && totrecs & "." end strErrSetdBValue to get strToManyFlds return "You are importing more fields than can be displayed on the page." && \ "You will have to arrange the fields after the book is built." end strToManyFlds to get strOK return "OK" end strOK to get strCancel return "Cancel" end strCancel to get strPlChooseBook return "Please choose the book to export." end strPlChooseBook to get strChooseBook return "Choose Book" end strChooseBook to get strPlChooseDbase return "Please choose the dBase file to import." end strPlChooseDbase to get strChoosedBase return "Choose dBase File" end strChoosedBase to get strFieldOverrun fType return "You have exceeded the size limits of a " & fType && ".dbf field." end strFieldOverrun to get strPrecisionError return "Decimal precision must be either zero or at least two less than the field width." end strPrecisionError to get strAskDateFormat fldName return "Enter the ToolBook date format of the text in record field" && \ fldName & "." end strAskDateFormat to get strdBnameExist dbName return "Filename" && dbName && "already exists. Replace it?" end strdBnameExist to get strSavedBaseFile return "Save dBase file as:" end strSavedBaseFile to get strSavePXFile return "Save Paradox file as:" end strSavePXFile to get strCharWidth return "Character width must be between 1 and 255." end strCharWidth to get strNumWidth return "Numeric width must be between 1 and 19." end strNumWidth to get strWidthNull return "Width cannot be blank." end strWidthNull to get strDecimalNull return "Decimal cannot be blank." end strDecimalNull to get strDecimal15 return "Decimal cannot be greater than 15." end strDecimal15 to get strNameToLarge return "A dBase field name can only be up to 10 characters." end strNameToLarge to get strNameNull return "A dBase field name cannot have a blank name." end strNameNull to get strChar1Num return "A dBase field name cannot start with a number." end strChar1Num to get strNotPage return "This is not a functioning page for this book. It is used to build the front end." end strNotPage to get strYes return "Yes" end strYes to get strTooTooManyFields num return "You can only build the new application with" && num && "fields if you" \ && "don't include label fields. Do you want to eliminate the label fields?" end strTooTooManyFields to get strWayTooManyFields return "You have selected more fields than this application can handle." \ && "Please try again with less fields." end strWayTooManyFields to get strNoLabels return "No label fields" end strNoLabels to get strNo return "No" end strNo ANIMATE.TBK 1993,1994. Asymetrix Corporation. All Rights Reserved. -- Asymetrix gives you permission to copy, revise, and reuse the -- individual objects and scripts in this application in your own -- applications. You may not copy the entire book (or a -- substantial part of it) for redistribution as your own product. -- Asymetrix retains the copyright on the original elements of this -- application. Include the notice "Portions 1993, 1994. -- Asymetrix Corporation. All Rights Reserved." in your product -- if they contain objects or scripts copied from this application. -- tableOfContents message sent by toolbar send when the -- tableOfContents is pressed --============== Standard ToolBook messages =================== -- set up the menus, initialize Back handling to handle enterApplication forward set enabled of button "back" of page "toolbar" to false if sysRuntime is false add menu "&Contents" at author with helpText "Options for modifying content of this template." add menuitem "Template &Outline" alias "outline" to menu "contents" at author with helptext\ "Displays/hides Template Outline palette." add menuitem "" to menu "contents" at author add menuitem "New &Chapter..." to menu "contents" at author with helptext\ "Adds new chapter to this book." add menuitem "Change C&hapter Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of current chapter." add menuitem "" to menu "contents" at author add menuitem "New &Topic..." to menu "contents" at author with helptext\ "Adds new topic to this chapter." add menuitem "Change To&pic Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of topic chapter." add menuitem "Using this &Template" alias "helpTemplate" to menu "help" position 2 at author with helptext\ "Displays help on using this template." if firstTime of this book is not false open viewer "outline" send rebuildStructure firstTime of this book = false end if not animSysbookLoaded() request "The path animation sysbook is not loaded. Animations in the ""Path Animation"" sections will not run. Be sure that either mtb30.sbk or mtb30ani.sbk are included in your startupSysbooks." hide button "help" of page "toolbar" -- initialize checkmarks bk = topicsBackground() step i from 1 to pagecount of bk set visited of page i of bk to false set checked of group "tableofcontents" of page "tableOfContents" to false if syslevel is author send reader to handle entermenu menuName,menuAlias if menuName is "contents" and syslevel is author if this background is chaptersBackground() enable menuitem "Change Chapter Name..." in menu "contents" at author else disable menuitem "Change Chapter Name..." in menu "contents" at author end if this background is TopicsBackground() enable menuitem "Change Topic Name..." in menu "contents" at author else disable menuitem "Change Topic Name..." in menu "contents" at author end if visible of viewer "outline" check menuitem "outline" in menu "contents" at author else uncheck menuitem "outline" in menu "contents" at author end forward to handle leaveapplication remove menu "Contents" at author remove menuitem "helpTemplate" in menu "help" at author forward to handle author if isOpen of viewer "outline" set fw to focusWindow show viewer "outline" set focusWindow to fw show button "help" of page "toolbar" forward to handle reader forward if isOpen of viewer "outline" hide viewer "outline" hide button "help" of page "toolbar" send sizeToPage to handle outline mstate = menuItemChecked("outline" in menu "contents" at author,mainwindow) if mstate is true if isOpen of viewer "outline" close viewer "outline" end else open viewer "outline" send rebuildStructure show viewer "outline" -- if a newbackground is inserted into the content area, -- move it beyond the content area to handle newBackground get chapterCount of this book if it < chapterLimit() forward lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) if pagenumber of this page < lastPage pageNumber of this page = lastPage end else request "This template is limited to" && chapterLimit() && "chapters." --================ Utility handlers =================== -- returns number of chapters allowed in this template to get chapterLimit return 8 -- returns the background reference for the chapter headings background to get chaptersBackground return background "chapter headings" -- returns the background reference for the chapter topics background to get topicsBackground return background "topics" to handle rebuildStructure updatePalette if updatePalette is null updatePalette = true local pagesOfEachChapter,curPage,curBackground,prevChapterHeadingPage,chapterList,listBoxText pageNumber of page "tableofcontents" = 1 pagenumber of first page of chaptersBackground() = 2 lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageCounter = 2 chapterCount = 0 while pageCounter <= lastPage curPage = page pageCounter curPageId = idnumber of curPage curBackground = parent of curPage pagelabel = label of curPage conditions when curBackground is chaptersBackground() increment chapterCount if prevChapterHeadingPage is not NULL myPages of prevChapterHeadingPage = pagesOfEachChapter clear pagesOfEachChapter end prevChapterHeadingPage = curPage curChapterId = curPageId myChapterID of curPage = curChapterID if chapterList is not null put crlf after chapterList end put curPageId & "," & pageLabel after chapterList put pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter when curBackground is topicsBackground() if pagesOfEachChapter is not null put "," after pagesOfEachChapter end put idnumber of curPage after pagesOfEachChapter myChapterID of curPage = curChapterID put tab & pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter else -- this page is not of either background. Move it beyond both backgrounds pageNumber of curPage = lastPage decrement lastPage end myPages of prevChapterHeadingPage = pagesOfEachChapter voutline of group "tableOfContents" of page "tableOfContents" = chapterList clear last char of listBoxText clear last char of listBoxText if updatePalette if isOpen of viewer "outline" send initPage listBoxText to currentPage of viewer "outline" end in mainWindow send initPage to this page chapterCount of this book = chapterCount -- Used to get the text before a tab of a textline -- (in the list box of a dialog viewer, tab is used -- to store extra information that gets clipped by the -- right side of the field) to get extractName t if first char of t is tab clear first char of t tabOffset = offset(tab,t) if tabOffset is 0 return null else return chars 1 to tabOffset-1 of t -- Used to get the text beyond a tab of a textline to get extractID t lastTabLoc = charcount(t) decrement lastTabLoc until lastTabLoc <=0 or char lastTabLoc of t is tab if lastTabLoc <=0 return null else return chars lastTabLoc+1 to charcount(t) of t -- returns the numerical location of an item in a list to get itemOffset itm,lst step i from 1 to itemcount(lst) pop lst if it = itm return i end return 0 -- returns a gray color to get middleGray return 240,63.5,2.1875 -- returns dark blue to get darkBlue return 240,25.125,100 -- returns a string of tabs. This serves a spacer between the -- label of a page and the idnumber on each line in the listbox. -- This is used so the idnumber is clipped and not visible to get tabSpacer return tab&tab&tab&tab&tab&tab&tab&tab&tab&tab --============= Navigation and menu messages ============= -- tableOfContents message sent by toolbar -- when the tableOfContents button is pressed to handle tableOfContents pref = page "tableOfContents" send updatechecks to group "tableofcontents" of pref go to pref to handle helpTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt1" of bref open vref show vref sysErrorNumber = sen sysError = se to handle initPage to handle newChapter promptForName get chapterCount of this book if it < chapterLimit() if promptForName is null promptForName = true end chapterName = "Untitled" if promptForName ask "Enter new chapter name." with chapterName if syserror = cancel break end chapterName = it end in mainwindow ls = lockscreen of this window lockscreen of this window = true -- go to a clean page so that leavePage messages are sent -- then suspend messages and navigate to the last page of the -- appropriate background so that enterPage messages are not sent go to page 1 ssm = syssuspendmessages syssuspendmessages = true go to last page of chaptersBackground() send newPage syssuspendmessages = ssm set label of this page to chapterName lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) set pageNumber of this page to lastPage send rebuildStructure send enterPage to this page set enabled of button "tableOfContents" of page "toolbar" to true lockscreen of this window = ls end else request "This template is limited to" && chapterLimit() && "chapters." to handle newTopic pageNum chapterName = "Untitled" if pageNum is null ask "Enter new topic name." with chapterName if syserror = cancel break end chapterName = it in mainWindow if pageNum is null conditions when this background is chaptersBackground() when this background is topicsBackground() pageNum = pageNumber of this page else lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageNum = lastPage end end ls = lockscreen of this window lockscreen of this window = true -- go to a clean page so that leavePage messages are sent -- then suspend messages and navigate to the last page of the -- appropriate background so that enterPage messages are not sent go to page 1 ssm = syssuspendmessages syssuspendmessages = true if this background is not topicsBackground() go to last page of topicsBackground() end send newPage syssuspendmessages = ssm set label of this page to chapterName set pageNumber of this page to pageNum+1 send rebuildStructure send enterPage to this page set enabled of button "tableOfContents" of page "toolbar" to true lockscreen of this window = ls to handle changeName ask "Enter new name." with label of this page if syserror = cancel break label of this page = it send rebuildStructure to handle saveAs firstTime of this book = true forward to handle aboutAnimate show viewer "about" as modal to get animSysbookLoaded if sysbooks contains "mtb30.sbk" or sysbooks contains "mtb30anm.sbk" return true else return false ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||k |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| O O E O |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| E E O |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| : + EO |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ! :+ |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ||||||| CBT_DEMO.TBK H)H)-- -- Copyright 1994 Asymetrix Corporation -- -- Asymetrix gives you permission to copy, revise, and reuse the -- individual objects and scripts in this application in your own -- applications. You may not copy the entire book (or a -- substantial part of it) for redistribution as your own product. -- -- Asymetrix retains the copyright on the original elements of this -- application. Include the notice "Portions of this application are -- the copyright of Asymetrix Corporation" in your product if they -- contain objects or scripts copied from this application. -- Author: Joseph Brick -- Last revision: 5/9/94 to handle enterApplication forward sysHistoryRecord = true go to page "introscreen" if sysRuntime is false add menu "&Contents" at author with helpText "Options for modifying content of this template." add menuitem "Template &Outline" alias "outline" to menu "contents" at author with helptext\ "Displays/hides Template Outline palette." add menuitem "" to menu "contents" at author add menuitem "New &Chapter..." to menu "contents" at author with helptext\ "Adds new chapter to this book." add menuitem "Change C&hapter Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of current chapter." add menuitem "" to menu "contents" at author add menuitem "New &Topic..." to menu "contents" at author with helptext\ "Adds new topic to this chapter." add menuitem "Change To&pic Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of topic chapter." add menuitem "Using this &Template" alias "helpTemplate" to menu "help" position 2 at author with helptext\ "Displays help on using this template." if firstTime of this book is not false open viewer "outline" send rebuildStructure firstTime of this book = false end send reader to handle entermenu menuName,menuAlias if menuName is "contents" and syslevel is author if this background is chaptersBackground() enable menuitem "Change Chapter Name..." in menu "contents" at author else disable menuitem "Change Chapter Name..." in menu "contents" at author end if this background is TopicsBackground() enable menuitem "Change Topic Name..." in menu "contents" at author else disable menuitem "Change Topic Name..." in menu "contents" at author end if visible of viewer "outline" check menuitem "outline" in menu "contents" at author else uncheck menuitem "outline" in menu "contents" at author end forward to handle leaveapplication set syslockscreen to true set captionBar of mainwindow to normal set state of mainwindow to normal remove menu "Contents" at author remove menuitem "helpTemplate" in menu "help" at author forward to handle author if isOpen of viewer "outline" set fw to focusWindow show viewer "outline" set focusWindow to fw set state of mainwindow to normal set captionBar of mainwindow to normal forward to handle reader forward if isOpen of viewer "outline" hide viewer "outline" set captionBar of mainwindow to none set state of mainwindow to maximized to handle outline mstate = menuItemChecked("outline" in menu "contents" at author,mainwindow) if mstate is true if isOpen of viewer "outline" close viewer "outline" end else open viewer "outline" send rebuildStructure show viewer "outline" -- if a newbackground is inserted into the content area, -- move it beyond the content area to handle newBackground forward lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) if pagenumber of this page < lastPage pageNumber of this page = lastPage --================ Utility handlers =================== -- returns the background reference for the chapter headings background to get chaptersBackground return background "chapterheadings" -- returns the background reference for the chapter topics background to get topicsBackground return background "content" to handle rebuildStructure updatePalette local chapterCounter chapterCounter = 0 if updatePalette is null updatePalette = true local pagesOfEachChapter,curPage,curBackground,prevChapterHeadingPage,chapterList,listBoxText pageNumber of page "introscreen" = 1 pagenumber of first page of chaptersBackground() = 2 lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageCounter = 2 while pageCounter <= lastPage curPage = page pageCounter curPageId = idnumber of curPage curBackground = parent of curPage pagelabel = label of curPage conditions when curBackground is chaptersBackground() increment chapterCounter if prevChapterHeadingPage is not NULL myPages of prevChapterHeadingPage = pagesOfEachChapter clear pagesOfEachChapter end prevChapterHeadingPage = curPage curChapterId = curPageId myChapterID of curPage = curChapterID if chapterList is not null put crlf after chapterList end put curPageId & "," & pageLabel after chapterList put pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter when curBackground is topicsBackground() chapter of curPage = chapterCounter if pagesOfEachChapter is not null put "," after pagesOfEachChapter end put idnumber of curPage after pagesOfEachChapter myChapterID of curPage = curChapterID put tab & pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter else -- this page is not of either background. Move it beyond both backgrounds pageNumber of curPage = lastPage decrement lastPage end myPages of prevChapterHeadingPage = pagesOfEachChapter voutline of group "tableOfContents" of background "Content" = chapterList clear last char of listBoxText clear last char of listBoxText if updatePalette if isOpen of viewer "outline" send initPage listBoxText to currentPage of viewer "outline" in mainWindow send enterpage to this page end end -- Used to get the text before a tab of a textline -- (in the list box of a dialog viewer, tab is used -- to store extra information that gets clipped by the -- right side of the field) to get extractName t if first char of t is tab clear first char of t tabOffset = offset(tab,t) if tabOffset is 0 return null else return chars 1 to tabOffset-1 of t -- Used to get the text beyond a tab of a textline to get extractID t lastTabLoc = charcount(t) decrement lastTabLoc until lastTabLoc <=0 or char lastTabLoc of t is tab if lastTabLoc <=0 return null else return chars lastTabLoc+1 to charcount(t) of t -- returns the numerical location of an item in a list to get itemOffset itm,lst step i from 1 to itemcount(lst) pop lst if it = itm return i end return 0 -- returns a gray color to get middleGray return 240,63.5,2.1875 -- returns dark blue to get darkBlue return 240,25.125,100 -- returns a string of tabs. This serves a spacer between the -- label of a page and the idnumber on each line in the listbox. -- This is used so the idnumber is clipped and not visible to get tabSpacer return tab&tab&tab&tab&tab&tab&tab&tab&tab&tab to handle helpTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt1" of bref open vref show vref sysErrorNumber = sen sysError = se to handle initPage to handle newChapter promptForName if promptForName is null promptForName = true chapterName = "Untitled" if promptForName ask "Enter new chapter name." with chapterName if syserror = cancel break end chapterName = it in mainwindow ls = lockscreen of this window lockscreen of this window = true go to last page of chaptersBackground() ssm = syssuspendmessages syssuspendmessages = true send newPage syssuspendmessages = ssm set label of this page to chapterName lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) set pageNumber of this page to lastPage send rebuildStructure send enterPage to this page lockscreen of this window = ls to handle newTopic pageNum chapterName = "Untitled" if pageNum is null ask "Enter new topic name." with chapterName if syserror = cancel break end chapterName = it in mainWindow if pageNum is null conditions when this background is chaptersBackground() when this background is topicsBackground() pageNum = pageNumber of this page else lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageNum = lastPage end end ls = lockscreen of this window lockscreen of this window = true if this background is not topicsBackground() go to last page of topicsBackground() end ssm = syssuspendmessages syssuspendmessages = true send newPage syssuspendmessages = ssm set label of this page to chapterName set pageNumber of this page to pageNum+1 send rebuildStructure send enterPage to this page lockscreen of this window = ls to handle changeName ask "Enter new name." with label of this page if syserror = cancel break label of this page = it send rebuildStructure to handle sizeToPage if syslevel is AUTHOR forward CBT_TIPS.TBK --==================== Standard ToolBook messages =================== to handle enterApplication forward -- link needed dll's linkDLL "tb30win.dll" int displayBitsPerPixel() -- these gdi calls are used for drawing separator line linkDLL "gdi" int getDeviceCaps(word,int) dword moveTo(word,int,int) int lineTo(word,int,int) int setROP2(word,int) word createPen(int,int,dword) int deleteObject(word) word selectObject(word,word) linkdll user word getDC(word) int releaseDC(word,word) if sysruntime is false add menuitem "Using this &Template" alias "helpTemplate" to menu "help" position 2 at author with helptext\ "Displays help on using this template." -- set backcolor (a "to set" handler, below) depending on -- the number of colors displayed. get numColors() if it > 16 or it = 0 set backcolor of this book to darkerBlue() else set backcolor of this book to lighterBlue() show viewer "navigationBar" in viewer "navigationBar" -- initialize combobox and field in navigation window set text of combobox "categories" to "<All topics>" send populate "All" to field "Topics" if sysLevel is not "reader" send reader else send hideControls to handle leaveApplication remove menuitem "helpTemplate" in menu "help" at author -- show buttons for modifying book to handle author forward send showControls to handle showControls show group "CategoryButtons" of page "Navigation" set item 4 of bounds of field "topics" of page "Navigation" to \ item 2 of bounds of group "CategoryButtons" of page "Navigation" - 60 send sizetopage -- hide buttons for modifying book to handle reader forward send hideControls to handle hideControls hide group "CategoryButtons" of page "Navigation" set item 4 of bounds of field "topics" of page "Navigation" to \ item 4 of bounds of group "CategoryButtons" of page "Navigation" send sizetopage to handle destroy -- if a page is deleted, updates the category array (struct[][]) userProperty -- of this book. -- Each row of the category array has the category name and a list -- of the id numbers of pages belonging to that category. This handler -- walks through the array, finding every instance of that id number. -- when found, it removes it. if object of target is "page" and name of parent of target is in "description and script,description and example,description only" local x[][] set x to categoryStruct of this book set pageID to idnumber of target step i from 1 to item 1 of dimensions(x) get itemOffset(pageID,x[i][2]) if it > 0 clear item it of x[i][2] end end set categoryStruct of this book to x forward to handle enterPage forward -- if this is a content background if name of parent of this page is in "description and script,description and example,description only" -- to ensure the recordfield is set to the label property -- the label property holds the name of each topic set fref to recordfield "subTopicName" of this page if text of fref is not label of this page set text of fref to label of this page end -- set the scroll of the recordfield, if necessary set fref to recordfield "explanation" if scroll of fref is not 0 set scroll of fref to 0 end -- add/remove scrollbars, if necessary set txtOver to textoverflow of fref conditions when txtOver > 0 and borderstyle of fref is "none" set borderstyle of fref to "scrolling" when txtOver = 0 and borderstyle of fref is "scrolling" set borderstyle of fref to "none" end to handle leavePage forward if name of parent of this page is in "description and script,description and example,description only" set topic to text of recordfield "subTopicName" if label of this page is not topic set label of this page to topic end --========================= Utility handlers =========================== -- returns the text before a tab to get extractName t set tabOffset to offset(tab,t) return chars 1 to tabOffset-1 of t -- returns the text following a tab to get extractID t set lastTabLoc to charcount(t) decrement lastTabLoc until lastTabLoc <=0 or char lastTabLoc of t is tab if lastTabLoc <=0 return null else return chars lastTabLoc+1 to charcount(t) of t -- returns the offset of item itm in list lst to get itemOffset itm,lst step i from 1 to itemcount(lst) pop lst if itm = it return i end return 0 -- removes all instances of a char from a string to get stripChar chr,strng while strng contains chr clear char offset(chr,strng) of strng return strng -- returns the number of colors displayed to get numColors hdc = getDC(windowhandle of mainWindow) retval = getDeviceCaps(hdc,24) get releaseDC(windowhandle of mainwindow,hdc) return retval to get darkerBlue return 212,79.1875,71.6875 to get lighterBlue return 180,75.125,100 to set backColor to value set bckgrnds to "intro,description and script,description and example,description only" step i from 1 to itemcount(bckgrnds) pop bckgrnds set curBack to background it if fillcolor of curBack is not value set fillcolor of curBack to value end --================ Handlers for dealing with array structure ============ -- display the array in a request box. -- (used during authoring for debugging purposes) to handle showCategoryStruct local x[][] set x to categoryStruct of this book local retval step i from 1 to item 1 of dimensions(x) put x[i][1] after retval put tab & x[i][2] & crlf after retval request retval --------------- these handers sort the array -------------------- to handle twoDquicksort fArray[][],n,dtype system stbk_noSwap set stbk_noSwap to 0 send twoDquicksrt fArray, 1, item 1 of dimensions(fArray),n,dtype to handle twoDquicksrt fArray[][], l, r,n,dtype system stbk_noSwap if r > l send swap fArray, l, ((l+r) div 2) set lst to l step i from (l+1) to r conditions when dtype is "text" set test to fArray[i][n] < fArray[l][n] as text when dtype is "date" set test to fArray[i][n] < fArray[l][n] as date else set test to fArray[i][n] < fArray[l][n] as number end if test increment lst send swap fArray, lst, i else increment stbk_noswap end if end step send swap fArray,l,lst send twoDquicksrt fArray, l, lst-1,n,dtype send twoDquicksrt fArray, lst+1,r,n,dtype end to handle swap fArray[][], a, b local temp step i from 1 to item 2 of dimensions (fArray) set temp to farray[a][i] set farray[a][i] to farray[b][i] set farray[b][i] to temp to handle helpTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt4" of bref open vref show vref sysErrorNumber = sen sysError = se CBT1.TBK -- Copyright 1994 Asymetrix Corporation -- -- Asymetrix gives you permission to copy, revise, and reuse the -- individual objects and scripts in this application in your own -- applications. You may not copy the entire book (or a -- substantial part of it) for redistribution as your own product. -- -- Asymetrix retains the copyright on the original elements of this -- application. Include the notice "Portions of this application are -- the copyright of Asymetrix Corporation" in your product if they -- contain objects or scripts copied from this application. -- Author: Joseph Brick -- Last revision: 5/9/94 --============== Standard ToolBook messages =================== -- set up the menus, initialize Back handling to handle enterApplication forward set enabled of button "back" of page "toolbar" to false if sysRuntime is false add menu "&Contents" at author with helpText "Options for modifying content of this template." add menuitem "Template &Outline" alias "outline" to menu "contents" at author with helptext\ "Displays/hides Template Outline palette." add menuitem "" to menu "contents" at author add menuitem "New &Chapter..." to menu "contents" at author with helptext\ "Adds new chapter to this book." add menuitem "Change C&hapter Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of current chapter." add menuitem "" to menu "contents" at author add menuitem "New &Topic..." to menu "contents" at author with helptext\ "Adds new topic to this chapter." add menuitem "Change To&pic Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of topic chapter." add menuitem "Using this &Template" alias "helpTemplate" to menu "help" position 2 at author with helptext\ "Displays help on using this template." if firstTime of this book is not false open viewer "outline" send rebuildStructure firstTime of this book = false end hide button "help" of page "toolbar" -- initialize checkmarks bk = topicsBackground() step i from 1 to pagecount of bk set visited of page i of bk to false set checked of group "tableofcontents" of page "tableOfContents" to false if syslevel is author send reader to handle entermenu menuName,menuAlias if menuName is "contents" and syslevel is author if this background is chaptersBackground() enable menuitem "Change Chapter Name..." in menu "contents" at author else disable menuitem "Change Chapter Name..." in menu "contents" at author end if this background is TopicsBackground() enable menuitem "Change Topic Name..." in menu "contents" at author else disable menuitem "Change Topic Name..." in menu "contents" at author end if visible of viewer "outline" check menuitem "outline" in menu "contents" at author else uncheck menuitem "outline" in menu "contents" at author end forward to handle leaveapplication remove menu "Contents" at author remove menuitem "helpTemplate" in menu "help" at author forward to handle author if isOpen of viewer "outline" set fw to focusWindow show viewer "outline" set focusWindow to fw show button "help" of page "toolbar" forward to handle reader forward if isOpen of viewer "outline" hide viewer "outline" hide button "help" of page "toolbar" to handle outline mstate = menuItemChecked("outline" in menu "contents" at author,mainwindow) if mstate is true if isOpen of viewer "outline" close viewer "outline" end else open viewer "outline" send rebuildStructure show viewer "outline" -- if a newbackground is inserted into the content area, -- move it beyond the content area to handle newBackground forward lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) if pagenumber of this page < lastPage pageNumber of this page = lastPage --================ Utility handlers =================== -- returns the background reference for the chapter headings background to get chaptersBackground return background "chapter headings" -- returns the background reference for the chapter topics background to get topicsBackground return background "topics" to handle rebuildStructure updatePalette if updatePalette is null updatePalette = true local pagesOfEachChapter,curPage,curBackground,prevChapterHeadingPage,chapterList,listBoxText pageNumber of page "tableofcontents" = 1 pagenumber of first page of chaptersBackground() = 2 lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageCounter = 2 while pageCounter <= lastPage curPage = page pageCounter curPageId = idnumber of curPage curBackground = parent of curPage pagelabel = label of curPage conditions when curBackground is chaptersBackground() if prevChapterHeadingPage is not NULL myPages of prevChapterHeadingPage = pagesOfEachChapter clear pagesOfEachChapter end prevChapterHeadingPage = curPage curChapterId = curPageId myChapterID of curPage = curChapterID if chapterList is not null put crlf after chapterList end put curPageId & "," & pageLabel after chapterList put pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter when curBackground is topicsBackground() if pagesOfEachChapter is not null put "," after pagesOfEachChapter end put idnumber of curPage after pagesOfEachChapter myChapterID of curPage = curChapterID put tab & pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter else -- this page is not of either background. Move it beyond both backgrounds pageNumber of curPage = lastPage decrement lastPage end myPages of prevChapterHeadingPage = pagesOfEachChapter voutline of group "tableOfContents" of page "tableOfContents" = chapterList clear last char of listBoxText clear last char of listBoxText if updatePalette if isOpen of viewer "outline" send initPage listBoxText to currentPage of viewer "outline" end in mainWindow send initPage to this page -- Used to get the text before a tab of a textline -- (in the list box of a dialog viewer, tab is used -- to store extra information that gets clipped by the -- right side of the field) to get extractName t if first char of t is tab clear first char of t tabOffset = offset(tab,t) if tabOffset is 0 return null else return chars 1 to tabOffset-1 of t -- Used to get the text beyond a tab of a textline to get extractID t lastTabLoc = charcount(t) decrement lastTabLoc until lastTabLoc <=0 or char lastTabLoc of t is tab if lastTabLoc <=0 return null else return chars lastTabLoc+1 to charcount(t) of t -- returns the numerical location of an item in a list to get itemOffset itm,lst step i from 1 to itemcount(lst) pop lst if it = itm return i end return 0 -- returns a gray color to get middleGray return 240,63.5,2.1875 -- returns dark blue to get darkBlue return 240,25.125,100 -- returns a string of tabs. This serves a spacer between the -- label of a page and the idnumber on each line in the listbox. -- This is used so the idnumber is clipped and not visible to get tabSpacer return tab&tab&tab&tab&tab&tab&tab&tab&tab&tab --============= Navigation and menu messages ============= -- tableOfContents message sent by toolbar -- when the tableOfContents button is pressed to handle tableOfContents pref = page "tableOfContents" send updatechecks to group "tableofcontents" of pref go to pref to handle helpTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt1" of bref open vref show vref sysErrorNumber = sen sysError = se to handle initPage to handle newChapter promptForName if promptForName is null promptForName = true chapterName = "Untitled" if promptForName ask "Enter new chapter name." with chapterName if syserror = cancel break end chapterName = it in mainwindow ls = lockscreen of this window lockscreen of this window = true go to last page of chaptersBackground() ssm = syssuspendmessages syssuspendmessages = true send newPage syssuspendmessages = ssm set label of this page to chapterName lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) set pageNumber of this page to lastPage send rebuildStructure send enterPage to this page lockscreen of this window = ls to handle newTopic pageNum chapterName = "Untitled" if pageNum is null ask "Enter new topic name." with chapterName if syserror = cancel break end chapterName = it in mainWindow if pageNum is null conditions when this background is chaptersBackground() when this background is topicsBackground() pageNum = pageNumber of this page else lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageNum = lastPage end end ls = lockscreen of this window lockscreen of this window = true if this background is not topicsBackground() go to last page of topicsBackground() end ssm = syssuspendmessages syssuspendmessages = true send newPage syssuspendmessages = ssm set label of this page to chapterName set pageNumber of this page to pageNum+1 send rebuildStructure send enterPage to this page lockscreen of this window = ls to handle changeName ask "Enter new name." with label of this page if syserror = cancel break label of this page = it send rebuildStructure CBT2.TBK -- Copyright 1994 Asymetrix Corporation -- -- Asymetrix gives you permission to copy, revise, and reuse the -- individual objects and scripts in this application in your own -- applications. You may not copy the entire book (or a -- substantial part of it) for redistribution as your own product. -- -- Asymetrix retains the copyright on the original elements of this -- application. Include the notice "Portions of this application are -- the copyright of Asymetrix Corporation" in your product if they -- contain objects or scripts copied from this application. -- Author: Joseph Brick -- Last revision: 5/9/94 to handle enterApplication forward go to page "introscreen" if sysRuntime is false add menu "&Contents" at author with helpText "Options for modifying content of this template." add menuitem "Template &Outline" alias "outline" to menu "contents" at author with helptext\ "Displays/hides Template Outline palette." add menuitem "" to menu "contents" at author add menuitem "New &Chapter..." to menu "contents" at author with helptext\ "Adds new chapter to this book." add menuitem "Change C&hapter Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of current chapter." add menuitem "" to menu "contents" at author add menuitem "New &Topic..." to menu "contents" at author with helptext\ "Adds new topic to this chapter." add menuitem "Change To&pic Name.." alias "changeName" to menu "contents" at author with helptext\ "Changes name of topic chapter." add menuitem "Using this &Template" alias "helpTemplate" to menu "help" position 2 at author with helptext\ "Displays help on using this template." if firstTime of this book is not false open viewer "outline" send rebuildStructure firstTime of this book = false end send reader to handle entermenu menuName,menuAlias if menuName is "contents" and syslevel is author if this background is chaptersBackground() enable menuitem "Change Chapter Name..." in menu "contents" at author else disable menuitem "Change Chapter Name..." in menu "contents" at author end if this background is TopicsBackground() enable menuitem "Change Topic Name..." in menu "contents" at author else disable menuitem "Change Topic Name..." in menu "contents" at author end if visible of viewer "outline" check menuitem "outline" in menu "contents" at author else uncheck menuitem "outline" in menu "contents" at author end forward to handle leaveapplication remove menu "Contents" at author remove menuitem "helpTemplate" in menu "help" at author forward to handle author if isOpen of viewer "outline" set fw to focusWindow show viewer "outline" set focusWindow to fw set state of mainwindow to normal set captionBar of mainwindow to normal forward to handle reader forward if isOpen of viewer "outline" hide viewer "outline" set captionBar of mainwindow to none set state of mainwindow to maximized to handle outline mstate = menuItemChecked("outline" in menu "contents" at author,mainwindow) if mstate is true if isOpen of viewer "outline" close viewer "outline" end else open viewer "outline" send rebuildStructure show viewer "outline" -- if a newbackground is inserted into the content area, -- move it beyond the content area to handle newBackground forward lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) if pagenumber of this page < lastPage pageNumber of this page = lastPage --================ Utility handlers =================== -- returns the background reference for the chapter headings background to get chaptersBackground return background "chapterheadings" -- returns the background reference for the chapter topics background to get topicsBackground return background "content" to handle rebuildStructure updatePalette local chapterCounter chapterCounter = 0 if updatePalette is null updatePalette = true local pagesOfEachChapter,curPage,curBackground,prevChapterHeadingPage,chapterList,listBoxText pageNumber of page "introscreen" = 1 pagenumber of first page of chaptersBackground() = 2 lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageCounter = 2 while pageCounter <= lastPage curPage = page pageCounter curPageId = idnumber of curPage curBackground = parent of curPage pagelabel = label of curPage conditions when curBackground is chaptersBackground() increment chapterCounter if prevChapterHeadingPage is not NULL myPages of prevChapterHeadingPage = pagesOfEachChapter clear pagesOfEachChapter end prevChapterHeadingPage = curPage curChapterId = curPageId myChapterID of curPage = curChapterID if chapterList is not null put crlf after chapterList end put curPageId & "," & pageLabel after chapterList put pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter when curBackground is topicsBackground() chapter of curPage = chapterCounter if pagesOfEachChapter is not null put "," after pagesOfEachChapter end put idnumber of curPage after pagesOfEachChapter myChapterID of curPage = curChapterID put tab & pageLabel & tabSpacer() & curPageId & crlf after listBoxText increment pageCounter else -- this page is not of either background. Move it beyond both backgrounds pageNumber of curPage = lastPage decrement lastPage end myPages of prevChapterHeadingPage = pagesOfEachChapter voutline of group "tableOfContents" of background "Content" = chapterList clear last char of listBoxText clear last char of listBoxText if updatePalette if isOpen of viewer "outline" send initPage listBoxText to currentPage of viewer "outline" in mainWindow send enterpage to this page end end -- Used to get the text before a tab of a textline -- (in the list box of a dialog viewer, tab is used -- to store extra information that gets clipped by the -- right side of the field) to get extractName t if first char of t is tab clear first char of t tabOffset = offset(tab,t) if tabOffset is 0 return null else return chars 1 to tabOffset-1 of t -- Used to get the text beyond a tab of a textline to get extractID t lastTabLoc = charcount(t) decrement lastTabLoc until lastTabLoc <=0 or char lastTabLoc of t is tab if lastTabLoc <=0 return null else return chars lastTabLoc+1 to charcount(t) of t -- returns the numerical location of an item in a list to get itemOffset itm,lst step i from 1 to itemcount(lst) pop lst if it = itm return i end return 0 -- returns a gray color to get middleGray return 240,63.5,2.1875 -- returns dark blue to get darkBlue return 240,25.125,100 -- returns a string of tabs. This serves a spacer between the -- label of a page and the idnumber on each line in the listbox. -- This is used so the idnumber is clipped and not visible to get tabSpacer return tab&tab&tab&tab&tab&tab&tab&tab&tab&tab to handle helpTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt1" of bref open vref show vref sysErrorNumber = sen sysError = se to handle initPage to handle newChapter promptForName if promptForName is null promptForName = true chapterName = "Untitled" if promptForName ask "Enter new chapter name." with chapterName if syserror = cancel break end chapterName = it in mainwindow ls = lockscreen of this window lockscreen of this window = true go to last page of chaptersBackground() ssm = syssuspendmessages syssuspendmessages = true send newPage syssuspendmessages = ssm set label of this page to chapterName lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) set pageNumber of this page to lastPage send rebuildStructure send enterPage to this page lockscreen of this window = ls to handle newTopic pageNum chapterName = "Untitled" if pageNum is null ask "Enter new topic name." with chapterName if syserror = cancel break end chapterName = it in mainWindow if pageNum is null conditions when this background is chaptersBackground() when this background is topicsBackground() pageNum = pageNumber of this page else lastPage = max(pagenumber of last page of chaptersBackground(),\ pagenumber of last page of topicsBackground()) pageNum = lastPage end end ls = lockscreen of this window lockscreen of this window = true if this background is not topicsBackground() go to last page of topicsBackground() end ssm = syssuspendmessages syssuspendmessages = true send newPage syssuspendmessages = ssm set label of this page to chapterName set pageNumber of this page to pageNum+1 send rebuildStructure send enterPage to this page lockscreen of this window = ls to handle changeName ask "Enter new name." with label of this page if syserror = cancel break label of this page = it send rebuildStructure to handle sizeToPage if syslevel is AUTHOR forward to handle exit syserror = null forward if syserror is null set syslockscreen to true set captionBar of mainwindow to normal set state of mainwindow to normal CBT4.TBK --==================== Standard ToolBook messages =================== to handle enterApplication forward -- link needed dll's linkDLL "tb30win.dll" int displayBitsPerPixel() -- these gdi calls are used for drawing separator line linkDLL "gdi" int getDeviceCaps(word,int) dword moveTo(word,int,int) int lineTo(word,int,int) int setROP2(word,int) word createPen(int,int,dword) int deleteObject(word) word selectObject(word,word) linkdll user word getDC(word) int releaseDC(word,word) if sysruntime is false add menuitem "Using this &Template" alias "helpTemplate" to menu "help" position 2 at author with helptext\ "Displays help on using this template." -- set backcolor (a "to set" handler, below) depending on -- the number of colors displayed. get numColors() if it > 16 or it = 0 set backcolor of this book to darkerBlue() else set backcolor of this book to lighterBlue() show viewer "navigationBar" in viewer "navigationBar" -- initialize combobox and field in navigation window set text of combobox "categories" to "<All topics>" send populate "All" to field "Topics" if sysLevel is not "reader" send reader else send hideControls to handle leaveApplication remove menuitem "helpTemplate" in menu "help" at author -- show buttons for modifying book to handle author forward send showControls to handle showControls show group "CategoryButtons" of page "Navigation" set item 4 of bounds of field "topics" of page "Navigation" to \ item 2 of bounds of group "CategoryButtons" of page "Navigation" - 60 send sizetopage -- hide buttons for modifying book to handle reader forward send hideControls to handle hideControls hide group "CategoryButtons" of page "Navigation" set item 4 of bounds of field "topics" of page "Navigation" to \ item 4 of bounds of group "CategoryButtons" of page "Navigation" send sizetopage to handle destroy -- if a page is deleted, updates the category array (struct[][]) userProperty -- of this book. -- Each row of the category array has the category name and a list -- of the id numbers of pages belonging to that category. This handler -- walks through the array, finding every instance of that id number. -- when found, it removes it. if object of target is "page" and name of parent of target is in "description and script,description and example,description only" local x[][] set x to categoryStruct of this book set pageID to idnumber of target step i from 1 to item 1 of dimensions(x) get itemOffset(pageID,x[i][2]) if it > 0 clear item it of x[i][2] end end set categoryStruct of this book to x forward to handle enterPage forward -- if this is a content background if name of parent of this page is in "description and script,description and example,description only" -- to ensure the recordfield is set to the label property -- the label property holds the name of each topic set fref to recordfield "subTopicName" of this page if text of fref is not label of this page set text of fref to label of this page end -- set the scroll of the recordfield, if necessary set fref to recordfield "explanation" if scroll of fref is not 0 set scroll of fref to 0 end -- add/remove scrollbars, if necessary set txtOver to textoverflow of fref conditions when txtOver > 0 and borderstyle of fref is "none" set borderstyle of fref to "scrolling" when txtOver = 0 and borderstyle of fref is "scrolling" set borderstyle of fref to "none" end to handle leavePage forward if name of parent of this page is in "description and script,description and example,description only" set topic to text of recordfield "subTopicName" if label of this page is not topic set label of this page to topic end --========================= Utility handlers =========================== -- returns the text before a tab to get extractName t set tabOffset to offset(tab,t) return chars 1 to tabOffset-1 of t -- returns the text following a tab to get extractID t set lastTabLoc to charcount(t) decrement lastTabLoc until lastTabLoc <=0 or char lastTabLoc of t is tab if lastTabLoc <=0 return null else return chars lastTabLoc+1 to charcount(t) of t -- returns the offset of item itm in list lst to get itemOffset itm,lst step i from 1 to itemcount(lst) pop lst if itm = it return i end return 0 -- removes all instances of a char from a string to get stripChar chr,strng while strng contains chr clear char offset(chr,strng) of strng return strng -- returns the number of colors displayed to get numColors hdc = getDC(windowhandle of mainWindow) retval = getDeviceCaps(hdc,24) get releaseDC(windowhandle of mainwindow,hdc) return retval to get darkerBlue return 212,79.1875,71.6875 to get lighterBlue return 180,75.125,100 to set backColor to value set bckgrnds to "intro,description and script,description and example,description only" step i from 1 to itemcount(bckgrnds) pop bckgrnds set curBack to background it if fillcolor of curBack is not value set fillcolor of curBack to value end --================ Handlers for dealing with array structure ============ -- display the array in a request box. -- (used during authoring for debugging purposes) to handle showCategoryStruct local x[][] set x to categoryStruct of this book local retval step i from 1 to item 1 of dimensions(x) put x[i][1] after retval put tab & x[i][2] & crlf after retval request retval --------------- these handers sort the array -------------------- to handle twoDquicksort fArray[][],n,dtype system stbk_noSwap set stbk_noSwap to 0 send twoDquicksrt fArray, 1, item 1 of dimensions(fArray),n,dtype to handle twoDquicksrt fArray[][], l, r,n,dtype system stbk_noSwap if r > l send swap fArray, l, ((l+r) div 2) set lst to l step i from (l+1) to r conditions when dtype is "text" set test to fArray[i][n] < fArray[l][n] as text when dtype is "date" set test to fArray[i][n] < fArray[l][n] as date else set test to fArray[i][n] < fArray[l][n] as number end if test increment lst send swap fArray, lst, i else increment stbk_noswap end if end step send swap fArray,l,lst send twoDquicksrt fArray, l, lst-1,n,dtype send twoDquicksrt fArray, lst+1,r,n,dtype end to handle swap fArray[][], a, b local temp step i from 1 to item 2 of dimensions (fArray) set temp to farray[a][i] set farray[a][i] to farray[b][i] set farray[b][i] to temp to handle helpTemplate mydir = name of self clear last char of mydir until last char of mydir is "\" or mydir is null sen = sysErrorNumber se = sysError sysErrorNumber = 0 ss = sysSuspend syssuspend = false bref = book (mydir&"tmplhelp.tbk") syssuspend = ss if sysErrorNumber is not 0 request "Cannot find book TMPLHELP.TBK" else vref = viewer "help" of bref set defaultpage of vref to page "cbt4" of bref open vref show vref sysErrorNumber = sen sysError = se CONTACT.TBK T--*************************************************************************** -- Asymetrix Contact: dBase sample app. -- -- Asymetrix Corporation 1994 -- Authored by Charles Hiestand & Jeff Ayars -- Copyright 1994 Asymetrix Corporation -- Asymetrix gives you permission to copy, revise and reuse the individual -- objects and scripts in this application in your own applications. -- You may not, however, copy the entire book (or a substantial part of it) -- for redistribution as your own product. -- Asymetrix retains the copyright on the original elements of this -- application. Include the notice "Portions of this application are the -- copyright of Asymetrix Corporation" in your product if they contain -- objects or scripts copied from this application. -- A note on language independence: For ease of translating this -- application, all text strings visible to readers that come from scripts -- are put into functions located at the bottom of this book script. --******************************************************************************* --************************ Handlers for built in messages *************************** -- initialize the path, the text fields, link TB30DB3.DLL, open the dBase files to handle enterApplication system s_bookPath system LOGICAL s_firstFlag sysLevel = reader sysCursor = none sysLockScreen = TRUE s_firstFlag = TRUE s_bookPath = name of this book while last character of s_bookPath <> "\" clear last character of s_bookPath end while send linkDB3 set sysCursor to default get OpenDBFile(s_bookPath & "contact.dbf") if it < 0 request stringOpenError("contact.dbf") else index of this book = "name.ndx" checked of button "name" = TRUE selectedTextlines of field "records" = 1 focus = field "records" send updateRecords to field "records" end if -- Make sure book is initialized to browse mode if caption of button "edit" of page 1 = stringResource("Browse") send buttonClick to button "edit" of page 1 end if sysLockScreen = FALSE show mainWindow show viewer "splash" forward pause 2 seconds close viewer "splash" end enterApplication to handle leaveApplication get closeAllDBFiles() unlinkDLL sysToolBookDirectory & "TB30DB3" forward end leaveApplication to handle idle -- we make doubly sure that the window sizes correctly system s_firstFlag forward if s_firstFlag is TRUE clear s_firstFlag send sizeToPage end if end idle -- Handles all the help messages in the status bar. -- The property "helpText" is either a keyword or null for every object in -- the book. StringHelp uses the keyword to return the displayed text. to handle mouseEnter caption of statusBar = stringHelp(helpText of target) end mouseEnter to handle mouseLeave caption of statusBar = " " end mouseLeave to handle enterMenu mName,mAlias if mName = "File" enable menuItem "printReport" end if forward end enterMenu -- "About", just the splash screen. to handle about show viewer "splash" as modal end about -- "Quick Help" to handle quickHelp show viewer "Quick Help" as modal end quickHelp -- Simple save handler -- More for creating and debugging to handle save forward send updateDB end save -- These prevent resizing problems in 640 X 480 mode. -- In higher modes, it may look better to not have these handlers. to handle reader forward send sizeToPage end reader to handle author forward send sizeToPage end author --******************************************************************************* --*********************** Handlers for custom messages ************************** -- Links all the functions, but not all functions are used to handle linkDB3 clear sysError sysSuspend = false -- we'll handle our own errors if linking fails clear sysError linkdll sysToolBookDirectory & "TB30DB3.DLL" INT checkDBIndex(STRING) INT closeAllDBFiles() INT closeDBFile(STRING) INT closeDBIndexFile(STRING) WORD createDBFieldTag(WORD) INT createDBFile(STRING,WORD,WORD) INT createDBIndexFile(STRING,STRING,WORD,WORD) INT deleteDBFile(STRING) INT deselectDBIndexFile() INT findDBKey(STRING) INT firstDBKey() INT firstDBRecord() INT freeDBFieldTag(WORD) STRING getDBDateFormat() STRING getDBErrorString(INT) INT getDBFieldCount() STRING getDBFieldName(WORD) INT getDBFieldPrecision(STRING) INT getDBFieldType(STRING) STRING getDBFieldValue(STRING) INT getDBFieldWidth(STRING) STRING getDBFileName() STRING getDBIndexExpression() STRING getDBIndexFileName() INT getDBKeyType() STRING getDBKeyValue() INT getDBNavigateToDeleted() LONG getDBRecordCount() INT getDBRecordDeleted() LONG getDBRecordNumber() INT gotoDBRecord(DWORD) INT lastDBKey() INT lastDBRecord() INT nextDBKey() INT nextDBRecord() INT openDBFile(STRING) INT openDBIndexFile(STRING) INT packDBFile() INT previousDBKey() INT previousDBRecord() INT reindexDBFile(STRING) INT removeDBRecords(DWORD,DWORD) INT selectDBFile(STRING) INT selectDBIndexFile(STRING) INT setDBDateFormat(STRING) INT setDBFieldTag(WORD,WORD,STRING,STRING,WORD,WORD) INT setDBFieldValue(STRING, STRING) INT setDBNavigateToDeleted(INT) INT setDBRecordDeleted(WORD) INT writeDBRecord(DWORD) end linkdll if sysError <> null request stringError("linkError") end if end linkDB3 -- Gets better scrolling behavior for the field "record". -- Many of the buttons on the page have notify handlers for this message to handle updateDisplay system ARRAY LONG s_recordNumbertoTextline[] oldFocus = focus currentScroll = scroll of field "records" newScroll = s_recordNumbertoTextline[currentRecord of this book] selectedTextlines of field "records" = newScroll -- size of the bottom scroll of the field is hardwired to "6" fieldSize = textLineCount(text of field "records") - 6 if newScroll > currentScroll + 6 scroll of field "records" = min(fieldSize,newScroll - 1) else if newScroll < currentScroll + 1 scroll of field "records" = max(newScroll - 6,0) end end if focus = oldFocus end updateDisplay --*********************** Wrappers for TB30DB3.DLL calls ************************ -- All calls to the DLL are made from here. The rest of the book always -- calls these handlers and functions to get to the DLL. -- Simple wrapper for getDBFieldValue to get fieldValue fieldName clear sysError get getDBFieldValue(fieldName) if sysError is not null request getDBErrorString(syserror) break to system -- prevent notify messages else return it end if return null end fieldValue -- Simple wrapper for findDBKey. Provides some feedback to the user for two -- special cases. FindDBKey returns 3 if it can't find the text, and returns 4 -- if the search text goes past the last key. -- Important: dBaseIII is case sensitive. "a" > "A" !!! to handle findKey searchString get findDBKey(searchString) conditions when it = 3 request stringResource("findDBKey3") when it = 4 request stringResource("findDBKey4") get lastDBKey() when it < 1 request getDBErrorString(it) break to system -- prevent notify messages end conditions end findKey -- Wrapper for indexing, handles errors until it gives up. to set index to value system STRING s_bookPath get getDBIndexFileName() if it is null or value is not in it get openDBIndexFile(s_bookPath & value) get checkDBIndex(s_bookPath & value) if it = 1 -- got it OK get selectDBIndexFile(s_bookPath & value) else get reindexDBFile(s_bookPath & value) if it = -53 -- no index with that name request stringIndexError(value) break to system else if it < 1 request getDBErrorString(it) break to system -- prevent notify messages end if end if end if end index --- Simple wrapper for dBase navigation to set currentRecord to value conditions when value = "first" get firstDBKey() when value = "last" get lastDBKey() when value = "next" get nextDBKey() when value = "previous" get previousDBKey() when isType(DWORD, value) and value > 0 get goToDBRecord(value) else break end conditions if it < 0 if it = -10 -- no such record -- set a flag for updateRecords in script of field "Records" of page 1 sysErrorNumber = 65535 else request getDBErrorString(it) break to system -- prevent notify messages end if end if end currentRecord -- Simple wrapper for setDBFieldValue to set fieldValue fieldName to value get setDBFieldValue(fieldName, value) if it < 0 request getDBErrorString(it) break to system -- prevent notify messages end if end fieldValue -- Creates a new (and empty) record. -- We won't update the textfield until after we have created -- the first, last, and company names for the record. to handle newDBRecord get writeDBRecord(totalRecords of this book + 1) if it < 0 request getDBErrorString(it) break to system -- prevent notify messages end if end newDBRecord -- Simple wrapper for writeDBRecord. This is where the dBase record -- is actually written out. to handle updateDB get writeDBRecord(currentRecord of this book) if it < 0 request getDBErrorString(it) break to system -- prevent notify messages else send updateRecords to field "records" end if end updateDB -- Simple wrapper for setDBRecordDeleted. -- Note also that if we pack the dBase here, -- there's no recovery for a deleted file. to handle deleteRecord packFlag get setDBRecordDeleted(1) if it < 0 request getDBErrorString(it) break to system -- prevent notify messages end if if autoPack of this book is TRUE or packFlag is TRUE send packDataBase end if end deleteRecord -- Toggle the autoPack feature to handle autoPack -- from menu item get not (menuItemChecked(autoPack)) -- the toggle set autoPack of this book to it if it is TRUE check menuItem autoPack else uncheck menuItem autoPack end if end autoPack -- Simple wrapper for packDBFile to handle packDatabase sysCursor = 4 -- also moves to last record in database -- so, to prevent that: if checked of button "name" of page 1 set searchText to fieldValue(lastName) else set searchText to fieldValue(Company) end if get packDBFile() if it < 1 request getDBErrorString(it) break to system -- prevent notify messages else send resetDBase send findKey searchText send updateDisplay send updateRecords to field "records" get totalRecords of this book if it > 50000 -- Print Records can't deal with anything larger than this if it > 65531 request stringError("TooBig") else request stringError("AlmostTooBig") end if end if end if sysCursor = default end packDatabase -- workaround for dBase dll tracking problem to handle resetDBase currentRecord of this book = "next" currentRecord of this book = "previous" end resetDBase --******** For functions, errors must be handled by the caller ************* -- Simple wrapper for getDBKeyValue to get keyValue return getDBKeyValue() end keyValue -- Simple wrapper for getDBRecordNumber to get currentRecord return getDBRecordNumber() end currentRecord -- Simple wrapper for getDBRecordCount to get totalRecords return getDBRecordCount() end totalRecords --****************** printing ************ -- utility for printing a single record to handle printCurrentRecord sysCursor = 4 sysLockScreen = TRUE get objects of group "reportGroup" of page "Print Current Record" step i from 1 to itemCount(it) set text of item i of it to fieldValue(uppercase(name of item i of it)) set tPage to this page linkDLL "tb30win.dll" STRING getWinIniVar(STRING,STRING) end linkDLL get getWinIniVar("windows","device") unlinkDLL "tb30Win.DLL" if it is NULL request stringResource("BadPrinter") sysCursor = 1 break printCurrentRecord end if clear sysError sS = sysSuspend sysSuspend = FALSE start spooler if sysError <> NULL request stringResource("BadPrinter") sysCursor = 1 sysLockScreen = FALSE sysSuspend = sS break printCurrentRecord end if set sysSuspend to sS clear printerConditions printerStyle = "Pages" go to page "Print Current Record" print 1 pages end spooler go to tPage sysLockScreen = FALSE sysCursor = 1 end printCurrentRecord to handle printReport -- for hardwired report, see code below. -- first check if there is a printer hooked up clear sysError sS = sysSuspend sysSuspend = FALSE linkDLL "tb30win.dll" STRING getWinIniVar(STRING,STRING) end linkDLL get getWinIniVar("windows","device") unlinkDLL "tb30Win.DLL" if it is NULL request stringResource("BadPrinter") sysCursor = 1 break printReport end if -- pack the database, so that records displayed = total records of the dBase. request stringResource("PackDB") with stringResource("Yes") or stringResource("No") if it <> stringResource("Yes") break else send packDatabase end if -- The built in PrintReport is going to be used. Once -- that's started, there is no way to control it, meaning -- we have to be ready to go, and by the time we get to -- this point, there is really no way to back out of this -- gracefully. So we just take a deep breath and do it. -- This may take a while sysCursor = 4 -- nor do we want enterPage or leavePage messages. sysSuspendMessages = TRUE -- and we really don't want to see this! sysLockScreen = TRUE -- cache the current page tPage = this page -- cache the background we'll be using bgRB = background "report builder" go to first page of bgRB set currentRecord of this book to "First" -- this works because we've packed the database. set newPgCount to totalRecords of this book set rFObjs to objects of group "reportGroup" of bgRB -- change reference from explicit background to implicit page step i from 1 to itemCount(rFObjs) clear words 4 to 7 of item i of rFObjs end step set objCount to itemCount(rFObjs) -- now fill the first page, make another, fill it, etc. step i from 1 to newPgCount step j from 1 to objCount set text of item j of rFObjs to \ fieldValue(uppercase(name of item j of rFObjs)) end step if i < newPgCount set currentRecord of this book to "next" send newpage end if end step --=============== allow user to custom build the report ============= forward --=================================================== -->>>>>>>>>> alternative: a hardwired report <<<<<<<<<<< -- printerStyle = "groups" -- step i from objCount to 1 -- push name of item i of rFObjs onto tempStack -- end -- printerFields = tempStack -- printerGroupsAcross = 2 -- start spooler -- print newPgCount pages -- end --<<<<<<<<>>>>>>>>>>> -- now get rid of all those extra pages go to page 2 of bgRB step i from 2 to newPgCount send selectPage send clear end step step i from 1 to objCount clear text of item i of rFObjs end step go to tPage sysCursor = 1 end printReport --****************** Strings ********************* -- Special string functions to get stringOpenError dbf return "Error opening" && dbf & ". It is needed to run this application." \ && "Please put it in the same directory as"&& uniqueName of this book & "." end stringOpenError to get stringIndexError value return "error opening index file:" && value & \ ". It is needed to run this application." && \ "Please put it in the same directory as" && \ uniquename of this book & "." end stringIndexError -- Strings for all occassions. to get stringResource keyword conditions when keyword = "" return "" when keyword is "Edit" return "Ed&it" when keyword is "New" return "Ne&w" when keyword is "Yes" return "Yes" when keyword is "No" return "No" when keyWord is "YesNoWarning" return "Yes, no more warnings" when keyword is "escape" return "Cancel" when keyword is "DeleteWarning" return "This action will delete this record. Do you want to continue?" when keyword is "Browse" return "&Browse" when keyword is "nameSearch" return "Name to search for..." & CRLF & "(Search is case sensitive)" when keyword is "companySearch" return "Company to search for..." & CRLF & "(Search is case sensitive)" when keyword = "findDBKey3" if checked of button "name" = TRUE set keyType to "name" else set keyType to "company" end if return "String not found, next" && \ keyType && "record becomes the current record." when keyword = "BadPrinter" return "There is a problem with the printer. Make sure it is connected and turned on." when keyword = "findDBKey4" if checked of button "name" = TRUE set keyType to "name" else set keyType to "company" end if return "String not found, and search string is greater than last" && \ keyType && "record. Last record of this type becomes the current record." when keyword is "PackDB" return "This will require that all records marked for deletion are discarded." & CRLF & \ "This can take a while if there are a lot of records. Shall we continue?" when keyword is "contents" return "Contact.tbk" & CRLF & "A Simple dBaseIII Sample Application" & CRLF & \ 1994 Asymetrix Corp." & CRLF & "All Rights Reserved." else -- debug, not for international return "Error: String resource received unknown keyword" && \ keyword && "from target" && target & "." end conditions end stringResource -- Error strings to get stringError keyword, trgt conditions when keyword = "" return "" when keyword = "linkError" return "Could not link to TB30DB3.dll" when keyword is "NoMem" return "There is not enough system memory for this operation." && \ "Please shut down other applications and try again." when keyword is "stringToBig" get getDBFieldWidth(name of trgt) return "This field will only accept strings up to" && it && "characters long." when keyword is "BadDBase" return "This database is not compatable with Contact.tbk. Switching to Contact.dbf" when keyword is "TooBig" return "This Contact database has become so large as to be unprintable." && \ "This application was designed as a demonstration and was not intented for such heavy use." && \ "You should delete records that are no longer valid, or consider using a different database application." when keyword is "almostTooBig" return "This Contact database is becoming quite large. You should consider deleting unused records." else -- debug, not for international return "Error: Error string function received unknown keyword:" && \ keyword && "from target" && target & "." end stringError -- Help strings to get stringHelp keyword conditions when keyword = "" return "" when keyword = "Edit" return "Toggle between browse/edit mode" when keyword = "New" return "Insert a new record into the database" when keyword = "Delete" return "Delete the current record from the database" when keyword = "Search" return "Search the database for a key in the current index" when keyword = "reset" return "Reset field values" when keyword = "Update" return "Write field values to file" when keyword = "Next" return "Go to the next record" when keyword = "Previous" return "Go to the previous record" when keyword = "FirstName" return "Enter first name" when keyword = "LastName" return "Enter last name" when keyword = "Company" return "Enter company name" when keyword = "Notes" return "Enter notes about person" when keyword = "BillingCD" return "Enter billing code if applicable" when keyword = "Misc" return "Enter other personal information" when keyword = "fCountryCD" return "Enter fax country code" when keyword = "fAreaCode" return "Enter fax area code" when keyword = "fLocalNum" return "Enter fax number" when keyword = "fExtension" return "Enter fax extension" when keyword = "vCountryCD" return "Enter voice country code" when keyword = "vAreaCode" return "Enter voice area code" when keyword = "vLocalNum" return "Enter voice phone number" when keyword = "vExtension" return "Enter voice extension" when keyword = "name" return "Sort the records by last name first" when keyword = "companyButton" return "Sort the records by company first" when keyword = "viewByCompany" return "View name and company fields" when keyword = "viewByPhone" return "View name and phone fields" when keyword is "Records" if caption of button "Edit" is stringResource("Edit") return "Doubleclick to edit selection" else return "Doubleclick to browse selection" end if else -- debug, not for international return "Error: Help string function received unknown keyword:" && \ keyword && "from target" && target & "." end conditions end stringHelp DBEXCHNG.TBK R--*************************************************************************** -- Asymetrix dBase - Paradox - ToolBook Exchange -- 1991 - 1994 -- Asymetrix Corporation --Copyright 1991-1994 Asymetrix Corporation --This version authored by Jeff Ayars and Charles Hiestand --Asymetrix gives you permission to copy, revise and reuse the individual --objects and scripts in this application in your own applications. --You may not, however, copy the entire book (or a substantial part of it) --for redistribution as your own product. --Asymetrix retains the copyright on the original elements of this --application. Include the notice "Portions of this application are the --copyright of Asymetrix Corporation" in your product if they contain --objects or scripts copied from this application. --A note on language independence: For ease of translating this --application, all text strings visible to readers that come from scripts --are put into functions located at the bottom of this book script. --The names of these functions start with the letters: "str". -- handlers in this script: -- author set prompt for save changes -- enterApplication handle housekeeping -- leaveApplication clean up -- leavePage clean up per page -- ImportdBase go to option -- ExportdBase go to option -- dBaseHelp go to help page -- linkFile link tb30DOS.dll functions -- linkdBase link tb30db3.dll functions -- last go to page 10 if in reader -- User defined functions in this script: -- isAlNum test for alphaNumeric -- isNum test for numeric -- isAlpha test for alphabetic -- isPosInt test for positive integer -- nameOnly return prefix of file name only. --*************************************************************************** to handle enterApplication system s_firstFlag s_firstFlag = true set sysChangesdb to FALSE if sysRuntime is TRUE request strRuntime() send exit to system break to system end if send reader show mainWindow show viewer "splash" send linkFile send linkdBase send linkPX get initializePX("DBExchange") if it < 0 -- if SHARE.EXE is not running, an error will occur here -- request getPXErrorString(it) request "DBEXCHNG.TBK needs SHARE.EXE to work correctly. Please leave Windows and from the DOS prompt type ""share"" followed by the enter key. You can then re-enter Windows and start DBEXCHNG.TBK" request "DBEXCHNG.TBK will now exit." send exit to system break to system end if send sizeToPage -- center window on screen pause 2 seconds forward close viewer "splash" end enterApplication to handle leaveApplication get exitPX() forward end leaveApplication to handle idle -- make sure the screen is centered --(sometimes in 640 X 480 there is a problem) system s_firstFlag forward if s_firstFlag = TRUE send sizeToPage clear s_firstFlag end if end idle --ask to saveChanges if they have switched to author mode. to handle author set sysChangesDB to TRUE forward send sizeToPage end author to handle reader forward send sizeToPage end reader to handle last if sysLevel is reader go to page "Export" else forward end if end last --********************************************************************* --handlers for custom menu alias messages --********************************************************************* to handle menuItemSelected menuItem, menuAlias conditions when menuItem is "ImportFromDbaseFile" go to page "import Dbase" when menuItem is "ExportToDbase" go to page "export DBase" when menuItem is "ImportFromParadox" go to page "import Paradox" when menuItem is "ExportToParadox" go to page "export Paradox" else forward end conditions end menuItemSelected to handle dBaseHelp system STRING svReturnPage syscursor = 4 -- Do not want to send leave or enterPage because user will -- lose work sysSuspendMessages = TRUE -- Do not modify return page if they are already in help if name of this background <> "exchangeHelp" svReturnPage = name of this page end if if name of this page contains "export" go to page "exporting ToolBook to dBase" else go to page "importing dBase to Toolbook" end if sysCursor = default -- needed because syssuspendmessages set to TRUE end dBaseHelp to handle aboutdBase show viewer "splash" -- request strAboutDbase() end aboutdBase --***************************************************************************** --handlers to link DLL functions used by the book --***************************************************************************** --link functions for file dll to handle linkFile sysSuspend = FALSE clear sysError linkDLL sysToolBookDirectory & "tb30dos.dll" INT fileExists(STRING) STRING getFileList(STRING) end linkDLL if syserror is not null request strNoDll ("TB30DOS.DLL") send exit to system break to system end if set syserror to null linkDLL sysToolBookDirectory & "tb30dlg.dll" STRING OpenFileDlg(STRING,STRING,STRING,STRING,INT) STRING saveAsDlg(STRING,STRING,STRING,STRING,INT) end linkDLL if syserror is not null request strNoDll ("TB30DLG.DLL") send exit to system break to system end if linkDLL "kernel" WORD GlobalAlloc(WORD,DWORD) WORD GlobalFree(WORD) POINTER GlobalLock(WORD) WORD GlobalUnlock(WORD) end linkDLL sysSuspend = TRUE end linkFile to handle linkdBase sysSuspend = FALSE clear sysError linkdll sysToolBookDirectory & "tb30DB3.DLL" INT checkDBIndex(STRING) INT closeAllDBFiles() INT closeDBFile(STRING) INT closeDBIndexFile(STRING) WORD createDBFieldTag(WORD) INT createDBFile(STRING,WORD,WORD) INT createDBIndexFile(STRING,STRING,WORD,WORD) INT deleteDBFile(STRING) INT deselectDBIndexFile() INT findDBKey(STRING) INT firstDBKey() INT firstDBRecord() INT freeDBFieldTag(WORD) STRING getDBDateFormat() STRING getDBErrorString(INT) INT getDBFieldCount() STRING getDBFieldName(WORD) INT getDBFieldPrecision(STRING) INT getDBFieldType(STRING) STRING getDBFieldValue(STRING) INT getDBFieldWidth(STRING) STRING getDBFileName() STRING getDBIndexExpression() STRING getDBIndexFileName() INT getDBKeyType() STRING getDBKeyValue() INT getDBNavigateToDeleted() LONG getDBRecordCount() INT getDBRecordDeleted() LONG getDBRecordNumber() INT gotoDBRecord(DWORD) INT lastDBKey() INT lastDBRecord() INT nextDBKey() INT nextDBRecord() INT openDBFile(STRING) INT openDBIndexFile(STRING) INT packDBFile() INT previousDBKey() INT previousDBRecord() INT reindexDBFile(STRING) INT removeDBRecords(DWORD,DWORD) INT selectDBFile(STRING) INT selectDBIndexFile(STRING) INT setDBDateFormat(STRING) INT setDBFieldTag(WORD,WORD,STRING,STRING,WORD,WORD) INT setDBFieldValue(STRING, STRING) INT setDBNavigateToDeleted(INT) INT setDBRecordDeleted(WORD) INT writeDBRecord(DWORD) end linkdll if sysError <> null request "Could not link to TB30db3.dll" end if set sysSuspend to true if sysError <> null request strNoDLL("TB30DB3.DLL") end if sysSuspend = TRUE end linkdBase to handle linkPX -- all are linked, not all are used linkDLL sysToolBookDirectory & "tb30PDX.DLL" INT addPXKey(STRING,STRING,INT) --PXKeyAdd() INT addPXPassword(STRING) --PXPswAdd() INT addPXTable(STRING,STRING) --PXTblAdd() INT appendPXRecord(STRING) --PXRecAppend() INT clonePXBlob(STRING,STRING) --PXBlobClone() INT closePXBitmapWindow(WORD) INT closePXBlob(INT,INT) --PXBlobClose() INT closePXTable(STRING) --PXTblClose() INT copyPXTable(STRING,STRING) --PXTblCopy() INT createPXTable(STRING,STRING,STRING) --PXTblCreate() INT decryptPXTable(STRING) --PXTblDecrypt() INT deletePXPassword(STRING) --PXPswDel() INT deletePXRecord(STRING) --PXRecDelete() INT deletePXTable(STRING) --PXTblDelete() INT doesPXTableExist(STRING) --PXTblExist() INT dropPXBlob(STRING,STRING) --PXBlobDrop() INT dropPXKey(STRING,STRING,WORD) --PXKeyDrop() INT emptyPXField(STRING,STRING) INT emptyPXRecord(STRING) --PXRecBufEmpty() INT emptyPXTable(STRING) --PXTblEmpty() INT encryptPXTable(STRING,STRING) --PXTblEncrypt() INT exitPX() --PXExit() INT freePXGraphicBlob(WORD) INT freePXGraphicBlobPalette(WORD) INT firstPXRecord(STRING) --PXRecFirst() LONG getPXBitmapSize(WORD) LONG getPXBlob(INT,DWORD,LONG) --PXBlobGet() LONG getPXBlobQuick(STRING,STRING,INT) --PXBlobQuickGet() LONG getPXBlobSize(INT) --PXBlobGetSize() STRING getPXErrorString(INT) --return error string INT getPXFieldCount(STRING) --PXRecNFlds() STRING getPXFieldNames(STRING) STRING getPXFieldType(STRING,STRING) --PXFldType() STRING getPXFieldValue(STRING,STRING) LONG getPXFileSize(STRING) LONG getPXGraphicBlob(INT) LONG getPXGraphicBlobPalette(INT) INT getPXKeyFieldCount(STRING) --PXKeyNFlds() INT getPXMaxFiles() INT getPXMaxLocks() INT getPXMaxTables() INT getPXSwapSizeFromINI() INT getPXMaxTablesFromINI() INT getPXMaxFilesFromINI() INT getPXMaxLocksFromINI() STRING getPXMemoBlob(INT) STRING getPXNetErrorUser() --PXNetErrUser() STRING getPXNetUserName() --PXNetUserName() LONG getPXRaw(STRING,INT) --PXRawGet() INT getPXRawDataSize(STRING) LONG getPXRecordCount(STRING) --PXTblNRecs() LONG getPXRecordNumber(STRING) --PXRecNum() STRING getPXSortOrder() INT getPXSwapSize() STRING getPXUserInfo() INT gotoPXNetRecordLock(STRING,INT) --PXNetRecGotoLock() INT gotoPXRecord(STRING,LONG) --PXRecGoto() INT initializePX(STRING) --PXWinInit() INT insertPXRecord(STRING) --PXRecInsert() INT isPXNetRecordLocked(STRING) --PXNetRecLocked() INT isPXNetTableChanged(STRING) --PXNetTblChanged() INT isPXTableProtected(STRING) --PXTblProtected() INT lastPXRecord(STRING) --PXRecLast() INT lockPXNetFile(STRING,INT) --PXNetFileLock() LONG lockPXNetRecord(STRING) --PXNetRecLock() INT lockPXNetTable(STRING,INT) --PXNetTblLock() LONG mapPXKey(STRING,STRING,STRING,INT) --PXKeyMap() INT nextPXRecord(STRING) --PXRecNext() LONG openPXBitmapWindow(WORD,WORD,WORD,STRING,INT,STRING) LONG openPXBlobRead(STRING,STRING) --PXBlobOpenRead() LONG openPXBlobWrite(STRING,STRING,LONG,INT)--PXBlobOpenWrite() INT openPXTable(STRING,STRING,INT,INT) --PXTblOpen() INT packPXTable(STRING) INT previousPXRecord(STRING) --PXRecPrev() STRING queryPXKey(STRING) --PXKeyQuery() INT refreshPXNetTable(STRING) --PXNetTblRefresh() INT renamePXTable(STRING,STRING) --PXTblRename() INT savePX() --PXSave() INT searchPXField(STRING,STRING,WORD,INT) INT searchPXKey(STRING,INT,STRING,INT) --PXSrchKey() INT setPXBitmapWindowInfo(WORD,WORD,WORD,INT,STRING) INT setPXBlob(INT,DWORD,LONG,WORD) --PXBlobPut() INT setPXBlobFromFile(INT,DWORD,DWORD,DWORD,STRING)--PXBlobPut() INT setPXFieldValue(STRING,STRING,STRING) --PXPutAlpha(), PXPutDate(), PXPutDouble(), PXPutLong(), PXPutShort() INT setPXGraphicBlob(INT,WORD,WORD) --PXBlobPut() INT setPXGraphicBlobFromFile(INT,STRING) --PXBlobPut() INT setPXINIMaxFiles(INT) --PXSetDefaults() INT setPXINIMaxLocks(INT) --PXSetDefaults() INT setPXINIMaxTables(INT) --PXSetDefaults() INT setPXMemoBlob(INT,STRING) --PXBlobPut() INT setPXRaw(STRING,INT,INT) --PXRawPut() INT setPXSortOrder(STRING) INT setPXINISwapSize(INT) INT setPXTableCreateMode(INT) --PXTblCreateMode() INT setPXTableMaxSize(INT) --PXTblMaxSize() INT setPXUserInfo(STRING) INT unlockPXNetFile(STRING,INT) --PXNetFileUnlock() INT unlockPXNetRecord(STRING,INT) --PXNetRecUnlock() INT unlockPXNetTable(STRING,INT) --PXNetTblUnlock() INT updatePXRecord(STRING) --PXRecUpdate() INT upgradePXTable(STRING) --PXTblUpgrade() LONG writePXBlobToFile(INT,STRING,INT) --PXBlobPut() LONG writePXGraphicBlobToFile(INT,STRING,INT)--PXBlobPut() end linkDLL clear sysError end linkPX --************************************************************************* --Functions to support data validation and error checking --************************************************************************* -- We test the ANSI number of each character. -- See page C-4 (appendix C) of the ToolBook User Manual. to get isAlNum string local LONG i step i from 1 to charCount(string) get charToAnsi(char i of string) if (it >= 0 and it <= 47) or \ (it >= 91 and it <= 96) or \ (it >= 58 and it <= 64) return FALSE end if end step return TRUE end isAlNum to get isAlpha string local INT i step i from 1 to charCount(string) get charToAnsi(char i of string) if ( it >= 0 and it <= 64) or (it >= 91 and it <= 96) or (it > 127) return FALSE end if end step return TRUE end isAlpha -- Instead of replacing ever call to these ToolBook 1.5 functions, -- they have been rewritten using the new 3.0 functionality. to get isNum str return isType(REAL, str) end isNum --boolean test for a positive integer to get isPosInt str return evaluate(isType(INT,str) and str >= 0) end isPosInt -- get just the file name from a fully qualified path to get nameOnly fFile local WORD vOffset set vOffset to offset ("\",fFile) while vOffset > 0 clear chars 1 to vOffset of fFile set vOffset to offset ("\",fFile) end while return fFile end nameOnly to get strHelp return "Help" end strHelp to get strAboutDbase -- debug: better about return "dBaseIII (tm) - Paradox (tm) - ToolBook (tm) Exchange" & crlf & \ "Copyright (c) 1991 - 1994 -- Asymetrix Corporation" end strAboutDbase to get strCloseInstances return "Please close all other instances of ToolBook." end strCloseInstances to get strRuntime return "This application will only work with the full authoring ToolBook system. It will now close, please restart it using mtb30.EXE" end strRuntime to get strdbf return "&dBase" end strdbf to get strDBFileCreationError fName return "There was an error creating dBase file:" && fName end strDBFileCreationError to get strDBFileOpenError fName return "There was an error opening dBase file:" && fName end strDBFileOpenError to get strErrNoDBF return "There is no current dBase file. Please select one." end strErrNoDBF to get strErrRefdbField fField return "Error referencing dBase field: " & fField end strErrRefdbField to get strErrDBFWrite return "Error writing dBase record." end strErrDBFWrite to get strErrSetDBF fField return "There was an error setting value of dBase field: " & fField end strErrSetDBF to get strErrTag return "Error creating dBase field tag." end strErrTag to get strErrTbkExe request "There was an error running mtb30.exe." return FALSE end strErrTbkExe to get strExportDone errCount if errCount = 0 return "Export completed." else return "Export completed: There were" && errCount && "field(s) with" && \ "invalid data." end if return "Export completed." end strExportDone to get strNoDBFFields return "No dBase fields have been selected yet." end strNoDBFFields to get strNoDLL fName return "Can't find" && fName & ". Please copy this file to a directory that's in your path, or change your path to include"&&fname&"'s directory, then open this book again." end strNoDLL to get strSelTBFields return "Please select ToolBook fields for export." end strSelTBFields to get strSetDBName return "Please enter a dBase file name." end strSetDBName to get strTagErr index return "Error setting field tag for field " && index & "." end strTagErr to get strTBErrorRef fName return "There was an error referencing book: " & fname end strTBErrorRef to get strTBrecordError fField return "Error referencing record field:" && fField end strTBrecordError to get strEnterDBfile return "Please enter a valid dBase file name." end strEnterDBfile to get strNoOpenDBfile return "File cannot be opened. Please enter a valid dBase file name." end strNoOpenDBfile to get strNoNameOrType return "There is no name or type for one of the fields. Please set the values." end strNoNameOrType to get strSeldBFileName return "Please select a dBase file name." end strSeldBFileName to get strErrListdBFile return "Error listing fields for this dBase file." end strErrListdBFile to get strSelTBKFileName return "Please select a ToolBook file name." end strSelTBKFileName to get strNoNameRecFfl return "No named, ungrouped record fields were found on the last page of this ToolBook file." end strNoNameRecFfl to get strTwoShareName return "Two or more record fields share the same name in this book. Please give all recordfields unique names." end strTwoShareName to get strNoRecIndBase return "There are no records in this dBase file." end strNoRecIndBase to get strErrorFirstdBRec return "Error getting the first record in this dBase file." end strErrorFirstdBRec to get strErrorGetdBValue curFld, totrecs return "Error getting value for field" && \ curFld && "in record number" && totrecs & "." end strErrorGetdBValue to get strErrSetdBValue curfld, totrecs return "Error setting value for record field" && \ curfld && "in record number" && totrecs & "." end strErrSetdBValue to get strToManyFlds return "You are importing more fields than can be displayed on the page." && \ "You will have to arrange the fields after the book is built." end strToManyFlds to get strOK return "OK" end strOK to get strCancel return "Cancel" end strCancel to get strPlChooseBook return "Please choose the book to export." end strPlChooseBook to get strChooseBook return "Choose Book" end strChooseBook to get strPlChooseDbase return "Please choose the dBase file to import." end strPlChooseDbase to get strChoosedBase return "Choose dBase File" end strChoosedBase to get strFieldOverrun fType return "You have exceeded the size limits of a " & fType && ".dbf field." end strFieldOverrun to get strPrecisionError return "Decimal precision must be either zero or at least two less than the field width." end strPrecisionError to get strAskDateFormat fldName return "Enter the ToolBook date format of the text in record field" && \ fldName & "." end strAskDateFormat to get strdBnameExist dbName return "Filename" && dbName && "already exists. Replace it?" end strdBnameExist to get strSavedBaseFile return "Save dBase file as:" end strSavedBaseFile to get strSavePXFile return "Save Paradox file as:" end strSavePXFile to get strCharWidth return "Character width must be between 1 and 255." end strCharWidth to get strNumWidth return "Numeric width must be between 1 and 19." end strNumWidth to get strWidthNull return "Width cannot be blank." end strWidthNull to get strDecimalNull return "Decimal cannot be blank." end strDecimalNull to get strDecimal15 return "Decimal cannot be greater than 15." end strDecimal15 to get strNameToLarge return "A dBase field name can only be up to 10 characters." end strNameToLarge to get strNameNull return "A dBase field name cannot have a blank name." end strNameNull to get strChar1Num return "A dBase field name cannot start with a number." end strChar1Num to get strNotPage return "This is not a functioning page for this book. It is used to build the front end." end strNotPage to get strYes return "Yes" end strYes to get strTooTooManyFields num return "You can only build the new application with" && num && "fields if you" \ && "don't include label fields. Do you want to eliminate the label fields?" end strTooTooManyFields to get strWayTooManyFields return "You have selected more fields than this application can handle." \ && "Please try again with less fields." end strWayTooManyFields to get strNoLabels return "No label fields" end strNoLabels to get strNo return "No" end strNo