jwcolby
jwcolby at colbyconsulting.com
Sun Mar 2 19:47:09 CST 2008
Yea, I'm here. I have a bunch of WithEvent class demos on my site including some that change the background color. If this is to be generic, IOW it should work with any form and the controls on those forms, then you will want a form class that any form needing to do this will use. That form would use a control scanner to find all controls on the form. Additionally you would want a class for each control that you want the background to change, for example a clsCtlTxt, clsCtlCbo etc. Once you have those, the form class is initialized by the form, the form class initializes a class instance for each control and you are off. The form class would also control the form's AllowEdits property and any others you might need controlled. Poke around through my demos and I am sure you will find the skeleton for just this kind of thing. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Sunday, March 02, 2008 5:01 PM To: Access Developers discussion and problem solving Subject: [AccessD] A Good Reason for a Class I'm doing a traditional (MDB) app with one minor twist. The form's controls are (almost all) read-only until the user elects to update the data. At that point the Save button becomes enabled and remains enabled until the user saves the data, and then we're back to read-only. As a first pass, I simply set the form's AllowEdits to False, then switched it to True when the user clicks the button. Easy enough. But now I want to add some functionality, at least cosmetic. I want the controls to display in a color such as grey when they cannot be edited, and then white when they can be edited, and finally I want the control that has focus to change to yet another color and change back when it loses the focus. I've got an idea that this is an occasion when I should create a class and make all the controls inherit some of that class's behavior. I'm not sure how to begin this exercise. What should I do? JC, are you awake? TIA, Arthur -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com