how to detect mouse double click on edit box

I was wondering if some could tell me how to detect whether the mouse 
has been double clicked on an edit box.  I tried the standard mouse 
double click function,but that only works on the form itself.

	Z.K.
0
nospam2791 (369)
7/4/2005 3:00:58 AM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
933 Views

Similar Articles

[PageSpeed] 8

Subclass CEdit and put an OnLButtonDblClk handler in it.
				joe

On Sun, 03 Jul 2005 20:00:58 -0700, "Z.K." <nospam@nospam.net> wrote:

>I was wondering if some could tell me how to detect whether the mouse 
>has been double clicked on an edit box.  I tried the standard mouse 
>double click function,but that only works on the form itself.
>
>	Z.K.

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
7/4/2005 3:56:06 AM
Z.K. wrote:
> I was wondering if some could tell me how to detect whether the mouse 
> has been double clicked on an edit box.  I tried the standard mouse 
> double click function,but that only works on the form itself.
> 
>     Z.K.

The standard mouse double click function also works in an edit box.  You 
need the procedure known as control sublcassing, so you can handle 
messages sent to the edit control:

1. Derive a class from CEdit.
2. Create a member variable, of your derived class, and associate it 
with the edit control.  (Right click on the control, use Class Wizard or 
Add Variable to create a control member variable.)
3. Add a message handler in your derived class for WM_LBUTTONDBLCLK.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
7/4/2005 4:47:17 AM
Ok, thanks.  That worked just fine.  Thanks.

	Roger

Joseph M. Newcomer wrote:
> Subclass CEdit and put an OnLButtonDblClk handler in it.
> 				joe
> 
> On Sun, 03 Jul 2005 20:00:58 -0700, "Z.K." <nospam@nospam.net> wrote:
> 
> 
>>I was wondering if some could tell me how to detect whether the mouse 
>>has been double clicked on an edit box.  I tried the standard mouse 
>>double click function,but that only works on the form itself.
>>
>>	Z.K.
> 
> 
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
0
nospam2791 (369)
7/4/2005 6:45:29 PM
Ok, I did that, it was easier than I thought actually.  Would you happen
to know how to do the same thing in VC++ 7, the .net version.  In VC++ 6
, I just use the class wizard, but I am unsure how to do it in VC++ 7.
Also, I got the double click in the edit control to work, but when I pop
up a dialog and hit okay, the focus does not return to the edit box.  It
looks like it does and has a flashing cursor, but I type something,
nothing appears in the edit box unless I click the mouse in the edit box
first.  It is not a really big deal, but it would be nice if I could
return the focus to the control after hitting okay on the dialog box.

	Z.K.

Scott McPhillips [MVP] wrote:
> Z.K. wrote:
> 
>> I was wondering if some could tell me how to detect whether the mouse 
>> has been double clicked on an edit box.  I tried the standard mouse 
>> double click function,but that only works on the form itself.
>>
>>     Z.K.
> 
> 
> The standard mouse double click function also works in an edit box.  You 
> need the procedure known as control sublcassing, so you can handle 
> messages sent to the edit control:
> 
> 1. Derive a class from CEdit.
> 2. Create a member variable, of your derived class, and associate it 
> with the edit control.  (Right click on the control, use Class Wizard or 
> Add Variable to create a control member variable.)
> 3. Add a message handler in your derived class for WM_LBUTTONDBLCLK.
> 

0
nospam2791 (369)
7/4/2005 7:21:56 PM
HEY MICROSOFT! I HOPE SOMEONE IS READING THIS!

Your complaint is common. Microsoft TOTALLY screwed up the ClassWizard in VS.NET, and
worst of all, they are running under the severe delusion they have "improved" it.
Questions like yours simply emphasize that we can do without "improvements" that make
products harder to use. 

I don't currenty have VS.NET up, so I can't remember how to invoke ClassWizard myself.  So
I had to bring it up. You have to bring up a dialog, right click on it, and select Add
Class. 

The correct approach is the VS6 approach: you should be able to globally invoke
ClassWizard at an time for any reason. But this is too much like reasonable behavior to
mee the new GUI philosophy at Microsoft, which appears to be "Any group can create any
interface, no matter how bizarre, as long as it is completely different from every other
interface, both historically and at this instant relative to all other products, and most
importantly, it must be hard to use"

