John W. Colby
jwcolby at colbyconsulting.com
Tue Sep 7 10:18:04 CDT 2004
Drew, I most appreciate your observations re classes and events, but it is unhelpful to cast them in the light of unbound forms. Any class can generate a custom event (even a form's class), they can do so without forms even being involved, and they can do so to manage a bound form as easily as an unbound form. But yes, your observations re transmitting messages to other classes (and forms) is right on target. Way cool. I use a set of classes to handle logging process messages to disk. Have you ever looked at SQL Server's log, or windows startup log? Very handy to troubleshoot what's going on when something fails. I have a set of classes that listens for an event (on a message channel in my case). If they receive that message (sink an event and the message is for it), the class logs the message content into a disk file. I use exactly the same process to log process status to tables when my program needs to monitor process status. A set of classes monitors a message channel (sinks an event for a message class instance) and if the message is for that class, writes the message content to a table. Using "loggers" in this fashion allows my programs to log processes without each piece having to know how to log to a disk file or log to a table. It simply calls a message class instance method and passes a to:, subject:, and message: and the logger handles the rest. I can have multiple logger instances, one each process that needs logging, each instance knows it's disk file name or table name and logs to the right place. In fact I also use the message class for inter-form and inter-process communications inside an application. Once you have a message class built, it is trivial to pass messages to any other class (only classes can sink events). My framework automatically starts one general purpose message class so that is a known entity sure to exist. Any process can send a message on that message instance. If a process needs it's own message channel for some reason, it can ask the framework to open another instance (stored in a collection by message channel name) and pass back a pointer to that channel instance. Now any set of classes involved in that process go get a pointer to that message channel instance and use that as a private message channel. Custom events allow processes to be "black box", do their thing, and broadcast an event when some thing happens. That is extremely useful in interface design since it isolates classes. The matching part (or parts) don't have to be running to test, different parts can sink the events in different situations etc. This stuff is way cool. John W. Colby www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com Sent: Tuesday, September 07, 2004 10:12 AM To: accessd at databaseadvisors.com Subject: RE: [AccessD] A2K ideas on Order Entry The beauty of unbound forms, with custom classes handling your processes, is the ability to create your own events. I have built several projects where the forms display data based upon Global Class Objects, which interact through events. For example, I have an Inventory object, that has an 'inventory changed' event. Whenever something happens to the inventory (which is done through this class), it raises that event, and all open forms that have are using this class receive that event, and thus update themselves with the new information. Yes, it takes a little longer to set something like that up, but it is extraordinarily handy as you build more complex and 'smarter' applications. Drew -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Francisco Tapia Sent: Saturday, September 04, 2004 1:53 AM To: Access Developers discussion and problem solving Subject: [AccessD] A2K ideas on Order Entry Brainstorming here: I have a parent form which houses important order entry information such as Billto/Shipto, PO#, SO#, and Notes... along with that I have a listbox (but have been working on a readonly subform datasheet view). Users currently go into a popup window box to add new lineitems to this order. However... I'd like to control where the popup box hovers over... meaning allowing for the subform to be viewable while the popup form is on the screen. This allows ME to refresh the subform to display the newly entered items. now currently while in the popup mode, I've made it so that as soon as one line entry is complete, the form display clears out to allow another entry, and thus all the data entry guy has to do is key in the new qty etc. for his order. but once he is done, I use a keypreview to capture the ESC key to allow them to get out. I thought about what if they could just hit ENTER and when the QTY field is null it should kick him out, but I get a bizzar error on the .OnExit event of the Qty Field. thus I can't exit the form while it's processing or something like that.... any ideas?.. (yeah I realize that its' 12:00am PST but that's when the mind is wandering :D) thanks, -- -Francisco -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com