Charlotte Foust
cfoust at infostatsystems.com
Thu Feb 13 14:49:00 CST 2003
Stop that, Jim! You're going to lose your Access club card if you keep making unfavorable comparisons to VFP! <VBG> Charlotte Foust -----Original Message----- From: Jim Dettman [mailto:jimdettman at earthlink.net] Sent: Thursday, February 13, 2003 3:26 AM To: accessd at databaseadvisors.com Subject: RE: [AccessD] Just curious John, <<Classes and Withevents. POWERFUL stuff!>> Yes it is, but I was Access was like this from the ground up. VFP handles this a lot better then Access does. Jim Dettman President, Online Computer Services of WNY, Inc. (315) 699-3443 jimdettman at earthlink.net -----Original Message----- From: accessd-admin at databaseadvisors.com [mailto:accessd-admin at databaseadvisors.com]On Behalf Of John W. Colby Sent: Wednesday, February 12, 2003 3:33 PM To: accessd at databaseadvisors.com Subject: RE: [AccessD] Just curious John, This is where a class comes in handy. The class is passed in a pointer to a specific control (text box in your example). The class sinks the events for whatever control is passed in using Withevents. So the class can perform whatever action you find useful. Now the trick is to build a scanner that looks through all of the form's controls collection - me.controls(), looking for all controls of that control type. Load an instance of the class every time a text box is found. Save a pointer to the class in a collection so that they don't immediately unload again. Unload the class collection when the form closes. Voila, all your text boxes do something. It's the details of the voila that are the problem. Once you understand classes and Withevents, it is trivial to do this. I can at this point write a class to do this and a scanner to find and instantiate an instance of the class for every text box.. in about an hour. In fact my framework does exactly this. I have a form class that is loaded in the form's OnOpen. The form class has a control scanner that finds every control. I have a class for all of the data aware controls. So the scanner in the control class loads an instance of the combo class for every combo, an instance of the text box class for every text box, checkbox class for every checkbox etc. And in fact my text box control class has the very behavior you are discussing (turn the background a different color) so that I can turn on this behavior with a simple switch. My combo box class understands what to do with the combo box NotInList and dblClick. Etc. Etc. Classes and Withevents. POWERFUL stuff! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: accessd-admin at databaseadvisors.com [mailto:accessd-admin at databaseadvisors.com]On Behalf Of John Clark Sent: Wednesday, February 12, 2003 3:10 PM To: accessd at databaseadvisors.com Subject: [AccessD] Just curious I have a question that really does not pertain to anything that I am currently doing...other than it may open up some ideas for me...but I have been curious about it. If you want to do something to all controls, or all text boxes, on a form, how would you do this, without placing code behind each and every control. As I am writing this, it is occurring to me that something like this may have been posted in the past...don't remember exacts. Examples of what I would like to do are: 1) I would like to set fields so that when you click on them, with the mouse, you are taken to the beginning of the field, and maybe the end, if there were already data existing. I have done this for individual fields, and the users like it, but I was just to dang lazy to do them all. 2) There was a program in the past, where for a reason that I no longer remember, I had programmed each field to become "pale yellow," when it gained focus, and return to white, when it lost focus. I did this for each and every field, and it was a pain in the backside. Again, I am really just curious at this point, but I can think of several standards that I might input into my programs, once I figure this out. Take care! John W Clark _______________________________________________ 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 _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com