Link to home
Start Free TrialLog in
Avatar of anilgupt
anilgupt

asked on

How to add mouse down events in Mask edit control

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
Avatar of rspahitz
rspahitz
Flag of United States of America image

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.
Avatar of anilgupt
anilgupt

ASKER

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
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...
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.
ASKER CERTIFIED SOLUTION
Avatar of rspahitz
rspahitz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DanRollins
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
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange