event MouseMove (Button as Integer, Shift as Integer, X as OLE_XPOS_PIXELS, Y as OLE_YPOS_PIXELS)
Occurs when the user moves the mouse.

 TypeDescription 
   Button as Integer An integer that corresponds to the state of the mouse buttons in which a bit is set if the button is down.  
   Shift as Integer An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys.  
   X as OLE_XPOS_PIXELS A single that specifies the current X location of the mouse pointer. The x values is always expressed in container coordinates  
   Y as OLE_YPOS_PIXELS A single that specifies the current Y location of the mouse pointer. The y values is always expressed in container coordinates  
The MouseMove event is generated continually as the mouse pointer moves across objects. Unless another object has captured the mouse, an object recognizes a MouseMove event whenever the mouse position is within its borders. Use the EnsureVisible method to ensures that an editor fits the control's client area. Use the EditorFromPoint property to get the editor from the cursor.

The following VB sample prints the editor from the point:

Private Sub Record1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim e As EXRECORDLibCtl.Editor
    Set e = Record1.EditorFromPoint(X / Screen.TwipsPerPixelX, Y / Screen.TwipsPerPixelY)
    If Not e Is Nothing Then
        Debug.Print e.Label & " = " & e.Value
    End If
End Sub

The following VC sample prints the editor from the point:

static CString V2S( VARIANT* pv, LPCTSTR szDefault = _T("") )
{
	if ( pv )
	{
		if ( pv->vt == VT_ERROR )
			return szDefault;

		COleVariant vt;
		vt.ChangeType( VT_BSTR, pv );
		return V_BSTR( &vt );
	}
	return szDefault;
}

void OnMouseMoveRecord1(short Button, short Shift, long X, long Y) 
{
	CEditor editor = m_record.GetEditorFromPoint( X, Y );
	if ( editor.m_lpDispatch != NULL )
	{
		TCHAR szOutput[1024];
		wsprintf( szOutput, "%s = %s\n", (LPCTSTR)editor.GetLabel(), (LPCTSTR)V2S( &editor.GetValue() ) );
		OutputDebugString( szOutput );
	}

}

Send comments on this topic.
© 1999-2007 Exontrol Inc, Software. All rights reserved.