After the DoModal, call SetFocus() to restore the focus.. I haven't tried this, but it
might also involve doing a GetSel before the DoModal and a SetSel after the SetFocus.
				joe

On Mon, 04 Jul 2005 12:21:56 -0700, "Z.K." <nospam@nospam.net> wrote:

>Ok, I did that, it was easier than I thought actually.  Would you happen
>to know how to do the same thing in VC++ 7, the .net version.  In VC++ 6
>, I just use the class wizard, but I am unsure how to do it in VC++ 7.
>Also, I got the double click in the edit control to work, but when I pop
>up a dialog and hit okay, the focus does not return to the edit box.  It
>looks like it does and has a flashing cursor, but I type something,
>nothing appears in the edit box unless I click the mouse in the edit box
>first.  It is not a really big deal, but it would be nice if I could
>return the focus to the control after hitting okay on the dialog box.
>
>	Z.K.
>
>Scott McPhillips [MVP] wrote:
>> Z.K. wrote:
>> 
>>> I was wondering if some could tell me how to detect whether the mouse 
>>> has been double clicked on an edit box.  I tried the standard mouse 
>>> double click function,but that only works on the form itself.
>>>
>>>     Z.K.
>> 
>> 
>> The standard mouse double click function also works in an edit box.  You 
>> need the procedure known as control sublcassing, so you can handle 
>> messages sent to the edit control:
>> 
>> 1. Derive a class from CEdit.
>> 2. Create a member variable, of your derived class, and associate it 
>> with the edit control.  (Right click on the control, use Class Wizard or 
>> Add Variable to create a control member variable.)
>> 3. Add a message handler in your derived class for WM_LBUTTONDBLCLK.
>> 

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
7/5/2005 2:16:49 PM
Ok thanks.  I quite agree with you on Microsoft's improvements.

	Z.K.

Joseph M. Newcomer wrote:
> HEY MICROSOFT! I HOPE SOMEONE IS READING THIS!
> 
> Your complaint is common. Microsoft TOTALLY screwed up the ClassWizard in VS.NET, and
> worst of all, they are running under the severe delusion they have "improved" it.
> Questions like yours simply emphasize that we can do without "improvements" that make
> products harder to use. 
> 
> I don't currenty have VS.NET up, so I can't remember how to invoke ClassWizard myself.  So
> I had to bring it up. You have to bring up a dialog, right click on it, and select Add
> Class. 
> 
> The correct approach is the VS6 approach: you should be able to globally invoke
> ClassWizard at an time for any reason. But this is too much like reasonable behavior to
> mee the new GUI philosophy at Microsoft, which appears to be "Any group can create any
> interface, no matter how bizarre, as long as it is completely different from every other
> interface, both historically and at this instant relative to all other products, and most
> importantly, it must be hard to use"
> 
> After the DoModal, call SetFocus() to restore the focus.. I haven't tried this, but it
> might also involve doing a GetSel before the DoModal and a SetSel after the SetFocus.
> 				joe
> 
> On Mon, 04 Jul 2005 12:21:56 -0700, "Z.K." <nospam@nospam.net> wrote:
> 
> 
>>Ok, I did that, it was easier than I thought actually.  Would you happen
>>to know how to do the same thing in VC++ 7, the .net version.  In VC++ 6
>>, I just use the class wizard, but I am unsure how to do it in VC++ 7.
>>Also, I got the double click in the edit control to work, but when I pop
>>up a dialog and hit okay, the focus does not return to the edit box.  It
>>looks like it does and has a flashing cursor, but I type something,
>>nothing appears in the edit box unless I click the mouse in the edit box
>>first.  It is not a really big deal, but it would be nice if I could
>>return the focus to the control after hitting okay on the dialog box.
>>
>>	Z.K.
>>
>>Scott McPhillips [MVP] wrote:
>>
>>>Z.K. wrote:
>>>
>>>
>>>>I was wondering if some could tell me how to detect whether the mouse 
>>>>has been double clicked on an edit box.  I tried the standard mouse 
>>>>double click function,but that only works on the form itself.
>>>>
>>>>    Z.K.
>>>
>>>
>>>The standard mouse double click function also works in an edit box.  You 
>>>need the procedure known as control sublcassing, so you can handle 
>>>messages sent to the edit control:
>>>
>>>1. Derive a class from CEdit.
>>>2. Create a member variable, of your derived class, and associate it 
>>>with the edit control.  (Right click on the control, use Class Wizard or 
>>>Add Variable to create a control member variable.)
>>>3. Add a message handler in your derived class for WM_LBUTTONDBLCLK.
>>>
> 
> 
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
0
nospam7515 (2084)
7/6/2005 5:33:16 AM
Reply:

