Solved

How to add mouse down events in Mask edit control

Posted on 2002-05-13
7
298 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 22

Expert Comment

by:rspahitz
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

763 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

7 Experts available now in Live!

Get 1:1 Help Now