Data Access Worldwide Knowledge Base

Article ID 2264
Article Title HOWTO: Color the active window/control
Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2264
KBase Category VDF (GENERAL)
Date Created 11/24/2006
Last Edit Date 02/13/2007


Article Text
QUESTION:
I have a lot of views that can be considered busy views with a lot of input controls and buttons. Sometimes we get the complaint from end-users that they are lost. They don't know where they are on the screen anymore. I would like to color the active window to draw their attention to it. How can I do that?

ANSWER:
While the complaint should really ring a bell about the application design, you can quite easily (by adding code to subclasses of dbform etc) make the active control color itself. If we take a dbform, for example, we can change the subclass code to:

Class cDbForm Is a dbform
    Procedure Construct_Object
        Forward Send Construct_Object
        
        Property Integer piActiveColor clYellow
        { DesignTime=False }
        Property Integer private_piResetColor
    End_Procedure
    
    Procedure Activating Returns Integer
        Integer iRetval iColor
        
        Forward Get Msg_Activating To iRetval
        
        If (iRetval = 0) Begin        
            Get Color To iColor
            Set private_piResetColor To iColor
        End
        
        Procedure_Return iRetval
    End_Procedure

    Procedure Deactivating Returns Integer
        Integer iRetval iColor
        
        Forward Get Msg_Deactivating To iRetval
        
        If (iRetval = 0) Begin        
            Get private_piResetColor To iColor
            Set Color To iColor
        End
        
        Procedure_Return iRetval
    End_Procedure
    
    Procedure Entering returns Integer
        Integer iRetval iActiveColor iCurrentColor
        
        Forward Get Msg_Entering To iRetval
        
        Get piActiveColor To iActiveColor
        Get Color To iCurrentColor
        Set Color To iActiveColor
        Set private_piResetColor To iCurrentColor
    End_Procedure
    
    Procedure Exiting Handle hoDestination Returns Integer
        Integer iRetval iResetColor
        
        Forward Get Msg_Exiting hoDestination To iRetval
        
        If (iRetval = 0) Begin
            Get private_piResetColor To iResetColor
            Set Color To iResetColor
        End
        
        Procedure_Return iRetval
    End_Procedure
End_Class

The above code colors the control to the color value stored in piActiveColor (statically set to yellow) when you enter the object and colors it back to the original color on leaving.

The technique above can be easily added to other subclasses like (db)Comboform.


Contributed By:
Vincent Oorsprong
Company: Data Access Worldwide
email: vincent.oorsprong@dataaccess.eu
Web Site: http://www.dataaccess.eu


Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.

The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.