Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: ModalDialog filterprocs Message-ID: <33391@ucbvax.BERKELEY.EDU> Date: 28 Dec 89 16:06:11 GMT References: <10125@saturn.ucsc.edu> <33385@ucbvax.BERKELEY.EDU> <10132@saturn.ucsc.edu> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 76 Here are some more things your filterProc should do, that mine does, that I forgot in my previous message: 12.) supress and ignore Cut/Copy/Clear commanas if nothing is selected. 13.) change the mouse cursor to an I-Beam if it is over a edittext field, and back to an arrow when it leaves it. 14.) When you start typing, the dialog manager does an ObscureCursor(). If you terminate the dialog by using a button equivalent, the cursor is still obscured.Your filter proc should force the cursor visible on dialog exit. 15.) if I have scrollbars or ListManager items in a dialog, pass them Activate & Deactivate events. 16.) filter invisible control characters out of the input stream so they won't get into editText items. Another area where I have to improve: ) Beep if a keystroke is inappropriate for the type of an editText entry, for example trying to type 'A'..'Z' in a numeric only field. ">" is sirkm@ssyx.ucsc.edu (Greg Anderson) ">>" is me >>5.) On synonyms for Edit commands, flash the word "Edit" on the menu bar. Don't forget: (like ACTA forgets) ignore Cut/Copy/&Clear commands if no text is selected. It is obnoxious to simply empty the clipboard, placing nothing there. >>4.) handle Tab to tab backwards through the fields. >How should that be done? Forge a mouseDown event inside the appropriate >editable text field? if your filter proc sees Tab, it just does a SelIText() of the appropriate field, and changes the "what" of the event record to nullEvent, so the dialog manager will do no more with it. It ususally group all the EditText items in a dialog as one contiguous group of items. Since I sometimes gray out editable text items, I don't make the Tab function completely automatic: I have a generic filterproc that is called with extra arguments from each specific dialog's filterproc, so I can customize the behavior of the filterproc while reusing as much code as possible. >My filterProc is being called from a dialog box that is invoked from a >desk accessory, so I can't use globals in the usual way (I have a Handle >that holds all of the global data, & pass that from routine to routine). >Any suggestions on how I might pass this handle into the filterProc? There are two issues here, since there are two kinds of "global" data. One is true globals, the other is per-window globals. (A dialog might start a second dialog, for example, an error message dialog. Since you have two dialogs on the screen, you can't depend on a single set of filterproc variables.) Use SetWRefCon(theDialog, (long) winVarHandle) to stash the gloabls handle, and GetWRefCon(theDialog) to retrieve it. That is what the refCon is for. I would make a field in my window variables be a reference to my application globals. >How do you determine if the user is clicking in a scrollbar? Use a custom >filterProc for each dialog that 'knows' (via hard-coding) which items have >scrollbars? Well scrollbars are userItems. You detect clicks on an item by calling FindDItem() (I.M.V4). If your porgram maintains 64K ROM compatibility, you'll need to write your own version of this routine, but it si simple. My filterproc needs to call this so it can track the cursor to handle changing it to an iBeam as appropriate. i don't try to write one completely general filterProc, instead, I write a simple, single, short one for each dialog, that calls MyGenericFilterProc() to do most of the work. Does MacApp miss any of the subtle user interface points I catch? What does it do along these lines that I don't? THINK C Class Library doesn't seem to have much filterproc support, or am I missing something there? > The mac is a detour in the inevitable march of mediocre computers. > drs@bnlux0.bnl.gov (David R. Stampf) --- David Phillip Oster -master of the ad hoc odd hack. Arpa: oster@dewey.soe.berkeley.edu Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu