Solved

How to add mouse down events in Mask edit control

Posted on 2002-05-13
7
303 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now