Similar Artilces:

Editing data from 2 different tables
Hi All, Could someone please explain to me if it is possible to edit data from 2 different tables that are being showed in the same form? I created a form which shows fields from 2 different tables and I can not edit the fields. I would like to be able to change/include data using my form. Thank you. The two tables need to be related in some manner and joined in a query for the RecordSource of your form. Elaine Parlato wrote: >Hi All, >Could someone please explain to me if it is possible to edit data from 2 >different tables that are being showed in the same form? > >I cr...

>right click >send to >mail recipient
i loaded msn explorer premium..bad idea. anyhow, after its installation, and even after its uninstallation, i lost the functionality of right clicking a file, and sending to a mail recipient. The option is still there, but once i click these items, nothing happens. after spending 1.5 hours with microsoft windows xp tech support...another bad idea, nothing different happens either:O anyone have a solution for this? this article x-posted to: microsoft.public.windowsxp.general,microsoft.public.outlook,microsoft.publi c.outlook.general follow up to: microsoft.public.windowsxp.general s...

How to detect changes in a column?
If I have a table with sales forecast data (columns) like Customer, Amount and Status, what would be the best way to track changes in this table so I can compare my forecast week after week? -- inomata ------------------------------------------------------------------------ inomata's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=18938 View this thread: http://www.excelforum.com/showthread.php?threadid=493571 ...

double picture files
How can I find double picture files in MS Office picture database ? ...

Double Debt in Budget
I'm used Money for 7+ years but haven't messed with the Budget much until now. Budget is showing my monthly debt payment to be exactly 2 times the actual amount. Since I have no debt other than a mortgage, I hope this isn't too hard to figure out. Where does Money get it Debt figures from? I have only one Scheduled Bill associated with the mortgage and it is for the correct amount. Any help is appreciated. "Blue Yonder" <dontbotherme@nospam.com> wrote in message news:11ukr7i6ql8tk02@corp.supernews.com... > I'm used Money for 7+ years but haven'...

Crystal Enhanced Edition
When I tried to install the enhanced edition, I got the message "setup has detected that you have 9.2.0 installed". I now have the 9.2.2 upgrade from Crystal. Do I install on the server or client? If I install on the client do I also install the enhanced edition on the client as well? Thanks for your help Install on client Install enhancement on Client Peter "dpsman" <dpsman@discussions.microsoft.com> wrote in message news:C1148C70-90A4-41F4-A395-55E18D2E454D@microsoft.com... > When I tried to install the enhanced edition, I got the message "setup has...

MultiWorkbook Change Event Detection / Spell Checker
Excel 2003 or 2007. Looking to be able to force spell checking whenever any cell content is is changed. I've been successful on a single workbooks by adding Spell Check execution on Worksheet_Change. I'm hoping to take this one step further - make it an 'Add-In' so the check will run for any workbook. It looks like the Worksheet_Change event only triggers for the host workbook so an 'Add-in' will not do the job. Any suggestions to force spell checking on a change for any workbook/worksheet I modifiy? TIA, - Pat The way I would go about this i...

Setting the range of a dialog box slider
Can anyone help me to set the min and max values of a slider control on a slider control in a dialog box, I created the control with the resource editor and do not know how to access the class of the control (the class wizard only creates a class for the dialog box), is there a way to attach a CSliderCtrl class to the resource or is there some other way to access the object in C++. SiBorg wrote: > Can anyone help me to set the min and max values of a slider control on a slider control in a dialog box, I created the control with the resource editor and do not know how to access the class of...

