?
Solved

How to add mouse down events in Mask edit control

Posted on 2002-05-13
7
Medium Priority
?
314 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 300 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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

777 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