Notes{labels: 'NIL, viewFont: 10241} // nil=Unfiled, or specify a folder, e.g., 'Business. remove viewFont for current Styles default//ERASE! remove initial // to erase existing entries in this folder firstdontask.nwt -- Slurpee format6/7/95Copyright 1995 S. Weyer. All Rights Reserved Worldwide.Keywords: keyboard, prompt, source, NewtDon't Ask (Don't Tell) is a simple, tiny app (autopart) that adds a button (atlower left) in the standard keyboard so that you can turn off/on the "Do youwant to add..." prompt, which you may find annoying or sometimes desirable...When dot is hollow (default), words pass through to the dictionary prompt.When dot is solid, the dictionary prompt does not appear (it's blocked/overridden).This Newt source file (dontask.nwt) and the associated Newt-generatedpackage (DontAsk.pkg) are shareware ($5) and may be distributed freely aslong as both files are included and unmodified. You are free to makemodifications for your own use.For your convenience, I have attached a package generated by the NewtDevelopment Environment* so that you don't have to compile & save thisyourself -- just install using NCK, Package Installer or a sharewaredownloader. If you would like to build or modify the Don't Ask application,you can use Newt (3.0 or greater) (see directions at end); you can avoidre-entering the source by transferring dontask.nwt with a utility such asSlurpee (1.5).*Newt is an environment for developing applications using NewtonScript andsaving as packages directly on your Newton (you can also use a PC or Mac forsource editing and application debugging). Newt is shareware -- registeredusers receive files containing current releases, additional packages, 165+source examples, and a 80+ pp. (paper or Acrobat) manual describing Newtfeatures and NewtonScript syntax and functions. For more information,browse http://www.netaxs.com/~weyer, or consult the Newt FAQ on AOL,eWorld, AppleLink, Compuserve, newton.uiowa.edu or ftp.amug.org(or send me email: weyer@netaxs.com).Disclaimers: Don't Ask relies on undocumented behavior of the built-inkeyboard so it is not guaranteed to work on future Newtons or softwareconfigurations. It appears not to interfere with the Graffiti kbd patch --either in setup behavior or location (Graffiti button appears on right,DontAsk on left). If you're aware of keyboard related conflicts, let me knowand I will contact other developers to see if we can coordinate our patches.DontAsk generally installs & removes itself properly. However, if it isinstalled on a card and you remove the card while the keyboard is open, youwill get a "Newton Still Needs the Card" message (just close the kbd first;or install DontAsk in internal; or we could modify the button to consume moreheap).Implementation notes: this could be even simpler -- don't add a button, justalways turn off the prompt -- but it seemed to me that there might beoccasions where you might want to turn prompting back on. It could be morecomplex -- behavior controlled via a Preference panel, but that wouldrequire many taps to switch back and forth.You can send questions, feature requests, and registrations for DontAsk ($5)or Newt ($45) [please include your email address, if any] to:Steve Weyer17 Timber Knoll DriveWashington Crossing, PA 18977-1052Internet: weyer@netaxs.comhttp://www.netaxs.com/~weyerAmerica Online/eWorld/NewtonMail: SteveWeyerCompuserve: 74603,2051Since DontAsk is such a simple app, I don't have any major enhancments planned.If you do register, you'll encourage me to write, release (and inform youabout) other utilities and source examples.----------init//:init()begin :DefConst('kSize,5); // dot sizeend----------DontAsk//:doObj('build,'DontAsk)//:saveApp(DontAsk){// a simple "button".// a checkbox might be nicer but there's no really no room in kbd// and adding a Preference panel seems very inconvenient to user// note: constants can be defined symbolically with optional viewcnst.pkg plug-inviewclass: clView, // just a vanilla viewviewFlags: 513, // vClickable + vVisibleviewBounds: RelBounds(22,-7,kSize,kSize), // left,top,width,height. left&top relative to left&bottom, between Dict icon & OptionviewJustify: 128, // vjParentBottomV (left, bottom aligned)viewDrawScript: func() :DrawShape(MakeOval(0,0,kSize,kSize), // left,top,right,bottom {transferMode: 0, // modeCopy fillPattern: if askWords then 0 // vfFillWhite else 5, // vfFillBlack }),viewClickScript: func(unit) begin askWords := not askWords; // toggle in parent (alphakeyboard) :dirty(); // redraw. returns TRUE end,_package: { version: 10, copyright: "\u00A9\u 1995, S. Weyer", devSignature: "TKnollSys", // appSymbol => DontAsk:TKnollSys //installScript -- add these separately for editing convenience //removeScript //partData -- this is an autopart },}----------DontAsk._package.installScript//:installApp(DontAsk,true)func(partFrame,removeFrame)begin local slot,val, kbd := GetRoot().alphaKeyboard; // we could check visibility & redo children. simpler just to close it... kbd:close(); // copy some values into built-in keyboard VIEW // and stash slots in removeFrame for later cleanup foreach slot,val in partFrame.partData do begin slot := EnsureInternal(slot); removeFrame.(slot) := kbd.(slot) := val; end; // button appears next time kbd openedend----------DontAsk._package.removeScript//:installApp(DontAsk,nil)func(removeFrame)begin local slot, val, kbd := GetRoot().alphaKeyboard; // we could check visibility & redo children. simpler just to close it... kbd:close(); // if kbd still open & card is removed, then "Newton Still Needs the Card" ! // remove slots we added in installScript foreach slot,val in removeFrame do RemoveSlot(kbd,slot);end----------DontAsk._package.partData{// slots to add to the keyboard view// this is set each system reset/card insertion; could store in a system preference?askWords: true, // prompt as usual (default). modified in DontAsk.viewClickScript. used in kbd.keywordScript & DontAsk.viewDrawScriptdontAskTemplate: DontAsk._proto, // the "button" template, to be added as a child in kbd.viewSetupChildrenScriptkeywordScript: func(x) if askWords then inherited:keywordScript(x) // default (prompt) behavior else NIL, // don't promptviewSetupChildrenScript: func() if shrunken // only do this if prompt isn't being displayed then begin // I think Graffiti patch adds a viewSetupFormScript method // and sets stepChildren there, so this seems to peacefully coexist... if not stepChildren then stepChildren := []; AddArraySlot(stepChildren,dontAskTemplate); end,}----------I will provide a few suggestions here on how to modify, build & test thisapplication. Of course, I would recommend registering for Newt to obtain moredocumentation and examples...- transfer source to the Notepad (use Slurpee, NCK or ...)- install Newt 3.0 & NewtPack. note: if you have an Original MessagePad withpre-1.3 ROMs, you won't be able to save this app as a package with Newt 3.0;saving packages on OMP works in 3.1 (but this may not be publicly available yet)- if you installed the DontAsk:TKnollSys package, remove it via Card:Remove Software;or, use Remove Package command (under action button) once you are in Newt --otherwise, you won't be able to install&test during development (though you couldjust build & save(replace)).- start Newt. select folder with source (default is Unfiled)- make any edits, for example: change location of button, RelBounds(21,-8,kSize,kSize) in DontAsk's viewBounds slot // move left & up 1 change shape of button, MakeRect instead of MakeOval in DontAsk's viewDrawScript method change size of button, :DefConst('kSize,7) in init method to redefine constant. tap Expr. select :init(). tap Eval change fill of button, 4 (for vfFillDkGray) instead of 5 (for vfFillBlack) in DontAsk's viewDrawScript method so, now button would be a 7x7 square instead of 5x5 circle- build application: tap Expr. select :doObj('build,'DontAsk). Eval- install application temporarily (run its installScript, etc.) tap Expr. select :installApp(DontAsk,true). Eval- double-tap in text area to get standard keyboard. (note: Newt's keyboard (via icon) is a different keyboard object, so does not have this button currently).- optional. tap Expr. select :installApp(DontAsk,nil). Eval to un-install app. (this isn't strictly necessary since build or save ensure it is un-installed).- possibly iterate through additional edit/build/install cycles.- to save package, tap Expr. select :saveApp(DontAsk). Eval- exit Newt. double-tap to see keyboard.- to confirm installScript/removeScript behavior close keyboard unlock or remove card double-tap to get keyboard (no button should be present) lock or insert card keyboard closes (if open) double-tap for keyboard (button should be present)- congratulations! you have just created, tested and installed a custom autopart- to give the new package to your friends: backup Newton using NCK. use Extract Package application (see www.netaxs.com/~weyer for URLs for Mac and Windows versions) to extract package from NCK bacup file. (Windows version may display package name generically as "package0xxxx" -- you can compare size of file with package in Newton's Remove Software/Package menu)---------BYE!