Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!stjhmc!p88.f15.n300.z1.fidonet.org!Lawson.English From: Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) Newsgroups: comp.sys.mac.programmer Subject: Dialogs and TCL Message-ID: <1314.27AC434C@stjhmc.fidonet.org> Date: 2 Feb 91 16:37:00 GMT Sender: ufgate@stjhmc.fidonet.org (newsout1.26) Organization: FidoNet node 1:300/15.88 - Tucson Apple Core, Tucson AZ Lines: 61 David M Marcovitz writes in a message to All DMM> Are there classes in TCL to handle dialogs? I just learned how DMM> to use the CBartender class to play with menus, and it makes DMM> life really easy. I would think there would be something similar DMM> to handle dialog boxes. Is there anything The closest thing to it is the CAboutBox in the More Classes folder, which is a real kludge. What I've been thinking about is to create a new SwitchBoard class and Window class that handle dialogues the way MacApp does. Basically, one must put a test into the ProcessEvent method that checks FrontWindow to see if 1) is it a TCL window, and 2) if so, is it set with an "itsADialogue" flag = TRUE. If all of the above then you have to check for clicks outside the content region of the front window, cmd-key-presses aside from "c," "v" and "x," and SysBeep 'em. Elsewise you pass the event on to the inherited method. The easiest way to do it would be to split the functionality (don't you love that word) of ProcessEvent into two methods: ProcessEvent, which is identical until the line "if (isMyEvent)" is reached, and DoEvent, which takes the EventRecord as an arguement. Your new ProcessEvent class should now say: if (isMyEvent) then DoEvent(theEventRecord); In the base class (which substitutes for CSwitchBoard), DoEvent does exactly what the old "if (isMyEvent)" block did. In the override method for handling dialogues, DoEvent handles the special cases discussed above and either eats them or passes them to inherited DoEvent. You CDialogueWindow should have an "itsADialogue" flag that is always set to false unless you need a modal dialogue. Now you can use a normal TCL window as a Dialogue window and use all the CPanes and co. to your hearts content. If you want to be fancy, you can create a default button, a default text field, etc. ala the MacApp dialogues. You can also have custom controls as methods, and animation without filterprocs, etc. You can even design the thing to work with the Dialogue templates of ResEdit, and do a GetDialogue to load the various resources (good luck there!). Very handy. I'm still implementing the above, but you now have all my research and thoughts on the subject. Go fer it if you need a CDialogue class. Lawson -- Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!300!15.88!Lawson.English Internet: Lawson.English@p88.f15.n300.z1.fidonet.org