Solved

How to add mouse down events in Mask edit control

Posted on 2002-05-13
7
307 Views
Last Modified: 2008-01-09
Hi,
As all of you know very well, Mouse Down event is not available in the masked Edit control. But i need to capture this events of the mask edit control and show pop up menu. Can u help me??? If anybody provide some code for this , this may be more helpful for me.
Thanks and regards,
+Anil
0
Comment
Question by:anilgupt
7 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 7007321
The only possibility that I can think of is to drop the masked edit box into a user control, then have it intercept all properties, methods and events to coincide with that of the edit box.  LAstly, add the desired mouse event(s) to the control and handle them accordingly.

If you need help with making a user control, let me know.
0
 

Author Comment

by:anilgupt
ID: 7007630
Thanks rspahitz for kind reply,
But as you replied, I have already done this thing. After that mouse down event of the user control does not fire.
It may be possible that i am doing something wrong. Please help me in making user control. Let me know the steps of developing this user control. I will check it with my steps.
I am increasing the point from 50 to 75.
Thanks and regards,
+Anil
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7008870
I think the problem in the user-control is that it gives up control to it's constituent controls when they're enabled.  So depending on what you're doing, you may be able to simply disable the rich text box, then have each event occur at the user-control level which should in turn pass on the event to the rich text box.

More to follow in the next comment...
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 22

Expert Comment

by:rspahitz
ID: 7008996
So far this, but I'm still investigating.  Somehow we need to disable the masked edit control (not rich text box that I mentioned in the las comment) so the user control receives all events, then pass the info on to the constituent control.

Building that "New" Masked Edit Box:

* Add a user control to your project.
* Change the name to something like NewMaskedEditBox
* Add a Rich Text Box to the user control, and set it to enabled=false.
* Add this code:
Private Sub UserControl_Resize()
  MaskEdBox1.Move 0, 0, UserControl.ScaleWidth, UserControl.ScaleHeight
End Sub

* Go back to Project|Add User Control, and select VB ActiveX Control Interface Wizard.

Follow through and select all of the events that you care about (probably all of those from the RTB plus the mouse events...which is probably all of the defaults plus maybe Format, Mask, MaxLength, MouseIcon, MousePointer, PromptChar, PromptInclude, TextHeight, TextWidth, Validate.)

Skip "My Custom Members" unless you'd like to add something.

Map all properties, methods, and events to the masked edit control if they have corresponding items, otherwise map them (including MouseDown/Move/Up events and Enabled) to the UserControl.
0
 
LVL 22

Accepted Solution

by:
rspahitz earned 75 total points
ID: 7009155
You'll also need to add some of the hidden (read-only properties of the MEB such as Text:

Public Property Let Text(ByVal New_Text As String)
  MaskEdBox1.Text() = New_Text
  PropertyChanged "Text"
End Property

By setting the MaskEdBox1 in the user-control to Enabled=False initially, the events fall through to the user-cotnrol.
---

After further review, this is rather complex because you'll need to keep the MaskEdBox disabled in order to capture the mouseevents, but enabled to allow it to easily perform its normal= functions.  I was hoping there was something that could be laid over the top to capture the events, but those are all either lightweight controls that fall under it, or heavyweight controls that obscure it.

At this point, the only thing I can see doing (without entirely re-writing it) is to add some extra elements to the control to keep track of the current cursor position and any selected text, then use that information to recreate the instructionset of the masked edit control by enabling it, performing the function, then disabling it.

These missing events are certainly a major short-coming of the masked edit box!
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7765283
Hi anilgupt,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept rspahitz's comment(s) as an answer.

anilgupt, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 7834777
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question