Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!rutgers!psuvax1!swatsun!jackiw From: jackiw@cs.swarthmore.edu (Nick Jackiw) Newsgroups: comp.sys.mac.programmer Subject: Re: Editable Text Objects in Dialog Boxes Message-ID: <4X6NVMD@cs.swarthmore.edu> Date: 18 Aug 90 16:21:58 GMT References: <1990Aug17.171302.8900@Neon.Stanford.EDU> Reply-To: jackiw@cs.swarthmore.edu (Nick Jackiw) Organization: Visual Geometry Project, Swarthmore College, PA Lines: 46 commons@Sunburn.Stanford.EDU (Peter Commons) writes: > Two questions about Editable Text Objects in Dialog Boxes: > 1) Can you limit the length and/or prevent carriage returns? Theoretically I > could check after every keypress to see if the length is too big or if they > just hit return (and then delete the last character and redraw), but I was > hoping for something nicer... It's not that bad---you can forget the parenthetical part, at least. Install a filterProc--it will get called before _ModalDialog. Thus, if you get a keydown and the length of your item is at it's maximum, simply convert the keydown into a nullEvent. You might want to beep, to let them know they've typed enough, and you'll probably want to let backspace, delete, arrow-left, arrow-right, arrow-up and arrow-down pass through unscathed, so they can still edit even if they can't add more. Likewise, it's trivial for a filter to convert keydown/keyCode=13 (returns) into nullEvents. > 2) A month ago some people were saying that to make a password dialog where > the password was not legible, you change the font to something where all chars > are undefined??? How do I do this? Put up the dialog. DrawDialog. Then switch the font (TextFont) of the current port to something more interesting---Zapf Chancery or your own "every-character-a-bullet" font. Alternately, you can try intercepting and parsing all the keydowns in the way that editText does, store them yourself in some string, and convert them in your filterProc to bullet-downs (option-shift-8). This is much more of a hassle than the former method, however. > Thanks. > > > -- > |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| > | Peter Commons "Zut, alors! I have meesed one!!!" | > | commons@cs.stanford.edu | > | Computer Science Department, Stanford University | -- _ _|\____ Nick Jackiw | Visual Geometry Project | Math Department / /_/ O> \ ------------+-------------------------+ Swarthmore College | O> | 215-328-8225| jackiw@cs.swarthmore.edu| Swarthmore PA 19081 \_Guernica_/ ------------+-------------------------+ USA