Print Page | Close Window

Form_CommonMouseMoveFunction.mdb

Printed From: Roger's Access Library
Category: Other Download Libraries
Forum Name: Tejpal, A.D.
Forum Description: A.D. Tejpal's Library
URL: www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=110
Printed Date: 28 Mar 2024 at 11:46pm
Software Version: Web Wiz Forums 12.03 - http://www.webwizforums.com


Topic: Form_CommonMouseMoveFunction.mdb
Posted By: A.D. Tejpal
Subject: Form_CommonMouseMoveFunction.mdb
Date Posted: 09 Jul 2008 at 10:35pm
    This sample db demonstrates common functions for MouseMove, GotFocus and  
LostFocus over multiple controls on a form, for temporarily highlighting the control
having mouse over, apart from special highlight for control actually having focus.
 
    MouseMove over a given control does not necessarily imply that the control in 
question is the active control. This rules out the use of an omnibus function based 
upon ActiveControl. Instead, it becomes necessary that even if a common function 
of generic nature is used for all controls, name of each individual control making
the call has to be passed as an argument.
 
    Evidently, conventional approach in calling such a function from MouseMove 
events of multiple controls involves tedious work by the developer. Repetitive 
entries of function name (with control name as argument) are needed either in VBA 
code in MouseMove event for each of the controls in question, or directly as similar 
entries against OnMouseMove property on Event tab in properties dialog box of 
each such control.
 
    An interesting alternative has been demonstrated here that makes the whole 
process remarkably simpler, overcoming the above drawbacks. As the form loads, 
OnMouseMove event property of all text/combo boxes and labels gets set to function 
Fn_MMove(), correctly passing the name of control as argument in each case. Similar 
action takes place for OnGotFocus and OnLostFocus properties, loading functions 
Fn_GotFocus()and Fn_LostFocus() respectively, correctly passing the name of control 
as argument in each case.
 
    Mouse move over text boxes, combo boxes and labels leads to following response
(controls with transparent back style are kept exempt from this behavior, presuming
that the user would like such controls to remain steady):
    (a) Back color for text or combo box becomes pink while that for label becomes 
         golden.
    (b) Special effect - The control appears raised.
    (c) Simultaneously, previously highlighted control, if any, reverts to its original 
        state of back color and special effect. This is done by calling subroutine 
        named P_ClearHighLightPrevControl() in Fn_MMove() as well as MouseMove
        event 	of command button named CmdClose.
    (d) Control having focus is always highlighted in green. It over-rules any 
         	highlight that might result from mouse move. For example, if a text box
         	not having focus is currently highlighted in pink because of mouse move
         	and the user sets focus on that text box either by clicking or tabbing, 
          	it gets highlighted in green.
 
    Note: 
    (a) Particulars of previously highlighted control are stored in form level global 
         variables. Whenever function Fn_MMove() is called, original status of the 
         control in question gets stored in these variables, before proceeding with the 
         task of temporary highlighting.
    (b) Form's MouseMove event has the limitation that it fires only in the dead area 
         of form window (where form canvas is absent). For this reason, assured 
         restoration of highlighted control to its original status takes place when the 
         next control gets highlighted via MouseMove.
    (c) If it is desired to restore currently highlighted control to its original status, 
         without having to highlight another one, simply hover the mouse over the 
         button captioned "Close".
 
Version: Access 2K/XP/2K3/2K7 (Access 2000 File Format)

Download Access 2K/XP/2K3/2K7: http://www.rogersaccesslibrary.com/forum/uploads/37/Form_CommonMouseMoveFunction.zip - uploads/37/Form_CommonMouseMoveFunction.zip



-------------
--

Email: mailto:adtejpal@gmail.com - adtejpal@gmail.com



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.03 - http://www.webwizforums.com
Copyright ©2001-2019 Web Wiz Ltd. - https://www.webwiz.net