change check box value based on combo box value
I have a form (Form1) with a combo box (Combo43) with three values: Reference 1 Antenatal 1 Quant 1 I also have two check boxes (check36 and check34) What is the best way to implement such that when Reference 1 is selected in the combo box, check34 changes from false to true, and when Antenenal 1 or quant 1 is selected, check 36 changes to true? I've tried something along the lines of, but no luck: Private Sub Combo43_AfterUpdate() If Me.Combo43 = "Reference 1" Then Me.Check32 = True Else Me.Check32 = False End If End Sub I'm a beginner at this, so any help would be ...

Newbie Question
Ok, I'm tearing my hair out. I've searched for about 6 hours (and I thought I was pretty good at searching/researching on the 'net before this) and apparently, I'm just blonde and that's that. It seems to me what I'm trying to do would be in a "Welcome to Excel 101" tutorial on the first page... argh! Anyway, I'm trying to get a final sum of two cells. Below, I'll try to give a step by step example of the possible scenarios I'm trying to resolve in one single cell, the sum of two other cells, which may contain double positives, double negatives...

looking for a special type of edit box ..
Hi, I am looking for a way to create an edit box, that shows 8 empty, tiny circles around the boundary to beg for an immediate attention from user. User should then know he/she needs to enter something such as an integer. I am using an x to represent such a circle in the following diagram showing such an edit box. It can be seen in applications from time to time. Is there a property associated with the MFC edit box to make it happen? Your help is much appreciated. x-------------x-------------x | | x x ...

"Do not allow Attachments" box is greyed out
Just finished installing W2K SP4, IE6 SP1 and all the latest patches from MS. I am using Outlook Express but I cannot open or Save Attachments. Under Options/Security the box labeled "Do not allow attachments to be saved or opened that could potentially be a virus" is greyed out, therefore I cannot change the value. Tried MS web site, but I cannot find any fix. See http://support.microsoft.com/default.aspx?scid=KB;en-us;q291387 Also note: This is a group to support Outlook from the Office group of programs. Outlook Express is a part of Internet Explorer and is a quite diffe...

Format in Message Box
I have a Message Box that is composed like... strMsg = "county : " & cboCounty & vbCrLf & ... etc MsgBox strMsg & vbInformation and looks like... County : Manitoulin Regional Manager : Joe McGuiness Code : A45-X This may be really picky, but I'd like the colons to be lined up vertically just for appearances sake. It doesn't really work using spaces (just like I'm sure it won't in this posting). Is there a way to use tabs when composing the message? Thanks - Victoria I...

Hello,a programe about zoom in the mouse area?
This is a multi-part message in MIME format. ------=_NextPart_000_02D5_01C38DA0.3719B020 Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit Hello,I want to zoom in the mouse area in my programe,who can give me a good idea to do it? ------=_NextPart_000_02D5_01C38DA0.3719B020 Content-Type: text/html; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3D...

detect and repair
my outlook 2002 had some hyperlink problems which were corrected when i used the 'detect and repair' option in help. now i have lost my addresses and all the e-mail that was in my inbox. How do i recover these items? Check this page for all you need to know: http://www.slipstick.com/config/backup.htm -- Aloha, -Ben- Ben M. Schorr, OneNote-MVP http://home.hawaii.rr.com/schorr **I apologize but I am unable to respond to direct requests for assistance. Please post questions and replies here in the newsgroup. Mahalo! "Mark Conner" <mdconner@prodigy.net> wrote ...

Problem Report on SOP Taxes and Printing Edit List
This is an issue that started since version 7.5 and has been identified as a Problem Report. However, up until now, there are no service packs, nor fixes. To recreate, here are the steps: 1. Create transaction in Sales Trx entry window, make sure taxes are calculated (with tax detail ID from the tax field) 2. Save the transaction in a batch, then print an edit list. 3. The first edit list is okay, print again the same transaction on an edit list, there will be an error already in the report (ie. Taxes are not fully distributed, errors in distribution accounts, etc..) 4. Pull up t...

Relay for UNIX box
Can I use our Exchange 2000 server as a relay for a UNIX machine? We want to send out notices from our UNIX box to our customers. On the exchange server, I went to default SMTP Virtual server >> Access >> Relay restrictions >> Only the list below and I entered the IP address of our UNIX machine. With this setup, will the Exchange server forward out the UNIX email messages? Or, do I have to set up an account on the Exchange box so that it can work? Please advise. Jim On Fri, 13 Apr 2007 11:22:01 -0700, Jim in Cleveland <JiminCleveland@discussions.microsoft.com...

Parameter query for a combo box row source
A query for a combo box on a form uses a value from a text box on the same form. Can I refer to the text box without specifying the form name? e.g. Currently I am using "Forms!Form1!Text1" - would like to use something like "Forms!(Me.Name)!Text1" No. If you use the criteria in the form, it must include the form name to find the text box. It might be possible to write a VBA function that returns the value of the active text box on the active form, and then use the function in the criteria of your query. Alternatively, it might be better to avoid putting the crit...

How to Detect and prevent CD burn
HI, How can i stop to CD burn of any file from my system to CD.How to detect the event of CD burn and how can i stop CD burn.Basically i want to secure my file from CD burn. plz reply soon. regds vinay sheel vinays@aditi.com Vinay wrote: > HI, > How can i stop to CD burn of any file from my system to CD.How to detect the > event of CD burn and how can i stop CD burn.Basically i want to secure my > file from CD burn. You can restrict access to a file only to a certain users through NT/win200 access privileges. You can encrypt a file and therefore restrict access to a file on...

crazy mouse?
mouse acts crazy, cells highlight, how do I stop--only in excel This is a known (but unacknowledged by Microsoft) bug. If you have a wheel on your mouse, try clicking it a few times. If you have a USB mouse, disconnect and reconnect it. Otherwise, you're stuck with Ctrl+Alt+Delete to shut down Excel. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "bmwridr" <bmwridr@discussions.microsoft.com> wrote in message news:D7F80D57-7E29-41E1-9D33-772D384F8040@microsoft.com... > mouse acts crazy, cells highlight, how do I...

Get External Data
I have imported data using Get External Data and then tried to edit it via Get External Data/Edit Query, but I get a message "This query cannot be edited by Microsoft Query". I can't understand why I get this message or how to access the query wizard under these circumstances. I even re-created my query from scratch in case it was due to anything I added to the file, but I still get the same message in the newly created query. How can I re-establish the Query Wizard? Are you able to view the query window at all? Without more details about your query, it's difficult...

how to open display the chart by clicking the cell in excel sheet
...

downloads and double double entries
I have a problem -- and I am the first to admit it may be with my concept or use of Money 2003. I am no accountant. Please bear with me when I explain. I have various accounts that can download from the WWW to Money, which I find very useful. I download my charge card transactions from Mastercard. I download my bank account transactions too. I pay off my Mastercard from a bank account. Now here's the problem. To properly reconcile my $$$$, and use the Money category to track it, I want to use the "Special" category "Transfer" from the bank account to the Mas...

Invoking an Application on right click
Hi all I am using Interface IContextMenu to add a menu in context menu, Now what I want that : when we right click on any file or folder and select my given menu ( inserted using IContextmenu) then application ( Let MyApp.exe) should be invoked for that file or folder. I know Invoke method of IContextmenu interface can be used for this purpose but not sure that how to use this for invoking exe. Please guide me. Thanks > then application ( Let MyApp.exe) should be invoked for that file or folder. I dont knwo what you mean by for that file or folder. You can use ShellExecute to launch th...

Auto Populate a Combo Box based on the user selection of another Combo Box
I have a form that has 3 Combo Boxes; 1) Personnel Number, 2) First Name, 3) Last Name. The Row Source for each Combo Box is "tblPersonnel_Number", and each Combo Box is assigned to their respective Control Source by name. When the user selects their Personnel Number I'd like the First Name, and Last Name to populate automatically. I found out how to do this by using "=Personnel_Number.column(2)" for First Name, and "=Personnel_Number.column(3) " for Last Name, but when I close the form it saves the Personnel Number into "tblPersonnel_Number" ...